Finish Autopilot Run
PATCH/api/support/agent/tickets/:ticket/ai/runs/:run
Records how an AI agent session ended. A run is finished exactly once: finishing a run that is no longer pending, or a run that is not an autopilot run on this ticket, is a 422 on run. Unlike starting a run, finishing does not require the AI agent to still own the ticket — a session that was running when a human took the ticket over is still recorded.
support:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Path parameters
ticket(integer) — the ticket id.run(integer) — the autopilot run id.
Request body
status(string, required) — done, failed or skippedoutcome(string, optional, nullable, max 40) — the agent's short code for how the session endedcost_usd(number, optional, nullable, 0–999999) — what the session costfinished_at(ISO-8601 timestamp, optional, nullable) — defaults to nowoutput(object, optional, nullable) — the result summary, stored as given
The response is the finished run. Each run has id, kind (always autopilot), status (pending while the session runs; done, failed or skipped once finished), model, output (the result summary object, or null), run_number (the per-ticket run count), started_at, finished_at, cost_usd (number, or null), outcome (the runner's short code for how the session ended, e.g. awaiting_reply_approval, session_error) and created_at. accepted and decisions are always null on autopilot runs.
Authentication: Bearer token with the support:write scope belonging to the AI agent's own account — any other caller, including support admins, gets a 403. No tenant context — this endpoint is central.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden
Response Headers
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.