Start an agent run
Authorizations
Headers
Safe blind retries: resubmitting the same key returns the ORIGINAL run's envelope (202 while it is running, the full status once it finished), with no second chat and no second billed run. A key first used for a different request is 409 idempotency_conflict; a start refused because the chat is busy (409 agent_run_rejected) does not use up its key for a retry in the same chat. Uploaded files are staged again on every call, so retry a request with files under a new key. Run keys are scoped to your account. Both API versions retain keys for 24 hours after acceptance and while the run remains active. UTC midnight does not reset the window. Once the window ends and the run finishes, reuse can start another billed run. Use a new key for new work. 1-128 chars of A-Z a-z 0-9 _ . : -; invalid values are 400 invalid_idempotency_key.
^[A-Za-z0-9_.:-]{1,128}$Body
Optional title for a standalone new chat, 1-64 characters after trimming, without control characters. On MCP, pass chat: new without session. Shared default/session chats keep routing names. Developer session names are reserved; choose a different title. Existing chats keep their names.
1 - 64^(?![\s\S]*[\u0000-\u001f\u007f-\u009f])Hold the connection until the run ends or the sync window closes: about 90 s, counted from when the request arrives (upload time included). A run that ends inside the window returns 200 with its final status; failed and cancelled runs also return 200, so check status. Otherwise the normal 202 envelope; finish by polling. Keyed replays answer at once. Set the HTTP client timeout to 120 s: a dropped connection or 504 does not stop the run.
Response
The run's final status: a sync-mode run ({ sync: true }) that ended inside the sync window (about 90 s from when the request arrived, upload time included), or a keyed replay of a run that already ended. Failed and cancelled runs also return 200; check status.
Optional saved-file delivery, enabled per account. Text previews contain at most 16,000 characters per file and 48,000 total. Files over 1 MiB and binary files use download_url. Preview/unavailable entries name the retrieval fix; partial marks outputs of failed or cancelled runs.

