Skip to main content

REST API

ThreatMapper exposes a full REST API. Drive the entire workflow programmatically — headless analysis, batch comparisons, layer management.

Base URL

http://localhost:8000/api

Interactive Swagger UI: http://localhost:8000/docs

Endpoint Groups

GroupBase pathDescription
ATT&CK/attackVersions, tactics, techniques, technique detail
APT/aptGroups, campaigns, Jaccard compare
Analyze/analyzeSubmit reports, streaming SSE, session library
Layers/layersSave, load, list, delete named Navigator layers
Export/exportPDF generation for analyses and layers
Sync/syncATT&CK version status and manual sync trigger
Health/healthLiveness check

Authentication

No authentication is built in — ThreatMapper is designed for internal/intranet use. Protect the API with nginx, Caddy, or your identity provider if you deploy it for a team. See Security.

Content Types

  • JSON body requests: Content-Type: application/json
  • File uploads: Content-Type: multipart/form-data
  • Streaming responses: Server-Sent Events (text/event-stream)
  • PDF responses: application/pdf with Content-Disposition: attachment

SSE Event Types

The streaming analysis endpoint (POST /api/analyze/stream) returns SSE events:

Event typePayloadMeaning
token{"content": "..."}LLM token streamed in real time
result{"data": AnalysisOut}Final parsed result
error{"message": "..."}LLM or DB failure
doneStream completed