Reference

API Reference

The Gostly control plane exposes a JSON HTTP API for managing recorded traffic, scheduling LEARN → MOCK transitions, training per-service adapters, and reading drift detection state. Everything the dashboard does, it does through this API.

For proxy snapshot, reset and clock controls, see the API time & episodes reference.

Base URL

The control plane listens on port 8000 by default in a customer self-host deployment. All paths in this reference are relative to that base. Every product route is under /v1; only /, /health, /mcp and SCIM’s /scim/v2 are unversioned. The unversioned forms of the product paths (/mocks, /services, /statecharts and the rest) were removed in 2026.11.0 and answer 404.

http://localhost:8000

When you publish it behind your own reverse proxy, the same surface is reachable at that proxy’s hostname.

Authentication

Most endpoints require a key in the X-API-Key header or the dashboard’s session cookie (gostly_session, HttpOnly + SameSite=Lax). When a request carries both and the session is valid, the session decides.

curl -H "X-API-Key: gsk_sa_..." \
     http://localhost:8000/v1/transition/jobs

CI pipelines and agents should use a service-account key (below). The deployment’s system-managed service key (gsk_svc_...) is the agent’s own credential and acts as an admin; keep it for the agent and the CLI.

Service accounts

A service account is a named identity for a pipeline or agent, owned by the administrator who creates it. Create one in the dashboard at /settings/keys, then issue keys for it. An admin can reassign the account to another active admin or owner. On ordinary control-plane routes, keys act as members at role checks; they do not inherit their owner's administrator privileges. Dedicated SCIM provisioning has separate authority.

Each key carries explicit scopes. Scopes do not imply one another; available scopes include:

  • read permits supported read operations, subject to the route's credential, role and feature checks. It does not authorize every GET endpoint.
  • write permits supported member-level writes. It does not imply read or include admin settings, users, key management or service-definition apply.
  • definition:apply is the separate scope for service-definition apply operations; use the deployment's API schema for request and permission requirements.
  • mcp:tools permits reaching /mcp; each tool also needs its operation scope, compatible role and licensed features.
  • mocks:read_unscrubbed expands mock content visibility on routes the key's other scopes already permit. It grants no route or operation and cannot bypass admin-only export requirements.
  • scim authorizes dedicated SCIM user provisioning and must be the key's only scope. It requires multi-user workspace enabled; see SCIM setup and lifecycle checks.

GET /v1/service-accounts returns account/key metadata and the scope catalogue. API key issuance requires a nonempty scope list; the dashboard preselects read. Keys expire after 1 to 365 days (90 by default), and stop early if the account expires, is revoked or is suspended. The raw gsk_sa_<key id>_<secret> is shown once; only its SHA-256 is stored.

Without mocks:read_unscrubbed, service-account keys receive the viewer mock content projection even if they have write: rows processed by the scrub pipeline and authored manual, MCP or OpenAPI rows. Other captured or imported mock rows stay excluded until processed. Processing and source classification do not guarantee that all sensitive data has been removed.

If the owner is demoted below admin, suspended or deleted, active service accounts they own are suspended. Subsequent requests authenticating with their keys return 401 with code: api_key_suspended. Restoring the owner's role or status does not restore accounts automatically. An admin must reassign the account to an eligible owner or explicitly unsuspend it once its current owner is eligible again; unsuspending while the owner is not eligible returns 409 with service_account_owner_ineligible. Existing unexpired, unrevoked keys then work again. A revoked or expired account cannot be restored; replace an expired or revoked key only on an active account. Suspension status and restore guidance appear in Service accounts settings, with a notice in the activity feed.

A scope refusal returns 403 with code: insufficient_scope. Expired or revoked matching credentials return 401 with code: api_key_expired or api_key_revoked. An unknown or invalid key gets a generic 401. Shared database state is checked on subsequent requests. Check any work already admitted separately. Retained audit records name the account id and key id, never the key.

Only an admin or owner login session can create, list, revoke, reassign or unsuspend service accounts and manage their keys; API keys cannot perform that administration.

The tenant key (deprecated). The single tenant-wide key from /settings → Tenant API Key (legacy) (POST /v1/api-keys/generate with an admin session) still acts as a member and has no service-account scopes. Route-specific credential, role and feature checks still apply; session-only administration refuses it. A response that a route returns as data when the tenant key authenticated it carries Deprecation: @1792972800 and a Link to this section; /mcp responses and error responses (such as a 403 from a role floor) do not. Move CI and agents to service accounts.

Tenancy

Gostly is self-hosted and single-tenant per deployment. Setup writes the workspace identity to GOSTLY_TENANT_ID; the API can also derive tenant identity from its license for manually configured deployments. Application queries are tenant-scoped, and Postgres enforces RLS beneath them through the non-owner request role, transaction-bound tenant context and FORCE ROW LEVEL SECURITY on covered tables. See the security model.

Error envelope

Use the HTTP status and the machine-readable field documented for the operation. Routed HTTP and validation exception handlers add type, title, status, code and request_id alongside detail. The problem type is about:blank. Typed domain errors also retain error_code. detail may be a string, an operation-specific object or a validation-error array; a body request ID may be null.

Replies the request boundary writes itself carry the same members: the 429 rate-limit refusal, the 500 unexpected-error reply, OpenAPI upload wire-limit refusals and the trial or license lock each send type, title, status, code and request_id, and the body request_id matches the X-Request-ID header. A 500 gets a fresh request ID rather than the one the caller sent and keeps error_code: internal_error. OpenAPI wire-limit refusals and the license lock on product routes also keep detail.code. Other operation-built responses can have a different shape. Operation-specific receipts may carry error_code in a 200 response; inspect that operation's state and result. MCP tool failures and operation receipts have their own error fields rather than this shared exception envelope.

A status alone does not identify the cause: a 403 can mean authentication scope, role or feature access, and a 409 can describe an in-progress idempotent request or another operation conflict. Follow the documented code field or detail.reason and any Retry-After header. Retain X-Request-ID when reporting a failure, along with a body request_id when present; do not parse human-readable error text as an API contract.

Look up selected error codes and next steps for access, input, service-state and retry decisions.

Idempotency

Stripe-style. Retry-prone POSTs accept an Idempotency-Key header: one value of up to 256 bytes of UTF-8 that the client picks and reuses on every retry of the same request. A retry with the same key gets the first request’s result without re-firing the side effect, so it is safe behind CI and network retries. Keys kept in PostgreSQL are stored only as a SHA-256 digest.

# First call — actually enqueues the job
curl -X POST http://localhost:8000/v1/transition/start \
  -H "X-API-Key: gsk_..." \
  -H "Idempotency-Key: ci-build-42" \
  -H "Content-Type: application/json" \
  -d '{"service_id":"stripe"}'
# → 202 {"job_id":"abc-123","status":"queued"}

# Retry with the same key — same response, no new job
curl -X POST http://localhost:8000/v1/transition/start \
  -H "X-API-Key: gsk_..." \
  -H "Idempotency-Key: ci-build-42" \
  -d '{"service_id":"stripe"}'
# → 202 {"job_id":"abc-123","status":"queued"}   ← same job_id

Which endpoints support Idempotency-Key

  • POST /v1/transition/start keeps the key in PostgreSQL on the job row. A retry gets the same job and its current status (202).
  • POST /v1/eval/run reserves the key in PostgreSQL before the run starts. A retry on any API worker gets the first successful run’s result (200) for 24 h.
  • POST /v1/training/sessions/{id}/train reserves the key in PostgreSQL before the dispatch. A retry on any API worker gets the first training_started response (200) for 24 h, even after that job ended.
  • POST /v1/training/sessions/{id}/activate keeps the key in the API worker’s memory. A retry on that worker gets the first fully successful activation; on another worker it runs the request again against the durable activation state.

On POST /v1/eval/run and POST /v1/training/sessions/{id}/train:

  • A retry that arrives while the first request is still running gets 409 with detail.reason idempotency_request_in_progress, retryable: true and a Retry-After header. Retry after that many seconds with the same key.
  • If the worker running the first request dies, the key is held until its lease runs out (eval: the run’s deadline plus a margin, about 6.5 minutes by default; train: 2 minutes). The next retry then runs the request once.
  • A failed request is not recorded: its retry runs again.
  • The same key with a different body (eval: a different holdout_fraction) gets 409 “Idempotency-Key is already bound to a different request”, which reveals neither request.
  • A key is bound to one tenant and one resource (the service for eval, the session for train), so two tenants, or two services, can use the same key. To train again after a session's job ended, create a new version with POST /v1/training/sessions/{id}/versions and train that version.
  • A key that appears twice, is empty or is longer than 256 bytes gets 400 with detail.reason invalid_idempotency_key.

Endpoints that don’t recognise the header ignore it, so a retry-aware client can send it everywhere.

Pagination

Most list endpoints take a limit query parameter and nothing else to page with; each has its own default and maximum. Three endpoints page further:

  • GET /v1/mocks is cursor-based. Pass the previous page's next_cursor as cursor; next_cursor is null on the last page. There is no offset.
  • GET /v1/webhooks/{service_id} takes limit + offset and returns the matching total.
  • GET /v1/activities is cursor-based like GET /v1/mocks: limit is 20, 50 or 100 (default 20), and rows come back under items. It sits behind the ACTIVITIES_V2_ENABLED rollout flag (on by default since 2026.11.0) and returns 404 while the flag is off.

There is no shared response envelope. Each list endpoint returns its rows under its own key (mocks, events, proposals, webhooks, ...) — check the per-section table below for the response key.

Rate limits

The control plane applies per-IP sliding-window limits on expensive operations:

  • POST /v1/training/sessions/{id}/train — 3 / minute
  • POST /v1/transition/start — 20 / minute (GOSTLY_TRANSITION_RATE_LIMIT_PER_MIN)
  • POST /v1/eval/run — 6 / minute
  • Global ceiling — 600 / minute / IP across all paths

Exceeding a limit returns 429 with a detail string identifying the bucket. Limits are enforced per process, so multi-replica deployments see per-replica windows; place a shared rate limiter at your reverse proxy if you need a global ceiling across replicas.

Deprecation policy

When a path is renamed, the old path stays live for at least one release cycle. The OpenAPI schema marks deprecated paths with deprecated: true. Active deprecations:

  • The tenant-wide API key → service-account keys (see Service accounts). Data responses the tenant key authenticates carry a Deprecation header (not /mcp or error responses).

Health

Two endpoints with different latency contracts:

MethodPathPurposeTier
GET/healthSynchronous probe of agent + inference + database; ~hundreds of ms when deps are slow.all
GET/v1/health/summaryCached state, refreshed every 5s in the background. Returns immediately even during a dependency outage; each component carries stale_for_seconds.all
GET/metricsPrometheus scrape endpoint on the proxy.all

Dashboards + uptime checkers should hit /v1/health/summary. Reserve /health for when you actually need a fresh probe.

Both health endpoints answer without credentials, so an uptime checker needs no key. The per-component detail on /v1/health/summary is the exception — it carries the raw probe payload, so it is returned only to an authenticated caller. Anonymous responses set detail_redacted: true and leave each detail empty; the status and staleness fields a liveness check reads are unaffected.

Mode control

Modes: LEARN (record), MOCK (serve recorded), PASSTHROUGH (forward, don’t record), TRANSITIONING (read-only during a LEARN → MOCK pipeline; returns 503 + Retry-After).

MethodPathPurposeTier
POST/v1/modeSet global mode. Body: { mode: 'learn' | 'mock' | 'passthrough' }all
GET/v1/modeGet current mode (proxied from agent /health).all

Services

A service is a registered upstream — the API binds traffic to it via either a hostname or a path prefix.

MethodPathPurposeTier
GET/v1/servicesList registered services for the tenant.all
POST/v1/servicesRegister a service. Body: { name, upstream_url, routing_type, routing_value }.all
PUT/v1/services/{id}Update service config (including per-service mode override and the provenance_headers switch, on by default).all
DELETE/v1/services/{id}Remove a service and its recordings, from the library and from what the proxy serves. The response's recordings field reports the outcome: deleted, pending (with a retry URL), failed, or retained (with the reason); DELETE /v1/mocks?service_id= retries it. Recorded versions stay in the database's revision history.all
POST/v1/services/definition:planPreview the changes described by a service definition without applying them.all
POST/v1/services/{service_id}/archiveArchive a service while retaining its recordings and history. Requires service-write access.all
POST/v1/services/{service_id}/restoreRestore an archived service to routing, subject to access, route availability and service limits.all
POST/v1/services/definition:applyApply a service definition using the API contract shipped with the deployment.all
DELETE/v1/services/{id}/capturesRetry best-effort resource and webhook capture cleanup after a service is deleted. Inspect per-store deleted/retained results.all

Archive and restore

Both operations require service-write access. Archiving removes the service from the routing table sent to the agent and retains its recordings and history. Restore the intended service before retrying an action refused with service_archived. Archive can return 409 while a transition or adapter activation is in progress, or while an adapter is bound. Restore can return 409 for a route conflict or 403 when the active-service limit is reached.

Both return the service's archive state; changed: false means it was already in the requested state. State is committed before the routing update is pushed, so a failed response does not establish that the state stayed unchanged. Check the resulting state before repeating an uncertain action. Check agent routing convergence separately from the archive-state change.

Review and apply a service definition

The plan endpoint previews service-definition changes; the apply endpoint changes the registered services. Use the API schema shipped with your deployment for its accepted request fields and permission requirements. Review the planned changes before applying them, then inspect the result and GET /v1/services.

Reuse a synthetic service model

A code model is a reviewable gostly.service-model.v1 JSON document built from a service's eligible recordings and attached declarations. It is separate from an AI response adapter and from a Studio linked-world draft. Use an installation that includes the code-model routes, then keep each handoff explicit:

Building requires member access; compilation requires read access. Definition apply has separate permission requirements. Use the deployment's API schema when issuing a scoped CI credential.

  1. Build with POST /v1/services/{service_id}/code-model. Review the returned model and operator report. The report contains recorded candidate values and stays on the instance; review the model before committing it.
  2. Compile committed models with POST /v1/code-model:compile, providing the model documents and a definition_id. Retain the returned definition, per-service WireMock fixtures and definition/model digest pairs.
  3. Plan and review the definition, then explicitly apply it through the definition endpoints. Respect the deployment's current permission and reviewed-plan requirements.
  4. Import each service's compiled fixtures with POST /v1/mocks/import/wiremock?service_id=… or a supported manifest fixture. Confirm route delivery and serving state, then test a known request.
  5. Retain the digest pairs with the caller-owned test result. A definition's model field is a reference; changing it does not compile or deploy a model. The CI runner does not read code models directly.

Review exported values and metadata before committing them. Synthetic examples can retain source vocabulary and values. Keep the operator report private. See Seeding for imports and Proxy Setup for the separate application and CI handoff.

Mocks library

GET /v1/mocks filters viewer mock content before pagination: a row must have passed through the scrub pipeline or be authored manually, through MCP, or from OpenAPI. The response reports viewer_projection. Service-account keys use this same projection unless they hold mocks:read_unscrubbed, even when they have write. The extra content scope expands rows only on an otherwise-permitted route.

Member-or-higher sessions can read the full mock library. Bulk export has a separate member floor and defaults to processed rows only; exporting unprocessed rows requires admin. An authored row visible in a viewer list is not automatically included in the default scrubbed export. These rules use processing and source; they do not guarantee the absence of sensitive data.

MethodPathPurposeTier
GET/v1/mocksList mock entries, newest first. Filters: method, service_id. Paginated via limit (default 200, at most 1000) + cursor: pass the previous page's next_cursor; next_cursor is null on the last page.all
GET/v1/mocks/exportExport the library as one JSON or YAML document, streamed (chunked, no Content-Length). Defaults to scrubbed_only=true. Needs the member role; scrubbed_only=false needs admin (the service key acts as admin, a user API key as member). An export that cannot finish (a database error, or a reader that leaves one chunk unread for 30 s) ends as an incomplete transfer, never as a complete-looking document.all
GET/v1/mocks/unmatchedRequests that found no match while in MOCK mode (operator surface for filling coverage gaps).all
GET/v1/mocks/coverageCoverage stats per endpoint.all
POST/v1/mocksAdd one entry. Body: { service_upstream_id, request_method, request_uri, request_body, response_status, response_headers, response_body, source }. source is manual (the default) or unmatched_capture when the request comes from an unmatched live request; viewers read unmatched_capture entries only once the scrub pipeline has processed them. For one method and path on a service, the proxy serves the entry added last.all
POST/v1/seed/harCold-start from a HAR capture (browser / proxy traffic export).all
POST/v1/seed/postmanCold-start from a Postman v2 collection.all
POST/v1/seed/openapiCold-start from an OpenAPI 3.x spec.all
DELETE/v1/mocks/{id}Delete one entry. It is removed from the library and from what the proxy serves once the proxy applies the change. Its recorded content, including the last version, stays in the database's revision history until an owner erases the value (Settings > Status, or the admin erase command), which removes it from every store. Erasure does not block a later import: a re-import, a spec refresh or new captures that bring the same value back store it again, so erase again after one.all
DELETE/v1/mocksClear the entire library for the tenant, or with ?service_id= one service's recordings (also after the service is deleted), in the library and in what the proxy serves. Recorded versions of each entry's content, including the last, stay in the database's revision history.all

Traffic + transition

Traffic in LEARN mode flows into a per-service JSONL on the agent’s data volume. The transition pipeline promotes that traffic into the mock library, running PII scrub and pattern extraction along the way.

MethodPathPurposeTier
GET/v1/trafficBrowse recorded traffic for the tenant.all
POST/v1/transition/startEnqueue a LEARN → MOCK pipeline. Accepts Idempotency-Key. Returns 202 + { job_id }. Rate-limited (5/min).all
GET/v1/transition/jobsList recent transition jobs for the tenant (newest first, max 20), including raw state and nullable lifecycle.all
GET/v1/transition/{job_id}/statusRaw job state + progress (0..1), current_stage, records_processed/total and nullable lifecycle.all

Lifecycle on status responses

Transition job reads add lifecycle beside the existing state, progress and error fields. Its four fields are kind (work type), phase (normalized state), terminal (whether that run ended), and reason (normalized terminal outcome). Branch on lifecycle.reason for the classification and keep the endpoint's raw fields for detailed status and diagnostics.

  • idle waits for work to be started; queued waits for execution; running is in progress.
  • awaiting_input needs human action. awaiting_reconciliation represents an unknown external effect that needs reconciliation; it is nonterminal.
  • succeeded, failed and cancelled are terminal for that run. terminal: true means the run ended, not that it succeeded. A resource may support a later run.

A nonterminal lifecycle has reason: null. A failed transition or training session with no usable stored machine-readable reason has reason: unspecified. Selected failure classifications distinguish what to inspect:

  • precondition_failed: required input or a condition was absent or refused. dependency_unavailable: a needed service failed or was unavailable.
  • work_failed: the work reported failure. unverified: the result or evidence could not be accepted as proof.
  • worker_lost: a worker stopped before reporting. resource_exhausted: memory or quota was exhausted.

Illustrative lifecycle object for an operator-ended transition job:

{
  "kind": "transition_job",
  "phase": "failed",
  "terminal": true,
  "reason": "operator_failed"
}

operator_failed records that an operator ended the work. It does not establish that committed effects were rolled back or a provider process was stopped. A failed transition can retain earlier committed batches. Transition list/status reads expose the human diagnostic as error_message, not a top-level failure_reason.

These classifications grant no retry permission. Use the operation's errors, idempotency rules and any Retry-After header to decide whether a request can be retried. A transition with state operation_owned derives its lifecycle from the linked operation receipt; lifecycle can be null if that receipt is unavailable. That missing object is distinct from a present object with a null or unspecified reason. POST /v1/transition/start keeps its { job_id, status } response without this object. The training status route has the separate conditions below; do not assume every job or repair response exposes this envelope.

Drift detection

Drift detection runs schema diffs against your mock library and the live upstream. The dashboard surfaces it at /quality; the API is what powers it.

MethodPathPurposeTier
GET/v1/drift/servicesPer-service drift summary rows (count, max severity, affected endpoints, last_detected_at).all
GET/v1/drift/eventsDrift events. Filters: service_id, unacknowledged_only, limit.all
GET/v1/drift/events/{id}One drift event with the full schema diff.all
POST/v1/drift/events/{id}/acknowledgeMark a drift event acknowledged (optional reason_text).all
GET/v1/drift/freshness-score0-100 freshness score for a service. Reads from the materialized view; falls back to inline compute when older than 5min.all
GET/v1/drift/sparkline30-day per-day major/minor drift counts (for the sparkline cell).all

Statecharts

Statecharts define per-resource lifecycle for the mock engine — given an action on a resource, advance state and serve the appropriate response. Five bundled fixtures ship out of the box (charge, customer, invoice, order, subscription), off by default until a workspace turns them on; tenants can override them or upload custom machines.

MethodPathPurposeTier
GET/v1/statechartsCatalog: id-sorted summary rows merged from bundled fixtures + tenant overrides + custom uploads.all
GET/v1/statecharts/{id}Full graph for one machine — states + transitions.all
GET/v1/statecharts/{id}/resourcesCaptured resources currently in each state of this machine (heat-map overlay).all
PATCH/v1/statecharts/{id}Upsert an override for a bundled fixture, or update an existing custom machine.all
POST/v1/statechartsCreate a fully-custom machine. URL routing wires it up automatically (e.g. id 'shipment' binds POST /shipments).all
DELETE/v1/statecharts/{id}Delete a tenant override (reverts to bundled) or hard-delete a custom machine. Bundled fixtures aren't deletable.all

Removed in 2026.11.0: /sequences/statecharts/*

The older /sequences/statecharts/* and unversioned /statecharts/* paths were removed in 2026.11.0: use the /v1/statecharts paths above.

Webhooks

The inbound capture endpoint records without forwarding to the application. An authenticated member can explicitly replay a stored capture to an allowed target. Scheduled replay, fan-out and re-signing are not available. See the capture and replay contract for body/header transformations, target policy and application-effect checks.

MethodPathPurposeTier
GET/v1/webhooks/{service_id}List captured webhook events for a service. Filters: signature_kind, limit, offset.all
GET/v1/webhooks/{service_id}/{webhook_id}Get one stored capture with retained headers and text body.all
POST/v1/webhooks/{service_id}/{webhook_id}/replayReplay one captured webhook against a target URL. Body: { target_url, preserve_signature, timeout_seconds }.all
DELETE/v1/webhooks/{service_id}/{webhook_id}Delete the database row; a retained source line can be reimported.all

Training

Per-service LoRA fine-tuning. The inference server spawns training as a background subprocess and webhooks progress back.

MethodPathPurposeTier
POST/v1/training/versions/generate-contextCreate a training session draft. Requires Idempotency-Key.all
GET/v1/training/sessionsList training sessions for the tenant.all
GET/v1/training/sessions/{id}Session details + linked mocks + status.all
POST/v1/training/sessions/{id}/versionsCreate a new draft version from this session, with the same service and filters. Accepts Idempotency-Key.all
POST/v1/training/sessions/{id}/trainStart LoRA fine-tuning. Accepts Idempotency-Key. Rate-limited (3/min).all
GET/v1/training/sessions/{id}/statusPoll training progress; a found session includes lifecycle alongside raw status.all
POST/v1/training/sessions/{id}/force-failMark a session that is in training as failed. Needs admin. Does not stop the training process.all
POST/v1/training/sessions/{id}/activateActivate the exact session for its service and inspect serving_ready, reason and action. If the result requires a sidecar restart, follow it and retry activation; restart alone is not serving readiness.all
DELETE/v1/training/sessions/{id}Delete a training session + its adapter files.all
GET/v1/training/sessions/{id}/exportDownload the session's snapshot ZIP (mock_library.jsonl + manifest.json), streamed. Needs admin, because it includes rows the scrub pipeline never processed; scrubbed_only=true keeps only scrubbed rows and needs member.all
POST/v1/training/generate-promptGenerate a fine-tuning prompt preview from recorded patterns.all

On GET /v1/training/sessions/{id}/status, a found session includes the shared lifecycle object. Raw draft maps to idle, training to running, and ready, active and retired all map to succeeded; keep reading status to distinguish those serving states. Lifecycle success alone does not prove adapter activation. A failed session maps to failed, with its classification in lifecycle.reason.

The polling diagnostic is message; this response does not expose raw failure_reason or error_message fields. Training list/detail responses retain error_message and raw failure_reason. For example, raw oom maps to resource_exhausted, while dispatch_unreachable maps to dependency_unavailable.

Progress can be 100 even for a failed session; use status and lifecycle rather than the percentage to determine the outcome. An unknown session returns status: unknown, an empty message and progress 0.0 without lifecycle. That endpoint-specific unknown is not a shared phase or a successful run. Training list/detail lifecycle_state is a separate lineage field. This shared object describes the status route, not every training response.

Deployment audit

This tenant-bound feed contains selected deployment audit metadata. It does not aggregate the legacy auth_audit_events table, the operator GET /v1/activity feed or the hosted Team organization audit log.

Capabilities uses session-or-key authentication to report can_read and can_export; it does not grant access. Events and both export data routes require an admin or owner login session with a user ID and resolved tenant. System/service-account keys and development bypass do not satisfy that guard. Normal product-license admission also applies.

MethodPathPurposeTier
GET/v1/audit/capabilitiesReport read/export permission, retention and page-size bounds.all
GET/v1/audit/eventsRead a cursor-paginated page of retained tenant metadata, newest first. Admin/owner login session.all
POST/v1/audit/exportExport one JSON page of retained tenant metadata. Admin/owner login session.all
GET/v1/audit/export.ndjsonDownload all matching retained metadata, oldest first. Admin/owner login session and ordinary license admission.all

GET /v1/audit/events and POST /v1/audit/export use limit (default 50, maximum 100), cursor, and exact action/resource_id filters. Pages return events and next_cursor. Export adds complete: true means that page has no next cursor, not that every retained record was downloaded.

NDJSON returns one audit record per line for all matching retained rows. It accepts exact action/resource_id filters and inclusive since/until timestamps; naive timestamps mean UTC, until defaults to request time, and since after until returns 422. Server fetch/flush buffers are not whole-export caps. The dashboard collects the download as a browser Blob. A row count or interrupted stream is not proof of complete client delivery or a consistent snapshot.

The existing paginated POST /v1/audit/export can remain available to an authorized admin/owner session under the specific expiry data-out exception. GET /v1/audit/export.ndjson is outside that exception and requires ordinary admission. Invalid or activation-required authority does not gain expiry access, and audit export does not reopen customer traffic.

Coverage includes specified exports/deletes and service-account mock reads whose mocks:read_unscrubbed scope lifts the viewer projection, not every working-view read or every deletion. Required audit failure can return 503 before an audited operation commits. Replay outcome records are best-effort after delivery and do not undo it. See audit retention and maintenance.

Operational

MethodPathPurposeTier
GET/v1/api-keysTenant key (deprecated): current prefix + metadata (never the raw key).all
POST/v1/api-keys/generateTenant key (deprecated): replace it. Raw key returned only in this response.all
DELETE/v1/api-keysTenant key (deprecated): delete it.all
GET/v1/service-accountsService accounts with their keys' metadata, and the scope catalogue. Admin session.all
POST/v1/service-accountsCreate a service account. Admin session.all
POST/v1/service-accounts/{id}/keysIssue a scoped, expiring key. Raw key returned only in this response. Admin session.all
POST/v1/service-accounts/{id}/keys/{key_id}/revokeRevoke one key. Admin session.all
POST/v1/service-accounts/{id}/revokeRevoke the account and every key it holds. Admin session.all
POST/v1/service-accounts/{id}/ownerAssign owner_user_id to an active admin/owner and clear suspension. Admin/owner session.all
POST/v1/service-accounts/{id}/unsuspendRestore a suspended account once its current owner is eligible again. Admin/owner session.all
GET/v1/configRead merged config defaults + tenant overrides.all
PUT/v1/config/{key}Upsert a tenant config override. Push to agent fires automatically.all
GET/v1/scrub/configPer-service PII / credential scrub rules.all
POST/v1/scrub/testDry-run a payload through the scrub pipeline (no persistence).all
GET/v1/activityRecent activity log.all
GET/v1/onboarding/status5-step onboarding checklist state. Drives the dashboard's helper pill.all
GET/v1/insightsAggregated dashboard data (mocks count, drift count, fidelity, eval recents) for the /insights page.all
POST/v1/eval/runTrigger an on-demand Tier-0 eval for a service (~30s). Accepts Idempotency-Key. Rate-limited (6/min).all
GET/v1/eval/runsList recent eval runs.all
GET/v1/wide-eventsWide-event stream (workload class, latency, match type).all
GET/v1/fidelityMock Fidelity Score (F1) per service.all
GET/v1/resources/{service_id}Captured resource index for a service. Used by statechart heat-map overlays.all
GET/v1/repair/proposalsAI mock-repair proposals queue (operator review surface). A viewer session, or a service-account key without mocks:read_unscrubbed, gets only proposals whose target entry it can read in GET /v1/mocks.all
POST/v1/repair/proposals/{id}/approveApprove a repair proposal. The applier patches the mock library + reloads the agent.all
POST/v1/repair/proposals/{id}/rejectReject a repair proposal with an optional reason.all