Skip to main content
The HTTP API is the direct integration surface for applications that manage their own credentials, persistence, and review workflow. Its origin is https://api.antigen.sh. Authenticate every request with an organization API key in x-api-key. Keys begin with atg_sk_. Send the key only in that header: never in a URL, a browser history, a source file, or a log. Use content-type: application/json for Run creation and guidance. A local caller deadline bounds only that caller. It does not create, stop, resume, or cancel a Run.

Conventions

Every response carries contractVersion, currently "v1". Successful reads return the resource directly; errors return an error object described under Errors. Each endpoint requires a scope on the credential. See Authentication for how credentials are issued and how authorization errors are resolved. Endpoints that accept no query parameters reject any query string with 404. This is deliberate: an unrecognized filter silently ignored is worse than a rejected request.

Discovery and creation

List approved targets

GET /v1/targets Lists targets approved for the caller’s organization.
Select a target from this response for POST /v1/runs. If creation returns TARGET_NOT_APPROVED, re-read this endpoint rather than editing the rejected target.

Create a Run

POST /v1/runs Creates one authorized Run for a coherent assessment objective.
Persist id immediately with the assessment record. If the response is ambiguous, read that saved ID with GET /v1/runs/{runId} before considering another creation request. A second POST /v1/runs is a new assessment record, not a retry.

List and read Runs

List Runs

GET /v1/runs Reads an organization-visible page of Runs.
nextCursor is present only when another page exists. Pass it back unchanged. Do not derive authorization, identity, or ordering from a cursor or a Run ID.

Read a Run

GET /v1/runs/{runId} Reads one known Run by its saved opaque ID.
The response fields depend on how far the Run has progressed. startedAt appears once it is running, stoppedAt when it is stopped, and completedAt on a terminal status. A failed Run also carries failure with a code of EXECUTION_UNAVAILABLE or RUN_EXECUTION_FAILED and a message.
RUN_NOT_FOUND and FORBIDDEN both reject: the ID alone does not grant access. Read this endpoint after any ambiguous create or lifecycle request, then resume observation with GET /v1/runs/{runId}/events after your last handled checkpoint.

Events and findings

Stream Run events

GET /v1/runs/{runId}/events Opens an ordered server-sent event stream for a Run. The response uses content-type: text/event-stream and stays open until the Run reaches a terminal state or the caller disconnects. Resume with either a numeric after query parameter or an opaque Last-Event-ID header. They are alternatives: never send both.
Each frame carries the opaque event ID, the event type, and a JSON envelope:
Persist sequence only after handling that event, and resume with after=<sequence>. When you store the opaque id instead, send it as Last-Event-ID and omit after; the two cursors are not interchangeable. An invalid cursor is rejected with INVALID_REQUEST.

Read Run findings

GET /v1/runs/{runId}/findings Reads durable findings and remediation guidance for one Run.
severity is one of critical, high, medium, low, or info. proof, endpoint, and cwe appear only when available. An empty findings array is a valid outcome for a completed Run, not an integration failure.

Guidance and lifecycle

Send guidance

POST /v1/runs/{runId}/messages Delivers scoped guidance to an existing Run. The JSON body requires a content string; keep the guidance within the Run’s approved target and Guardrails.
For an ambiguous response, read the Run before sending another message. Work outside the approved scope needs its own authorized assessment.

Lifecycle actions

stop, resume, and cancel all return the Run in its requested new state. stop and resume parse a JSON body and reject a malformed one with INVALID_REQUEST, so send {} and content-type: application/json. cancel reads no body at all. DELETE /v1/runs/{runId} is an exact alias for cancel, for clients that prefer the verb.
INVALID_RUN_STATE means the action does not apply to the Run’s observed status, usually because another transition already occurred. Read the Run and choose a valid action rather than repeating the request. Resuming does not re-evaluate target approval, so confirm the scope still applies first. A local connection failure does not prove the action was rejected.

Errors

Error responses carry contractVersion and an error object with a stable code, a message, and an optional requestId.
Retain requestId with the saved Run ID whenever one is present. It lets support identify the failing request without exposing credentials. After an ambiguous create, lifecycle, or observation request, do not infer the remote result from a local failure. Preserve the Run ID and your event checkpoint, read the Run, resume events after that checkpoint, and read findings for durable remediation work. Related concepts: Get started, TypeScript SDK, Guides, and Reliability and security.