Tasks
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
POST | |
GET | |
POST | |
GET | |
POST | |
GET | |
POST | |
GET | |
POST | |
DELETE | |
POST | |
GET | |
POST |
Retrieve tasks runs stream token
Generate a run-scoped JWT that authorizes reading this task run's live event stream via the agent-proxy. A run that keeps only a short live tail in Redis is routed to the proxy only when the client sets resync=true, meaning it rebuilds from the durable run log when the proxy reports a trimmed cursor.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
Query parameters
- resyncbooleanDefault:
false
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:id /stream_tokenExample response
Status 200 Run-scoped token for reading the live event stream via the agent-proxy
Status 404 Task run not found
Retrieve tasks runs stream token
Generate a run-scoped JWT that authorizes reading this task run's live event stream via the agent-proxy. A run that keeps only a short live tail in Redis is routed to the proxy only when the client sets resync=true, meaning it rebuilds from the durable run log when the proxy reports a trimmed cursor.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
Query parameters
- resyncbooleanDefault:
false
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:id /stream_tokenExample response
Status 200 Run-scoped token for reading the live event stream via the agent-proxy
Status 404 Task run not found
Create tasks runs subscription token
Give the run's agent-server a short-lived ChatGPT access token from the run owner's connected account. Only the run's sandbox may call this, and it must present the run token it received at launch. Send the digest of a token Codex rejected so the server refreshes it early, once.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Request parameters
- rejected_access_token_sha256string | null
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:id /subscription_tokenExample response
Status 200 Short-lived ChatGPT access token for this run
Status 400 Missing required header
Status 403 Caller is not this run's sandbox, or the run token is invalid
Status 404 Task run not found
Status 409 reauth_required: the run owner must reconnect their ChatGPT account
Status 502 openai_unavailable: OpenAI did not answer the token refresh
Create tasks runs subscription token
Give the run's agent-server a short-lived ChatGPT access token from the run owner's connected account. Only the run's sandbox may call this, and it must present the run token it received at launch. Send the digest of a token Codex rejected so the server refreshes it early, once.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Request parameters
- rejected_access_token_sha256string | null
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:id /subscription_tokenExample response
Status 200 Short-lived ChatGPT access token for this run
Status 400 Missing required header
Status 403 Caller is not this run's sandbox, or the run token is invalid
Status 404 Task run not found
Status 409 reauth_required: the run owner must reconnect their ChatGPT account
Status 502 openai_unavailable: OpenAI did not answer the token refresh
Retrieve tasks runs task session
API for managing task runs. Each run represents an execution of a task.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:id /task_sessionExample response
Status 200
Status 404 Task session not found
Retrieve tasks runs task session
API for managing task runs. Each run represents an execution of a task.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:id /task_sessionExample response
Status 200
Status 404 Task session not found
Create tasks runs task session sync
API for managing task runs. Each run represents an execution of a task.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Response
Example request
Example response
Status 200
Status 400 Missing required header
Status 403 Invalid task run token
Status 404 Task session not found
Status 409
Create tasks runs task session sync
API for managing task runs. Each run represents an execution of a task.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Response
Example request
Example response
Status 200
Status 400 Missing required header
Status 403 Invalid task run token
Status 404 Task session not found
Status 409
List all tasks runs living artifacts
Returns stable, versioned artifact handles created by the run's task.
Required API key scopes
task:readPath parameters
- run_idstring
- task_idstring
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:run_id /living_artifactsExample response
Status 200 Living artifacts registered for this task run
Status 404 Run not found
Create tasks runs living artifacts
Create a stable, editable artifact handle from direct markdown/text content or an existing run artifact. Slack adapters deliver into the mapped Slack thread; document artifacts use external connector storage when available.
Required API key scopes
task:writePath parameters
- run_idstring
- task_idstring
Request parameters
- namestring
- artifact_typeDefault:
document - adapter
- contentstring
- content_base64string
- content_typestring
- source_artifact_idstring
- source_storage_pathstring
- metadataobject
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:run_id /living_artifactsExample response
Status 200 Created living artifact
Status 400 Invalid artifact payload
Status 404 Run not found
Retrieve tasks runs living artifacts
Return a stable living artifact handle and the current content when the adapter supports reads.
Required API key scopes
task:readPath parameters
- idstring
- run_idstring
- task_idstring
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:run_id /living_artifacts /:idExample response
Status 200 Living artifact with current readable content
Status 404 Living artifact not found
Create tasks runs living artifacts
Commit a new version to an existing living artifact handle.
Required API key scopes
task:writePath parameters
- idstring
- run_idstring
- task_idstring
Request parameters
- namestring
- contentstring
- content_base64string
- content_typestring
- source_artifact_idstring
- source_storage_pathstring
- metadataobject
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:run_id /living_artifacts /:id /editExample response
Status 200 Updated living artifact
Status 400 Invalid artifact update
Status 404 Living artifact not found
Retrieve tasks runs living artifacts version
Returns the content of one living artifact version. Slack file versions return their stored file, streamed from the app origin for a preview or redirected to a presigned URL with download=true. Slack canvas and message versions return their text.
Required API key scopes
task:readPath parameters
- idstring
- run_idstring
- task_idstring
- versioninteger
Query parameters
- downloadboolean
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:run_id /living_artifacts /:id /versions /:versionExample response
Status 200 Version content, with the content type the version was saved with
Status 302 With download=true, a redirect to a presigned URL for the stored file
Status 400 Unable to read the version
Status 404 Living artifact or version not found, or the version keeps no content
Status 413 The stored file is too large to preview. Request it with download=true.
Create tasks runs living artifacts
Renders a PostHog insight (ad-hoc query JSON or a saved insight) to a PNG server-side and registers it as a slack_file living artifact in one call. Blocks until the render finishes.
Required API key scopes
task:writequery:readPath parameters
- run_idstring
- task_idstring
Request parameters
- namestring
- queryobject
- insight_idinteger
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:run_id /living_artifacts /chartExample response
Status 200 Chart rendered and registered as a living artifact
Status 400 Render or delivery failed
Status 403 Caller may not run queries in this project
Status 404 Run not found
List all tasks thread messages
The task's thread in chronological order.
Required API key scopes
task:readPath parameters
- task_idstring
Query parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /thread_messagesExample response
Status 200 Thread messages
Create tasks thread messages
API for a task's thread — the human-only side conversation around a task. Messages reach the agent only via the explicit send_to_agent action, gated to the task author.
Required API key scopes
task:writePath parameters
- task_idstring
Request parameters
- contentstring
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /thread_messagesExample response
Status 201
Delete tasks thread messages
API for a task's thread — the human-only side conversation around a task. Messages reach the agent only via the explicit send_to_agent action, gated to the task author.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Example request
DELETE /api /projects /:project_id /tasks /:task_id /thread_messages /:idExample response
Status 204 No response body
Create tasks thread messages send to agent
Task author only: forwards the message into the task's latest live run.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Request parameters
- idstring
- taskstring
- author_kindstring
- eventstring
- payloadobject
- contentstring
- created_atstring
- author
- forwarded_to_agent_atstring | null
- forwarded_by
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /thread_messages /:id /send_to_agentExample response
Status 200
Status 400 No signalable run, or message already forwarded
Status 429 Organization reached its PostHog Desktop usage limit
List all tasks me config
Retrieve your per-project default AI run preferences, plus the resolved defaults a new run will use when no explicit runtime selection is sent (your preference over the project default).
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /@me /configExample response
Status 200
Create tasks me config
Set your per-project default AI run preferences; they override the project default wholesale. Send all fields as null to clear and inherit the project default.
Required API key scopes
task:writeRequest parameters
- runtime
- runtime_adapter
- modelstring | null
- reasoning_effort
Response
Example request
POST /api /projects /:project_id /tasks /@me /config