Skip to content
Open the portal
Developer docs

The API

Engineers6 min read

The API is a FastAPI service at https://api.stratl.ai (or http://localhost:8000). Its OpenAPI description is served at /openapi.json, and the reference pages on this site are generated from it, so they are exactly as complete as the service.

Two kinds of caller.

People sign in through the portal and hold a session cookie. The portal forwards /api to the API server-side so the cookie stays first-party; a browser never calls the API origin directly.

Agents and collectors send an ingest key: Authorization: Bearer sk_stratl_.... Ingest keys may write records, upload originals, report outcomes and run replay sets (records:write) and nothing else; the replay sets are the one thing they can read back. They are created and revoked under Settings → API keys, shown once, and stored as hashes.

Every request is scoped to the caller’s workspace. A record, bundle, notice, source or hold that belongs to another workspace answers 404, the same as one that does not exist. Roles decide what a person may change; the server enforces the matrix on every write route. Roles.

Errors are JSON with a detail object carrying a machine-readable code and, sometimes, more:

{ "detail": { "code": "notice_not_approved", "status": "draft" } }
Status Typical codes
401 not_authenticated (no session and no key), invalid_api_key (a key that is wrong or has been revoked)
403 read_only_role (an auditor tried to change something), forbidden with permission
404 decision_not_found, notice_not_found, subject_not_found, key_not_found, replay_not_found: also the answer for another workspace’s objects
409 decision_id_conflict (the id exists in another workspace), notice_not_approved, custody_already_taken, hold_already_lifted, replay_closed
413 artifact_too_large (default limit 5 MiB); request_too_large with max_bytes when any other body is over its cap (1 MiB for records, 8 MiB for OTLP)
422 Validation errors, hash_mismatch on an artifact upload, recipient_email_required, custody_probe_failed with the probe steps, not_a_decision (an outcome on one of Stratl’s own records), recall_needs_criteria
429 rate_limited on ingest with scope (key or ip) and retry_after, plus a Retry-After header; sign-in code limits with retry_in
502 email_failed: the email provider refused a notice

GET /healthz says the process answers. GET /readyz says the system is doing its job and answers 503 when a critical check fails; it checks the database, custody storage, the key service and the timestamp authorities, and a watchdog tells us when one fails. Both need no account. Every response carries an X-Request-Id header, kept from the request when you send one, and an unhandled error answers 500 internal_error with that id so a support conversation can name the request.

Every route that writes records or originals (/v1/ingest/*, /v1/artifacts/*) is rate limited per ingest key and per client address, with token buckets: a burst may arrive at once, then the sustained rate applies. Defaults are 120 at once and 600 a minute per key, 240 and 1,200 per address. Every accepted response (202) carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the bucket is full again) for the tighter of the two; a refused request answers 429 rate_limited with Retry-After, costs nothing against either bucket, and writes nothing. Both SDKs treat a 429 like an outage: the record is spooled and flush_spool() sends it later. Request bodies are capped before authentication: 1 MiB for a record, 8 MiB for an OTLP batch, and the artifact limit for an original; over the cap is 413 request_too_large. The values are settings; see Configuration.

Family Prefix What
Auth /v1/auth/… Codes, sessions, workspace creation, API keys, members, invitations, switching
Ingest /v1/ingest/srf, /v1/ingest/otlp/v1/traces Records in, from SDKs or collectors. Answers 202. Idempotent on decision_id. OTLP batches may be gzipped
Artifacts /v1/artifacts/… Content-addressed originals: check which fingerprints are missing, PUT bytes whose hash must match the path, GET them back
Index /v1/decisions, /v1/subjects, /v1/sources, /v1/stats Search and read. Every record carries its verification and its retention state
Evidence …/bundle, …/pack The bundle for a record and the pack for a subject
Custody /v1/custody/…, /v1/keys/{key_id} Status, checkpoints, labels, providers, the probe and taking custody; public keys without auth
Packs and reports /v1/packs, …/coverage, /v1/reports/period Framework coverage per record and per period
Notices …/notices, /v1/notices/…, …/reconsideration, …/related The notice lifecycle and reconsiderations
Retention /v1/retention, /v1/holds The policy, what is eligible for deletion, and legal holds
Connectors /v1/connectors/… Pull connectors and their runs
Outcomes …/outcomes, /v1/outcomes, /v1/outcomes/scorecard What happened after a decision, written as DEC-OUT-… records by people and ingest keys; read and scored per agent and version by people
Recall /v1/recall, /v1/recall/facets Every decision that depended on an agent version, model, prompt fingerprint, tool, policy, document or source, grouped by subject. Read-only, people only, format=csv
Replays /v1/replays, …/items, …/results, …/close Freeze a sample of real decisions, take a candidate’s conclusions back, seal the comparison as a DEC-RP-… record. Run with records:write; listed and summarised for every member

After the decision: the three families in detail.

Reads use limit and offset; the decision list accepts filters (q, subject_type, subject_id, agent_id, source, assurance, adverse).

The reference pages are generated from the running service’s OpenAPI description, so they match what is deployed.