Zum Inhalt springen
Prototyp pruefen

API Contract

This specification defines the API contract: endpoint inventory, authentication model, scope matrix, error semantics, pagination, rate limiting, and the relationship between /events and /threats.

Audience: API engineers, integration architects.


The OpenAPI specification is intended to be the canonical, machine-readable API contract. In the current workspace, however, API docs, OpenAPI, and server implementation are still being reconciled.

The current OpenAPI 3.1 specification is a draft contract under review.


EnvironmentBase URLStatus
Current workspace runtimeLoopback-only local bind on 127.0.0.1:8080 by defaultImplemented for local development
Production targethttps://api.superheld.app/Under review
Sandbox targethttps://sandbox.superheld.app/Under review

Path versioning and public environment naming are still under reconciliation.


  • Current workspace server: unversioned resource paths such as /devices, /events, /threats
  • Target design: URL path versioning remains under review
  • Deprecation policy: not yet a reliable implementation guarantee in the current workspace
  • Backward compatibility: not yet guaranteed until the API contract is reconciled with the running server

MethodPathDescriptionAuth RequiredStatus
POST/account/registerRegister end-user account and mint portal session tokenPublic endpointImplemented
POST/account/loginAuthenticate end-user account and mint portal session tokenPublic endpointImplemented
GET/devicesList registered devicesOptional or devices:read in secure muxImplemented
POST/devicesRegister deviceOptional or devices:write in secure muxImplemented
GET/threatsList derived threatsOptional or threats:read in secure muxImplemented
GET/eventsList eventsOptional or events:read in secure muxImplemented
POST/eventsIngest signed device eventDevice signature, or events:write in secure muxImplemented
GET/alertsList alertsOptional or alerts:read in secure muxImplemented
GET/incidentsList tenant-scoped security incidentsincidents:read in secure muxImplemented, prototype/internal
GET/incidents/{id}Read one tenant-scoped security incidentincidents:read in secure muxImplemented, prototype/internal
PATCH/incidents/{id}Transition one tenant-scoped security incidentincidents:write in secure muxImplemented, prototype/internal
GET/jobsList asynchronous job recordsOptional or jobs:read in secure muxImplemented, prototype/internal
POST/jobsCreate asynchronous job recordOptional or jobs:write in secure muxImplemented, prototype/internal
GET/jobs/{id}Read one asynchronous job recordOptional or jobs:read in secure muxImplemented, prototype/internal
POST/jobs/{id}/cancelCancel one queued, running, or waiting-review jobOptional or jobs:write in secure muxImplemented, prototype/internal
POST/jobs/{id}/reviewReview one waiting-review jobOptional or jobs:review in secure mux; jobs:write remains accepted for compatibilityImplemented, prototype/internal
GET/jobs/auditList tenant-scoped audit entries across reviewed jobsOptional or jobs:read in secure muxImplemented, prototype/internal
GET/jobs/{id}/auditRead audit entries for one reviewed jobOptional or jobs:read in secure muxImplemented, prototype/internal
GET/jobs/{id}/stepsList steps for one asynchronous jobOptional or jobs:read in secure muxImplemented, prototype/internal
GET/jobs/{id}/artifactsList artifacts produced by one jobOptional or jobs:read in secure muxImplemented, prototype/internal
GET/artifacts/{id}Read one artifactOptional or jobs:read in secure muxImplemented, prototype/internal
GET/traces/{id}Read one traceOptional or jobs:read in secure muxImplemented, prototype/internal
GET/traces/{id}/stepsList steps for one traceOptional or jobs:read in secure muxImplemented, prototype/internal
GET/tokensList tenant-bound secure-mux token metadatatokens:read in secure muxImplemented, prototype/internal
POST/tokensMint tenant-bound secure-mux tokentokens:write in secure muxImplemented, prototype/internal
GET/tokens/auditRead tenant-scoped audit entries across secure-mux tokenstokens:read in secure muxImplemented, prototype/internal
GET/tokens/{id}Read one tenant-bound secure-mux token metadata recordtokens:read in secure muxImplemented, prototype/internal
GET/tokens/{id}/auditRead audit entries for one tenant-bound secure-mux tokentokens:read in secure muxImplemented, prototype/internal
DELETE/tokens/{id}Revoke one tenant-bound secure-mux tokentokens:write in secure muxImplemented, prototype/internal
POST/scanSubmit URL or hash for analysisOptional or scan:write in secure muxImplemented
GET/statusProtection statusOptional or status:read in secure muxImplemented
GET/webhooksList registered webhooksOptional or webhooks:read in secure muxImplemented
POST/webhooksRegister webhookOptional or webhooks:write in secure muxImplemented
GET/webhooks/dlqList retained webhook DLQ itemsOptional or webhooks:read in secure muxImplemented
POST/webhooks/dlqReplay retained webhook DLQ item by entry_id or latest by webhook_idOptional or webhooks:write in secure muxImplemented
DELETE/webhooks/dlqDelete retained webhook DLQ item by entry_idOptional or webhooks:write in secure muxImplemented
GET/guidanceReturn guidance cardsOptional or guidance:read in secure muxImplemented, prototype/internal

Documented Earlier, Not Implemented In This Workspace

Abschnitt betitelt „Documented Earlier, Not Implemented In This Workspace“
MethodPathNotes
GET/devices/{id}Not implemented
GET/threats/{id}Not implemented
GET/events/{id}Not implemented
POST/events/{id}/acknowledgeNot implemented
GET/policiesNot implemented
PUT/policies/{id}Not implemented
POST/rulesNot implemented
GET/familyNot implemented
POST/whitelistNot implemented
POST/reportNot implemented

The API exposes both /events and /threats. Their relationship:

EndpointModelDescription
/eventsAppend-only event streamEvery detection decision (allow, warn, block) as an immutable event. Canonical feed for SIEM, webhooks, polling.
/threatsDerived entity viewLatest state per threat (active, resolved, dismissed). Deduplicated. Derived from events.

Integrators should poll /events as their primary feed. /threats is a convenience view for dashboards and status queries.

The current workspace implementation already follows this split in broad strokes: /events is the append-oriented feed, while /threats is derived from events.

Current runtime notes:

  • POST /devices currently validates device_id, tenant_id, platform, status, and public_key_b64.
  • POST /devices currently also requires X-Device-Signature and verifies proof-of-possession against the submitted public_key_b64.
  • Device status is currently restricted to active or revoked.
  • public_key_b64 must be a valid base64-encoded PKIX RSA public key because /events signature verification depends on it.
  • Re-registering an existing device_id with a different tenant or public key is rejected as a conflict.
  • GET /incidents and GET /incidents/{id} currently expose read-only, tenant-scoped security incidents derived from accepted high-severity alerting events and high-severity security-monitor observations and backed by the configured runtime store (in-memory, local JSON, or SQLite).
  • PATCH /incidents/{id} currently accepts status transitions and enforces the current runtime state machine (open -> investigating/resolved, investigating -> contained/resolved, contained -> resolved).
  • POST /jobs currently supports incident_triage_v1 as the first deterministic workflow and creates a queued record that is processed into an internal artifact.
  • POST /jobs/{id}/cancel currently accepts queued, running, and waiting-review jobs and returns 409 for invalid state transitions.
  • POST /jobs/{id}/review currently accepts approve, amend, reject, and cancel for jobs in waiting_review; current runtime amendments support input_refs and max_runs, invalid review state returns 422, reviewed jobs surface reviewed_by when the request runs through the secure mux with a bound API token, and secure review requests now accept jobs:review with jobs:write retained as a compatibility fallback.
  • GET /jobs/audit and GET /jobs/{id}/audit currently expose the tenant-scoped internal job review audit trail backed by the configured runtime persistence layer and use the standard cursor/limit pagination contract. GET /jobs/audit currently also accepts action and reviewed_by filters, and current runtime responses expose parsed audit fields alongside raw detail when available.
  • GET /jobs/{id}/steps and GET /traces/{id}/steps can now include review_decision steps emitted by the review path.
  • GET /jobs/{id}, GET /jobs/audit, GET /jobs/{id}/audit, GET /jobs/{id}/steps, GET /jobs/{id}/artifacts, GET /artifacts/{id}, GET /traces/{id}, and GET /traces/{id}/steps are implemented in the current runtime.
  • POST /account/register currently requires email, tenant_id, and a password with at least 12 characters, stores a bcrypt-backed account record, and returns a tenant-scoped session token for portal use.
  • POST /account/login currently authenticates the stored account record and returns a fresh tenant-scoped session token carrying status:read, devices:read, alerts:read, incidents:read, tokens:read, and tokens:write.

SurfaceCurrent Behavior
Public API protectionOptional in NewMux; in-memory Bearer token + scope checks in NewSecureMux
Account authPublic POST /account/register and POST /account/login endpoints issue tenant-scoped opaque bearer tokens from email/password credentials
Device registrationX-Device-Signature proof-of-possession over the registration body, validated against public_key_b64
Device event ingestionX-Device-Signature header with RSA-PSS + SHA-256 over request body
Token lifecycleTenant-bound secure-mux prototype via GET /tokens, POST /tokens, GET /tokens/audit, GET /tokens/{id}, GET /tokens/{id}/audit, DELETE /tokens/{id}; raw token returned once on creation, metadata and audit only afterwards, with token hashes/metadata and token-audit entries persisted in the configured runtime backend
OAuth2Not implemented in the current workspace server

Current runtime note: GET /tokens/audit uses the standard cursor/limit pagination contract, currently also accepts action and token_id filters, and current runtime responses expose parsed audit fields alongside raw detail when available.

API key prefixes, OAuth2 flows, token rotation, and public auth endpoints remain under review until the public API contract is aligned with the running server.

ScopePermissionStatus
devices:readList devicesImplemented
devices:writeRegister devicesImplemented
threats:readList threatsImplemented
alerts:readList alertsImplemented
alerts:writeReserved only; no alert-create route currently existsReserved
incidents:readList tenant-scoped security incidentsImplemented, prototype/internal
incidents:writeTransition tenant-scoped security incidentsImplemented, prototype/internal
scan:writeSubmit scan requestsImplemented
events:readList eventsImplemented
events:writeAccess POST /events through secure muxImplemented
jobs:readList and inspect asynchronous jobs, traces, steps, and artifactsImplemented, prototype/internal
jobs:writeCreate and cancel asynchronous jobs; still accepted by review as compatibility fallbackImplemented, prototype/internal
jobs:reviewReview waiting asynchronous jobsImplemented, prototype/internal
tokens:readList and inspect tenant-bound secure-mux token metadata and audit entriesImplemented, prototype/internal
tokens:writeMint and revoke tenant-bound secure-mux tokensImplemented, prototype/internal
webhooks:readList webhooks and DLQ itemsImplemented
webhooks:writeCreate webhooks and trigger DLQ replayImplemented
status:readRead protection statusImplemented
guidance:readRead guidance cardsImplemented, internal/prototype

PropertyValue
TypeCursor-based
Query parameterscursor, limit
Response fieldshas_more (boolean), cursor (string for next page)
Default limit20
Maximum limit100 (500 for /events)

PropertyValue
Limit120 requests/minute in current middleware configuration
Status code429 Too Many Requests
HeadersX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (Unix timestamp), Retry-After on 429
KeyingCurrent workspace uses tenant context after successful secure auth, otherwise credential fingerprint (Authorization/X-API-Key), otherwise remote address
Proxy awarenessX-Forwarded-For and X-Real-IP are only trusted when SUPERHELD_RATE_LIMIT_TRUST_PROXY=true is set
Retry-AfterEmitted on rate-limited responses
Insecure modeRestricted to loopback binds; external insecure binds are rejected
CORSDisabled by default; optional allowlist via SUPERHELD_CORS_ALLOW_ORIGINS
HeaderCurrent Runtime Behavior
X-Content-Type-OptionsAlways nosniff
X-Frame-OptionsAlways DENY
Referrer-PolicyAlways no-referrer
Cache-ControlAlways no-store
Strict-Transport-SecurityEmitted only on TLS responses

{
"error": {
"code": "string",
"message": "string",
"status": 400
}
}
CodeMeaning
400Invalid request (missing/bad parameters)
413Request body exceeded the current runtime limit
401Authentication failed (invalid/expired key)
403Missing scope or insufficient permission
404Resource not found
429Rate limit exceeded
500Server error (retry with backoff)
{
"error": {
"code": "insufficient_scope",
"message": "Scope 'threats:read' required for this endpoint.",
"status": 403
}
}

PropertyDescription
Tenant fieldsDevice and event payloads carry tenant-related fields
Server enforcementTenant-scoped reads and secure-mux tenant checks are implemented; insecure mode remains local-only development mode
Public guaranteeNot yet safe to describe as fully enforced by design