Skip to content
Delegate

APIREST reference

API

REST reference

On this page

This page renders the OpenAPI document that this deployment serves at /api/v1/openapi.json. The reference below is built from the same contract as that document when the site is built, so it describes the API of the deployment you are looking at. Nothing in it is written by hand.

Reference#

Delegate APIversion 1.0.0 · OpenAPI 3.1.0

Run Delegate missions, follow them to their deliverable and talk to the assistants they build.

Authentication. Send a workspace API token as Authorization: Bearer dlg_…. Tokens are created under Settings → Connections. Cookies are ignored on this API.

Errors. Every non-2xx response is { "error": { "code", "message", "requestId" } }. Branch on code; message is for people.

Idempotency. POST operations accept an Idempotency-Key header. Repeating a request with the same key within 24 hours returns the first response with Idempotent-Replayed: true instead of acting again.

Rate limits. Every response reports the token's request budget in RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds until the window resets).

Compatibility. Within v1, fields and event types may be added; nothing is removed or renamed.

Base URL: /api/v1

  • bearerAuth · Authorization: Bearer <token> · A workspace API token (dlg_…).

Runs

Start missions and follow them to their deliverable.

GET/runs

List runs

The workspace's runs, newest first. Follow nextCursor until it is null to read them all.

Authentication: bearerAuth

Parameters
Parameters of GET /runs
NameInTypeDescription
limitqueryintegerPage size.
cursorquerystringnextCursor of the previous page; omit for the newest runs.
statusquery"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"Only runs in this status.
Responses
200

Success.

application/json · RunList

Response 200 of GET /runs, application/json
NameTypeDescription
datarequiredRunSummary[]
nextCursorrequiredstring | nullPass as cursor for the next page; null at the end.
400

invalid_request: The path, query or body does not match the contract; issues lists why.

application/json · Error

Response 400 of GET /runs, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of GET /runs, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of GET /runs, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of GET /runs, application/json
NameTypeDescription
errorrequiredobject

POST/runs

Start a run

Starts a mission. The run begins planning at once and, unless the workspace approves plans automatically, then waits for its plan to be approved.

  • company-xray (Company X-ray): needs url; optional focus
  • automation-audit (AI Automation Audit): needs url; optional focus, department
  • build-agent (Build-an-Agent): needs url, goal; optional name, opportunityId; takes parentRunId
  • custom-goal (Custom goal): needs goal; optional url
  • repo-xray (Repo X-ray): needs url; optional ref
  • autopilot (Autopilot): needs goal; optional url

Runs count against the workspace's hourly run quota; when it is used up the answer is 429 with Retry-After.

Authentication: bearerAuth

Parameters
Parameters of POST /runs
NameInTypeDescription
Idempotency-KeyheaderstringA unique value for this request, for example a UUID. A retry with the same key and the same request returns the first response.
Request body (required)

application/json · CreateRunRequest

Request body of POST /runs, application/json
NameTypeDescription
missionIdrequired"company-xray" | "automation-audit" | "build-agent" | "custom-goal" | "repo-xray" | "autopilot"
inputrequiredRunInput
parentRunIdstring (uuid)build-agent only: the automation-audit run the opportunity comes from.
Responses
201

Success.

application/json · Run

Response 201 of POST /runs, application/json
NameTypeDescription
idrequiredstring (uuid)
missionrequiredstring
statusrequired"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"
terminalrequiredbooleanTrue once the run completed, failed or was cancelled.
createdAtrequiredstring (date-time)
finishedAtrequiredstring (date-time) | null
totalsrequiredobject
pendingPlanrequiredRunStep[] | nullThe plan waiting for a decision, when status is awaiting_plan_approval.
pendingApprovalsrequiredobject[]Side effects waiting for a human; they are decided in the web app.
stepsrequiredRunStep[]
artifactsrequiredArtifactRef[]
deliverablerequiredArtifact | nullThe final deliverable once the run completed.
summaryrequiredstring | null
errorrequiredobject | null
childrenRunChild[]Autopilot only: the child runs.
autopilotParentobject | null
targetrequiredstring | nullHost, repository or shortened goal the run is about.
executionrequired"live" | "simulated"simulated marks a scripted development run; production runs are always live.
startedAtrequiredstring (date-time) | null
webUrlrequiredstringWhere the run streams live in the web app.
400

invalid_request: The path, query or body does not match the contract; issues lists why.

invalid_json: The request body is not valid JSON.

invalid_url: The target URL is not a public company website or GitHub repository.

invalid_idempotency_key: The Idempotency-Key header is empty, too long or not printable ASCII.

application/json · Error

Response 400 of POST /runs, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of POST /runs, application/json
NameTypeDescription
errorrequiredobject
409

idempotency_in_progress: A request with this Idempotency-Key is still being processed.

application/json · Error

Response 409 of POST /runs, application/json
NameTypeDescription
errorrequiredobject
415

unsupported_media_type: The request body must be application/json.

application/json · Error

Response 415 of POST /runs, application/json
NameTypeDescription
errorrequiredobject
422

idempotency_key_reused: This Idempotency-Key was already used with a different request.

application/json · Error

Response 422 of POST /runs, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of POST /runs, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of POST /runs, application/json
NameTypeDescription
errorrequiredobject

GET/runs/{runId}

Get a run

Status, steps, artifacts, the plan or approvals it is waiting for and, once it completed, the deliverable. An Autopilot run also lists its child runs.

Authentication: bearerAuth

Parameters
Parameters of GET /runs/{runId}
NameInTypeDescription
runIdrequiredpathstring (uuid)
Responses
200

Success.

application/json · Run

Response 200 of GET /runs/{runId}, application/json
NameTypeDescription
idrequiredstring (uuid)
missionrequiredstring
statusrequired"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"
terminalrequiredbooleanTrue once the run completed, failed or was cancelled.
createdAtrequiredstring (date-time)
finishedAtrequiredstring (date-time) | null
totalsrequiredobject
pendingPlanrequiredRunStep[] | nullThe plan waiting for a decision, when status is awaiting_plan_approval.
pendingApprovalsrequiredobject[]Side effects waiting for a human; they are decided in the web app.
stepsrequiredRunStep[]
artifactsrequiredArtifactRef[]
deliverablerequiredArtifact | nullThe final deliverable once the run completed.
summaryrequiredstring | null
errorrequiredobject | null
childrenRunChild[]Autopilot only: the child runs.
autopilotParentobject | null
targetrequiredstring | nullHost, repository or shortened goal the run is about.
executionrequired"live" | "simulated"simulated marks a scripted development run; production runs are always live.
startedAtrequiredstring (date-time) | null
webUrlrequiredstringWhere the run streams live in the web app.
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of GET /runs/{runId}, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of GET /runs/{runId}, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of GET /runs/{runId}, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of GET /runs/{runId}, application/json
NameTypeDescription
errorrequiredobject

POST/runs/{runId}/cancel

Cancel a run

Stops a run that has not finished. The run ends as failed with error code cancelled; an Autopilot run also cancels its open children.

Authentication: bearerAuth

Parameters
Parameters of POST /runs/{runId}/cancel
NameInTypeDescription
runIdrequiredpathstring (uuid)
Idempotency-KeyheaderstringA unique value for this request, for example a UUID. A retry with the same key and the same request returns the first response.
Responses
200

Success.

application/json · Run

Response 200 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
idrequiredstring (uuid)
missionrequiredstring
statusrequired"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"
terminalrequiredbooleanTrue once the run completed, failed or was cancelled.
createdAtrequiredstring (date-time)
finishedAtrequiredstring (date-time) | null
totalsrequiredobject
pendingPlanrequiredRunStep[] | nullThe plan waiting for a decision, when status is awaiting_plan_approval.
pendingApprovalsrequiredobject[]Side effects waiting for a human; they are decided in the web app.
stepsrequiredRunStep[]
artifactsrequiredArtifactRef[]
deliverablerequiredArtifact | nullThe final deliverable once the run completed.
summaryrequiredstring | null
errorrequiredobject | null
childrenRunChild[]Autopilot only: the child runs.
autopilotParentobject | null
targetrequiredstring | nullHost, repository or shortened goal the run is about.
executionrequired"live" | "simulated"simulated marks a scripted development run; production runs are always live.
startedAtrequiredstring (date-time) | null
webUrlrequiredstringWhere the run streams live in the web app.
400

invalid_idempotency_key: The Idempotency-Key header is empty, too long or not printable ASCII.

application/json · Error

Response 400 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject
409

run_finished: The run already reached a terminal state.

idempotency_in_progress: A request with this Idempotency-Key is still being processed.

application/json · Error

Response 409 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject
422

idempotency_key_reused: This Idempotency-Key was already used with a different request.

application/json · Error

Response 422 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of POST /runs/{runId}/cancel, application/json
NameTypeDescription
errorrequiredobject

Events

The append-only log every run view is derived from.

GET/runs/{runId}/events

Read a run's events

JSON by default: pages in sequence order, continued with after. Poll until terminal is true and hasMore is false.

Authentication: bearerAuth

Parameters
Parameters of GET /runs/{runId}/events
NameInTypeDescription
runIdrequiredpathstring (uuid)
afterqueryintegerReturn events with a sequence greater than this.
limitqueryintegerPage size (JSON only).
Responses
200

Success.

application/json · RunEventPage

Response 200 of GET /runs/{runId}/events, application/json
NameTypeDescription
datarequiredRunEvent[]
nextAfterrequiredintegerPass as after for the next page.
hasMorerequiredbooleanMore events were already stored when this page was read.
terminalrequiredbooleanThe run is finished; when hasMore is false too, no event will follow.

text/event-stream · string

204

Event stream only: the run is finished and no event follows the given position.

400

invalid_request: The path, query or body does not match the contract; issues lists why.

application/json · Error

Response 400 of GET /runs/{runId}/events, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of GET /runs/{runId}/events, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of GET /runs/{runId}/events, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of GET /runs/{runId}/events, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of GET /runs/{runId}/events, application/json
NameTypeDescription
errorrequiredobject

Plans

Decide the plan a run proposes before it starts working.

POST/runs/{runId}/plan/approve

Approve the proposed plan

Approves the plan as proposed, so the run starts working. Editing a plan before approving it is done in the web app.

Authentication: bearerAuth

Parameters
Parameters of POST /runs/{runId}/plan/approve
NameInTypeDescription
runIdrequiredpathstring (uuid)
Idempotency-KeyheaderstringA unique value for this request, for example a UUID. A retry with the same key and the same request returns the first response.
Request body

application/json · ApprovePlanRequest

Responses
200

Success.

application/json · PlanDecisionResult

Response 200 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
runIdrequiredstring (uuid)
decisionrequired"approved" | "rejected"
400

invalid_request: The path, query or body does not match the contract; issues lists why.

invalid_json: The request body is not valid JSON.

invalid_idempotency_key: The Idempotency-Key header is empty, too long or not printable ASCII.

application/json · Error

Response 400 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
403

forbidden: The token's user is not allowed to do this.

application/json · Error

Response 403 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
409

run_finished: The run already reached a terminal state.

no_pending_plan: The run has no plan waiting for a decision.

idempotency_in_progress: A request with this Idempotency-Key is still being processed.

application/json · Error

Response 409 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
415

unsupported_media_type: The request body must be application/json.

application/json · Error

Response 415 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
422

idempotency_key_reused: This Idempotency-Key was already used with a different request.

application/json · Error

Response 422 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of POST /runs/{runId}/plan/approve, application/json
NameTypeDescription
errorrequiredobject

POST/runs/{runId}/plan/reject

Reject the proposed plan

Rejects the plan; the run stops as failed with error code plan_rejected.

Authentication: bearerAuth

Parameters
Parameters of POST /runs/{runId}/plan/reject
NameInTypeDescription
runIdrequiredpathstring (uuid)
Idempotency-KeyheaderstringA unique value for this request, for example a UUID. A retry with the same key and the same request returns the first response.
Request body

application/json · RejectPlanRequest

Request body of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
reasonstringShown in the run log.
Responses
200

Success.

application/json · PlanDecisionResult

Response 200 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
runIdrequiredstring (uuid)
decisionrequired"approved" | "rejected"
400

invalid_request: The path, query or body does not match the contract; issues lists why.

invalid_json: The request body is not valid JSON.

invalid_idempotency_key: The Idempotency-Key header is empty, too long or not printable ASCII.

application/json · Error

Response 400 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
403

forbidden: The token's user is not allowed to do this.

application/json · Error

Response 403 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
409

run_finished: The run already reached a terminal state.

no_pending_plan: The run has no plan waiting for a decision.

idempotency_in_progress: A request with this Idempotency-Key is still being processed.

application/json · Error

Response 409 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
415

unsupported_media_type: The request body must be application/json.

application/json · Error

Response 415 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
422

idempotency_key_reused: This Idempotency-Key was already used with a different request.

application/json · Error

Response 422 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of POST /runs/{runId}/plan/reject, application/json
NameTypeDescription
errorrequiredobject

Artifacts

Deliverables, source snapshots and intermediate results.

GET/runs/{runId}/artifacts

List a run's artifacts

References to everything the run has produced so far, without content.

Authentication: bearerAuth

Parameters
Parameters of GET /runs/{runId}/artifacts
NameInTypeDescription
runIdrequiredpathstring (uuid)
Responses
200

Success.

application/json · ArtifactList

Response 200 of GET /runs/{runId}/artifacts, application/json
NameTypeDescription
datarequiredArtifactRef[]
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of GET /runs/{runId}/artifacts, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of GET /runs/{runId}/artifacts, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of GET /runs/{runId}/artifacts, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of GET /runs/{runId}/artifacts, application/json
NameTypeDescription
errorrequiredobject

GET/runs/{runId}/artifacts/{artifactId}

Get an artifact

One artifact with its content, at its latest version.

Authentication: bearerAuth

Parameters
Parameters of GET /runs/{runId}/artifacts/{artifactId}
NameInTypeDescription
runIdrequiredpathstring (uuid)
artifactIdrequiredpathstring
Responses
200

Success.

application/json · Artifact

Response 200 of GET /runs/{runId}/artifacts/{artifactId}, application/json
NameTypeDescription
artifactIdrequiredstring
kindrequiredstring
titlerequiredstring
versionrequiredinteger
contentrequiredanyThe artifact body; its shape depends on kind.
400

invalid_request: The path, query or body does not match the contract; issues lists why.

application/json · Error

Response 400 of GET /runs/{runId}/artifacts/{artifactId}, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of GET /runs/{runId}/artifacts/{artifactId}, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of GET /runs/{runId}/artifacts/{artifactId}, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of GET /runs/{runId}/artifacts/{artifactId}, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of GET /runs/{runId}/artifacts/{artifactId}, application/json
NameTypeDescription
errorrequiredobject

Assistants

Assistants built by build-agent runs.

GET/assistants

List assistants

The assistants this workspace has built, newest first.

Authentication: bearerAuth

Parameters
Parameters of GET /assistants
NameInTypeDescription
limitqueryintegerHow many of the most recent assistants to return.
Responses
200

Success.

application/json · AssistantList

Response 200 of GET /assistants, application/json
NameTypeDescription
datarequiredAssistantSummary[]
400

invalid_request: The path, query or body does not match the contract; issues lists why.

application/json · Error

Response 400 of GET /assistants, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of GET /assistants, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of GET /assistants, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of GET /assistants, application/json
NameTypeDescription
errorrequiredobject

POST/assistants/{assistantId}/chat

Ask an assistant

Answers one question from the assistant's sources, with citations. Nothing is stored between calls: send earlier turns in history. Questions count against the workspace's hourly question quota.

Authentication: bearerAuth

Parameters
Parameters of POST /assistants/{assistantId}/chat
NameInTypeDescription
assistantIdrequiredpathstring (uuid)
Idempotency-KeyheaderstringA unique value for this request, for example a UUID. A retry with the same key and the same request returns the first response.
Request body (required)

application/json · ChatRequest

Request body of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
questionrequiredstring
historyChatTurn[]Earlier turns of this conversation, oldest first.
Responses
200

Success.

application/json · ChatAnswer

Response 200 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
answerrequiredstring
citationsrequiredCitation[]
groundedrequiredbooleanEvery claim in the answer is backed by a cited passage.
refusedrequiredboolean
refusalrequiredobject | nullWhy the assistant declined, when refused is true.
servedByrequiredobject | null
usagerequiredobject
durationMsrequirednumber

text/event-stream · string

400

invalid_request: The path, query or body does not match the contract; issues lists why.

invalid_json: The request body is not valid JSON.

invalid_idempotency_key: The Idempotency-Key header is empty, too long or not printable ASCII.

application/json · Error

Response 400 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
401

unauthorized: The bearer token is missing, malformed, unknown or revoked.

application/json · Error

Response 401 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
404

not_found: Nothing with that id is visible to this token's workspace.

application/json · Error

Response 404 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
409

idempotency_in_progress: A request with this Idempotency-Key is still being processed.

application/json · Error

Response 409 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
413

payload_too_large: The request body is larger than this operation accepts.

application/json · Error

Response 413 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
415

unsupported_media_type: The request body must be application/json.

application/json · Error

Response 415 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
422

idempotency_key_reused: This Idempotency-Key was already used with a different request.

application/json · Error

Response 422 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
429

rate_limited: A request or run quota is used up; Retry-After says when to try again.

application/json · Error

Response 429 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
500

internal: The server failed; quote the requestId when reporting it.

application/json · Error

Response 500 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject
503

unavailable: A dependency (model capacity, the knowledge store) is unavailable right now.

application/json · Error

Response 503 of POST /assistants/{assistantId}/chat, application/json
NameTypeDescription
errorrequiredobject

Meta

This document.

GET/openapi.json

This OpenAPI document

Generated from the same schemas the server validates with. No token needed.

No authentication.

Responses
200

The document.

application/json · Record<string, any>

Schemas

Errorobject

The body of every non-2xx response.

Properties of Error
NameTypeDescription
errorrequiredobject

RunInputobject

Mission input. Which fields a mission takes is listed on POST /runs.

Properties of RunInput
NameTypeDescription
urlstringCompany website, or a public GitHub repository for repo-xray.
goalstringWhat the work should achieve (build-agent, custom-goal, autopilot).
focusstringWhat to look at more closely.
departmentstringLimit an automation audit to one department.
namestringName of the assistant to build.
opportunityIdstringThe audit opportunity a build-agent run implements.
refstringBranch, tag or commit for repo-xray.

CreateRunRequestobject

A mission and its input.

Properties of CreateRunRequest
NameTypeDescription
missionIdrequired"company-xray" | "automation-audit" | "build-agent" | "custom-goal" | "repo-xray" | "autopilot"
inputrequiredRunInput
parentRunIdstring (uuid)build-agent only: the automation-audit run the opportunity comes from.

RunStepobject

Properties of RunStep
NameTypeDescription
idrequiredstring
objectiverequiredstring
statusrequired"pending" | "running" | "succeeded" | "failed"
summarystring

ArtifactRefobject

Properties of ArtifactRef
NameTypeDescription
artifactIdrequiredstring
kindrequiredstring
titlerequiredstring
versionrequiredinteger

Artifactobject

One artifact of a run, with its content.

Properties of Artifact
NameTypeDescription
artifactIdrequiredstring
kindrequiredstring
titlerequiredstring
versionrequiredinteger
contentrequiredanyThe artifact body; its shape depends on kind.

RunChildobject

Properties of RunChild
NameTypeDescription
nodeIdrequiredstring
missionIdrequiredstring
labelrequiredstring
runIdrequiredstring (uuid) | null
statusrequiredstring
summaryrequiredstring | null
deliverablerequiredobject | null
linksrequiredobject[]
needsHumanrequiredstring[]

Runobject

A run: status, steps, artifacts and, once finished, the deliverable.

Properties of Run
NameTypeDescription
idrequiredstring (uuid)
missionrequiredstring
statusrequired"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"
terminalrequiredbooleanTrue once the run completed, failed or was cancelled.
createdAtrequiredstring (date-time)
finishedAtrequiredstring (date-time) | null
totalsrequiredobject
pendingPlanrequiredRunStep[] | nullThe plan waiting for a decision, when status is awaiting_plan_approval.
pendingApprovalsrequiredobject[]Side effects waiting for a human; they are decided in the web app.
stepsrequiredRunStep[]
artifactsrequiredArtifactRef[]
deliverablerequiredArtifact | nullThe final deliverable once the run completed.
summaryrequiredstring | null
errorrequiredobject | null
childrenRunChild[]Autopilot only: the child runs.
autopilotParentobject | null
targetrequiredstring | nullHost, repository or shortened goal the run is about.
executionrequired"live" | "simulated"simulated marks a scripted development run; production runs are always live.
startedAtrequiredstring (date-time) | null
webUrlrequiredstringWhere the run streams live in the web app.

RunSummaryobject

A run as it appears in a list.

Properties of RunSummary
NameTypeDescription
idrequiredstring (uuid)
missionrequiredstring
targetrequiredstring | null
statusrequired"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"
executionrequired"live" | "simulated"simulated marks a scripted development run; production runs are always live.
createdAtrequiredstring (date-time)
startedAtrequiredstring (date-time) | null
finishedAtrequiredstring (date-time) | null
webUrlrequiredstring

RunListobject

One page of runs, newest first.

Properties of RunList
NameTypeDescription
datarequiredRunSummary[]
nextCursorrequiredstring | nullPass as cursor for the next page; null at the end.

RunEventobject

One entry of a run's append-only event log.

Properties of RunEvent
NameTypeDescription
runIdrequiredstring (uuid)
seqrequiredintegerPosition in the run's log, starting at 1.
atrequiredstring (date-time)
typerequiredstringOne of: run.created, plan.proposed, plan.approved, plan.revised, step.started, agent.spawned, agent.message, tool.called, tool.result, policy.decided, artifact.created, artifact.updated, critic.flagged, approval.requested, approval.resolved, usage.updated, step.completed, run.completed, run.failed, model.fallback, connector.call, sandbox.command, ship.approval.requested, ship.approval.decided, pr.opened, playbook.applied, child.started, child.completed. New types may be added.
stepIdstring
agentIdstring
payloadrequiredRecord<string, any>

RunEventPageobject

One page of a run's events, in order.

Properties of RunEventPage
NameTypeDescription
datarequiredRunEvent[]
nextAfterrequiredintegerPass as after for the next page.
hasMorerequiredbooleanMore events were already stored when this page was read.
terminalrequiredbooleanThe run is finished; when hasMore is false too, no event will follow.

ApprovePlanRequestobject

No fields.

RejectPlanRequestobject

Why the plan is rejected.

Properties of RejectPlanRequest
NameTypeDescription
reasonstringShown in the run log.

PlanDecisionResultobject

The recorded plan decision.

Properties of PlanDecisionResult
NameTypeDescription
runIdrequiredstring (uuid)
decisionrequired"approved" | "rejected"

ArtifactListobject

The artifacts a run has produced so far.

Properties of ArtifactList
NameTypeDescription
datarequiredArtifactRef[]

AssistantSummaryobject

An assistant built by a build-agent run.

Properties of AssistantSummary
NameTypeDescription
idrequiredstring (uuid)
namerequiredstring
urlrequiredstringThe website the assistant was trained on.
statusrequired"draft" | "ready"
passRaterequirednumber | nullShare of its own evals it passes.
pagesrequiredinteger
runIdrequiredstring (uuid)The build-agent run that produced it.
createdAtrequiredstring (date-time)
webUrlrequiredstring

AssistantListobject

The workspace's assistants, newest first.

Properties of AssistantList
NameTypeDescription
datarequiredAssistantSummary[]

ChatTurnobject

Properties of ChatTurn
NameTypeDescription
rolerequired"user" | "assistant"
contentrequiredstring

ChatRequestobject

A question for an assistant.

Properties of ChatRequest
NameTypeDescription
questionrequiredstring
historyChatTurn[]Earlier turns of this conversation, oldest first.

Citationobject

Properties of Citation
NameTypeDescription
indexrequiredintegerThe [n] marker in the answer.
chunkIdrequiredstring
urlrequiredstring
titlestring
quotestring

ChatAnswerobject

An assistant's cited answer.

Properties of ChatAnswer
NameTypeDescription
answerrequiredstring
citationsrequiredCitation[]
groundedrequiredbooleanEvery claim in the answer is backed by a cited passage.
refusedrequiredboolean
refusalrequiredobject | nullWhy the assistant declined, when refused is true.
servedByrequiredobject | null
usagerequiredobject
durationMsrequirednumber

WebhookRunobject

The run a delivery is about, as it was when the event happened.

Properties of WebhookRun
NameTypeDescription
idrequiredstring (uuid)
missionrequiredstring
targetrequiredstring | null
statusrequired"planning" | "awaiting_plan_approval" | "running" | "awaiting_approval" | "completed" | "failed"
createdAtrequiredstring (date-time)
startedAtrequiredstring (date-time) | null
finishedAtrequiredstring (date-time) | null
summaryrequiredstring | null
errorrequiredobject | null
totalsrequiredobject
urlrequiredstringThe run in the web app.

WebhookApprovalobject

The decision a run is waiting for.

Properties of WebhookApproval
NameTypeDescription
idrequiredstring
kindrequired"plan" | "tool" | "ship"plan can be decided through the API; tool and ship are decided in the web app.
summaryrequiredstring
urlrequiredstringWhere a person decides it.

RunCompletedWebhookobject

A run finished and its deliverable is ready.

Properties of RunCompletedWebhook
NameTypeDescription
idrequiredstring (uuid)Unique per endpoint and event; the same on every retry.
createdrequiredstring (date-time)When the event happened.
apiVersionrequired"v1"
typerequired"run.completed"
datarequiredobject

RunFailedWebhookobject

A run stopped with an error.

Properties of RunFailedWebhook
NameTypeDescription
idrequiredstring (uuid)Unique per endpoint and event; the same on every retry.
createdrequiredstring (date-time)When the event happened.
apiVersionrequired"v1"
typerequired"run.failed"
datarequiredobject

RunCancelledWebhookobject

A run was cancelled by a user or through the API.

Properties of RunCancelledWebhook
NameTypeDescription
idrequiredstring (uuid)Unique per endpoint and event; the same on every retry.
createdrequiredstring (date-time)When the event happened.
apiVersionrequired"v1"
typerequired"run.cancelled"
datarequiredobject

ApprovalRequestedWebhookobject

A run is waiting for a human decision: a plan, a connector tool call or a pull request.

Properties of ApprovalRequestedWebhook
NameTypeDescription
idrequiredstring (uuid)Unique per endpoint and event; the same on every retry.
createdrequiredstring (date-time)When the event happened.
apiVersionrequired"v1"
typerequired"approval.requested"
datarequiredobject

TestWebhookobject

Sent from the settings page to check an endpoint.

Properties of TestWebhook
NameTypeDescription
idrequiredstring (uuid)Unique per endpoint and event; the same on every retry.
createdrequiredstring (date-time)When the event happened.
apiVersionrequired"v1"
typerequired"webhook.test"
datarequiredobject

Authentication#

API requests use the same workspace tokens as the MCP endpoint, sent as a bearer token:

Text
Authorization: Bearer <your-delegate-token>

Create and revoke tokens under Settings, Connections, as described in connect Claude Code, Codex, Cursor and VS Code. A request made with a token runs with the same tenant isolation, quotas, policies and approvals as a request from the browser. A token cannot change workspace settings.

If you are driving Delegate from an agent#

The MCP endpoint exposes missions and runs as tools, with a long-poll for progress, and is usually the shorter path for a coding agent.