API
The Watcher HTTP API gives you programmatic access to your deployment's recorded data and grading. You can query sessions, trajectories, and grades. You can ingest trajectories from your own tooling. For resumable Claude Code, Codex and Copilot source uploads, see Incremental ingest. You can integrate gateways through gateway hooks. You can run graders on demand, or request a Deep Review of a session (how). You can read or update organization settings. Set custom instructions for managed monitors through the monitor customization API. Some Analyzer administration is not on the API. API-key and member management are handled by the sign-in provider's own components. The Python SDK is a typed binding over this same API. Anything the SDK does, you can also do with plain HTTP requests. On proxy-mode deployments, the SDK authenticates through a pre-configured HTTP client (see Proxy-mode deployments).
Custom integrations can also upload Claude Code and Codex child sessions
and link them to a parent with PUT /v1/sessions/{child_session_id}/agent-relationship.
Base URL and versioning
The API is served by your Watcher deployment under the /api path, with
endpoints versioned under /v1:
https://<your-watcher-host>/api/v1/...
For a self-hosted deployment, that is the same hostname as your Analyzer. On
Apollo's hosted cloud, the base is https://app.apolloresearch.ai/api.
Authentication
How you authenticate depends on your deployment's authentication mode:
- SSO mode (Apollo cloud, and self-hosted in SSO mode): send an organization
API key in the
x-api-keyheader. Users with API-key management access create and revoke keys on the Analyzer's Organization page. The API also accepts the short-livedAuthorization: Bearertoken from a user's sign-in. Use an API key for unattended services. Local Python integrations can sign in through the browser without a Watcher client or reuse the installed Watcher sign-in, including token refresh. - Proxy mode (self-hosted behind your own auth proxy): there are no Watcher API keys. Requests authenticate with whatever your reverse proxy requires. This is exactly like every other request to the deployment.
curl -H "x-api-key: $WATCHER_API_KEY" \
https://watcher.example.com/api/v1/sessions
See Authentication and permissions to choose grants for your credential and check endpoint requirements, role defaults, and ownership rules.
Session access
The permission reference covers ownership, organization policy, and endpoint requirements:
Session findings access
Browse sessions, grades, and tool-call decisions.
GET /v1/sessions/{session_id}/tool-call?tool_use_id=... reads an individual call,
including calls with no recorded decision. Findings access permits decision;
content access to that call permits arguments and result. The can_read_findings and
can_read_content flags distinguish restricted fields from missing data. The
response excludes surrounding messages and grader inputs. Nested calls never
inherit a parent program's arguments or result. Missing, inaccessible, and scrubbed
resources all return HTTP 404 with Session not found.
The Python SDK exposes this as get_session_tool_call(session_id, tool_use_id).
Flagged tool-call content access
tool-calls:content:read:flagged grants access to a
flagged tool call's exact arguments and recorded result.
It also permits that call's input preview in tool-call search results. It does
not grant browsing or findings access, or access to routine calls, session
summaries, surrounding messages, full transcripts, or grader inputs.
The tool-call detail response includes is_flagged, which is null without
findings access. A successful read through the flagged-call grant still reveals
that the known call qualifies. Tool-call search rows always include a boolean
is_flagged.
The classification uses the judgment and policy recorded for the call, not
current thresholds or the session's review score. Grading judgments, command
rules, and tool thresholds that block a call or require approval qualify,
including always-ask settings, observe-mode decisions, and later approvals.
An always-ask setting therefore makes each matching call's content eligible for
this grant. Calls without recorded decision provenance do not qualify, nor do
grading-failure fallbacks (including connection failures and timeouts) or
interruptions during grading.
Use filters.is_flagged in POST /v1/tool-calls/search to filter before
pagination; result counts reflect the filtered set. It combines with
filters.decision_categories using AND: calls must match both filters when both
are set.
With filters.session_id, use filters.trajectory_id to include only calls on
that trajectory and its ancestors, or latest for the trajectory the session
opens by default. When the Watcher client and a gateway both recorded a
conversation, either recording's ID scopes to the reconciled transcript and
includes the calls both recorded. The
scope also includes calls Watcher evaluated that a gateway withheld or cancelled
in favor of one of its messages; their message_ref names the branch that
proposed them.
Missing or scrubbed trajectories return no calls. Omitting this filter keeps
the session-wide scope.
The organization content restriction does not suppress this grant. The shipped admin and org-viewer roles include it. API keys need an explicit grant, and self-hosted custom roles need it in their role configuration. A findings grant alone does not include it. Slack alerts use their own disclosure setting.
Session content access
Read transcripts or request temporary access.
Use transcript_state to distinguish missing, recorded and scrubbed
transcripts.
The older is_content_scrubbed field and session detail's content_state remain
for compatibility. content_state: "available" includes sessions with no
recorded transcript, so it does not establish that messages exist.
Session aggregate access
Grading sessions
Grading permissions and Python examples.
Browsing the API
The API is described by an OpenAPI 3.1 document, openapi.json. The document is
maintained and versioned with the SDK. The spec is not currently published as a
standalone download.
The installed Python SDK is a complete, typed map of the same
surface. Every endpoint appears as a module under
watcher_sdk/_generated/api/<tag>/, where the folder name uses underscores in
place of the tag's hyphens. Each client method wraps one endpoint.
Endpoints are grouped by tag: sessions, ingest, grade, monitors,
graders, hooks, organization, users, usage, tool-calls,
tool-call-decisions, session-content-access-requests, auth, health,
version.
Calling the API directly, note two things:
- Endpoint paths are relative to the
/apiserver prefix:/v1/sessionsishttps://<your-watcher-host>/api/v1/sessionson the wire. - The two security schemes (
ApiKeyAuth,BearerAuth) are the SSO-mode headers described above; in proxy mode your proxy's requirements apply instead.
Ingest request size
Set WATCHER_MAX_UPLOAD_BYTES in the self-hosted Compose .env, or
api.maxUploadBytes in Helm, to apply one byte limit to ingest, trajectory
append, and gateway hook requests.
The API container reads this as XYLON_MAX_UPLOAD_BYTES. The limit includes the
JSON envelope. A positive value enables it; 0 disables these application limits.
Leave the setting blank in Compose or null in Helm to keep the existing
defaults: ingest and trajectory append have no application limit, and gateway
hooks have a 64 MiB limit. The deprecated WATCHER_HOOKS_MAX_REQUEST_BYTES
(api.hooksMaxRequestBytes in Helm) still overrides that hook-only default.
The shared setting takes precedence, including an explicit 0.
Requests above the limit receive HTTP 413 before parsing or storage. Ingest and
trajectory append responses include detail.code=payload_too_large and the
limit in detail.max_bytes; hook responses retain their text detail.
Reverse proxies can impose their own limits. The packaged nginx gateway has
an independent 72 MiB limit, even when application limits are disabled.
Choose a limit above 8 MiB. The Watcher client limits Claude Code and Codex
requests to 8 MiB, including the JSON envelope. For Copilot, it targets 8 MiB
but sends a larger event or dependent sequence whole after capping tool outputs.
Tool arguments are not capped. Callers using the Python
SDK's ingest method choose their own chunks; see Incremental ingest.
A request over the limit fails the same way every time, so retrying it does not
help, and the SDK does not retry a 413.
The Python SDK
The Python SDK wraps this API with typed sync and async
clients: each of its methods calls one endpoint, and it adds retries with
backoff, auto-pagination, structured errors, and typed models on top. Its
base_url is the base URL above, /api prefix included. If you are working in
Python, start there; use the HTTP API directly from other languages or where a
dependency is unwanted. This client library is one part of the
Watcher SDK, which also includes sign-in commands and
integration examples.