Skip to content

SIDC C2 API

Hey Sky edited this page Nov 12, 2026 · 1 revision

SIDC – C2 – API access

🇬🇧 English · 🇩🇪 Deutsche Version

What is this page about? Every way to talk to C2 programmatically: which interfaces exist, how you authenticate, and what each one is allowed to do. For whom? Admins and tool builders (ATAKmaps, bots, scripts). Setup of tokens: Admin & install §6. Overview: SIDC – C2.

1. Overview – which access for what

Access Auth Use case
Client API (/api/client/* + read-only map routes) Authorization: Bearer sidc_… (API token, scope maps:read) local clients, e.g. ATAKmaps, fetch maps and tiles
Web/REST API (everything the browser UI uses) cookie session after login (/auth/login, or OIDC) the C2 web app itself; scripts that log in like a user
Live WebSocket (/plans/{id}/live) cookie session real-time editing of a plan (markers, strokes, phases)
Public share links (/public/plans/{token}/…) the secret link token in the URL read-only (optionally pointing/editing) view of one plan without an account
Public feedback form (/api/public/feedback/{token}) the secret link token external testers send feedback into a project
Bridge API (/bridge/*) Authorization: Bearer <BRIDGE_TOKEN> (server .env) the Discord bot (or Matrix etc.) ↔ C2 chat

Only the Client API accepts API tokens. Everywhere else a token is rejected – plans, markers, user data, admin and token management are cookie‑session only.

2. API tokens (Client API)

Create: gear → API tokens → name, optional expiry in days → Create token. The token (sidc_…) is shown once; the server stores only its SHA‑256 hash. Max. 20 active tokens per user. Revoke at any time; a password reset by an admin revokes all tokens of that user.

Scope: currently only maps:read. A token carries the rights of its user, but only for read‑only map data:

Method & path Returns
GET /api/client/ping connection test: server, version, protocol (currently 2), user label, token name/scopes
GET /api/maps list of maps
GET /api/maps/{id}/style.json MapLibre style
GET /api/maps/{id}/tiles/{layer}/{z}/{x}/{y}.png tiles
GET /api/maps/{id}/topo.geojson, locations.json, contours.geojson, peaks.geojson, {layer}.geojson additional map data

Limits: maps routes 6000 requests/min per token, ping 60/min; exceeding gives 429. Invalid/expired/revoked token → 401, missing scope → 403.

curl -H "Authorization: Bearer sidc_XXXX" https://your-c2.example/api/client/ping

Token management itself (GET/POST /api/tokens, DELETE /api/tokens/{id}) works only with a cookie session – a token can never create or extend tokens.

3. Web/REST API (cookie session)

The browser UI is a plain REST client; the same endpoints are usable from scripts that log in via POST /auth/login and keep the session cookie. The main groups:

Prefix What
/auth/* login, logout, me, me/export (own data), OIDC login
/plans, /folders plans, folders, trash, versions & restore, clone, snapshot, thumbnail, layers, phases, ACL, share links
/plans/{id}/images, /plans/{id}/orbats images on a plan, ORBATs linked to a plan
/api/orbats ORBAT force library: trees, nodes, clone, ACL
/projects, /project-folders projects: files, notes, tasks, comments, members, activity, timeline, search, milestones, feedback
/chat/* conversations, members, messages, unread, notifications (System feed)
/notify/* notification channels (Discord DM, ntfy, Matrix, web push, e‑mail)
/api/maps, /api/map-sources, /api/catalog map management/import, map sources, SIDC catalog files
/api/favorites marker favorites
/api/admin/* admin area (users, groups, audit …) – admins only
/api/tokens own API tokens

Permissions are the same as in the UI (roles, plan/project ACLs, see Roles & visibility); the API never grants more than the UI.

Interactive reference: the backend is FastAPI, so the complete, always up‑to‑date route list with schemas is served at /docs (Swagger UI) and /openapi.json of your instance.

4. Live WebSocket

wss://<host>/plans/{plan_id}/live – needs the cookie session and a matching Origin (other origins are closed with code 4403). Used by the editor for real‑time sync of markers, strokes, annotations, images and phases; the server re‑checks the user's permission continuously. Not meant as a stable third‑party interface.

5. Public links (no account)

  • Plan share link: GET /public/plans/{token} (plan data), …/images/{image_id}/raw, …/style.json, …/tiles/…, …/topo.geojson and the other map layers; WS /public/plans/{token}/live for live view. What the visitor may do (point, edit, move, see builder phases, phase restriction) is set per link by the plan owner. Tile requests are rate‑limited per IP and token. Revoke by deleting the link.
  • Feedback form: GET/POST /api/public/feedback/{token} – a project's feedback token (create/remove in the project). Anyone with the link can submit; nothing else is reachable.

Treat both tokens like passwords.

6. Bridge API (bot ↔ chat)

Neutral protocol for chat bridges, authenticated with the server's BRIDGE_TOKEN (empty = bridge off). Bot side: POST /bridge/channels (announce channels), GET /bridge/links, POST /bridge/inbound (message from the other platform), GET /bridge/outbox + POST /bridge/outbox/ack (messages to deliver), POST /bridge/dm-reply, POST /bridge/claim (link a platform account with a code). User/admin side (cookie session) under /bridge/me, /bridge/code, /bridge/identities, /bridge/links, /bridge/admin/*. Details: Chat & notifications.

7. Security notes

  • Always use HTTPS; tokens and cookies are secrets.
  • Prefer one token per device with an expiry; revoke lost ones in the token list.
  • Tokens are read‑only for map data by design – no write access via API tokens.
  • There is no token‑based write API; changes need the logged‑in cookie session.

Clone this wiki locally