Endpoint
Authentication
This endpoint requires an OAuth access token. Send it as a bearer token:agent:write
The agent runs as the access token’s user. It inherits exactly that user’s access to workflows,
tasks, and documents, and cannot see more than they can.
Query Parameters
Request Body
Request Example
Response
Success Response (stream=false)
Status Code: 200 OK
Response Fields
Pending Approval Object
Streaming Response (default)
Withstream=true (the default), the response is text/event-stream. Each frame has the form:
session_id event first, then one or more value events carrying the
agent’s output, then end. Every data object carries its own event_type. Abridged example:
Conversation Lifecycle
1
Ask
Call this endpoint with your
prompt. Keep the returned session_id.2
Continue
Send follow-up messages to
POST /v2/agent/conversations/{session_id}/messages. The agent keeps the earlier context.3
Answer approvals
If a run comes back with
status: "parked", it is waiting for a person to allow or refuse a tool. Answer it with POST /v2/agent/conversations/{session_id}/approvals - there is no other way to resume the run.Error Responses
400 Bad Request
Returned when the access token has no user behind it.client_credentials tokens act as the admin who created the application, so this applies only to
tokens issued before application creators were recorded.
401 Unauthorized
Returned when the access token is missing, unknown, revoked, or expired, or when anX-API-Key was
sent instead of a bearer token. See OAuth error responses.
403 Forbidden
Returned when the token does not carry the required scope.422 Validation Error
Returned when the request body is invalid, for example an emptyprompt.
429 Too Many Requests
Returned when your organization exceeds its per-minute request limit.500 Internal Server Error
Returned when the agent run could not be started or failed before producing an answer. Withstream=false, a run that fails partway returns this error and any partial answer is discarded.
Notes
Agent runs routinely take a minute or more. Set a generous client timeout. The connection cannot be
rejoined once it closes: if your client disconnects or times out, the answer is lost even though the
run may continue on the server.