Tasks
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
GET | |
GET | |
GET | |
POST | |
GET | |
POST | |
GET | |
POST | |
POST | |
GET | |
POST | |
DELETE | |
POST | |
GET | |
GET | |
GET |
Create tasks runs start
Start an existing cloud run after any initial run-scoped attachments have been uploaded.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Request parameters
- pending_user_messagestring
- pending_user_artifact_idsarray
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:id /startExample response
Status 200 Task with updated latest run
Status 400 Invalid start payload
Status 403 PostHog Desktop access is required, or Pi cloud runtime is disabled
Status 404 Task run not found
Status 429 Team is over its posthog_code usage limit
Retrieve tasks runs stream
Server-Sent Events stream of task run events. Events carry an id: line (a Redis stream id) usable as a resume cursor.
The server caps each connection at 900 seconds: it emits event: end with data: {"type": "rotated"} and closes. This does NOT mean the run finished — reconnect with the Last-Event-ID header set to the last received event id to resume without gaps or duplicates. Only treat the stream as complete when the run itself reaches a terminal status.
?start=latest consumers must also carry Last-Event-ID across reconnects: reconnecting without it re-resolves to the then-current latest event, silently skipping anything published while disconnected.
SDK consumers: do not call the generated fetch wrapper for this path — it will buffer the entire stream. Use the URL builder (getTasksRunsStreamRetrieveUrl) with a streaming fetch/EventSource-style consumer and the Last-Event-ID header instead.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
Query parameters
- startstring
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:id /streamExample response
Status 200
Retrieve tasks runs stream token
Generate a run-scoped JWT that authorizes reading this task run's live event stream via the agent-proxy.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
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 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
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
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
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_atstringnull
- 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
Retrieve tasks active wizard run
Returns the most recent onboarding wizard cloud run for the current project when it is still running (or completed within the last day), so the setup-progress FAB can rehydrate after a drop-flow signup that started the run server-side. Returns 204 when there is none.
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /active_wizard_runExample response
Status 200 The team's active onboarding wizard cloud run.
Status 204 No active onboarding wizard cloud run for this project.
Retrieve tasks active wizard run
Returns the most recent onboarding wizard cloud run for the current project when it is still running (or completed within the last day), so the setup-progress FAB can rehydrate after a drop-flow signup that started the run server-side. Returns 204 when there is none.
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /active_wizard_runExample response
Status 200 The team's active onboarding wizard cloud run.
Status 204 No active onboarding wizard cloud run for this project.
Retrieve tasks models
Return the models a task run may use, with the reasoning efforts each one supports. Derived from the live LLM gateway catalogue, so a newly released model appears without a client change. An empty list means the gateway is unreachable — clients should fall back to their own default rather than treating it as 'no models exist'.
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /modelsExample response
Status 200
Retrieve tasks models
Return the models a task run may use, with the reasoning efforts each one supports. Derived from the live LLM gateway catalogue, so a newly released model appears without a client change. An empty list means the gateway is unreachable — clients should fall back to their own default rather than treating it as 'no models exist'.
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /modelsExample response
Status 200
Retrieve tasks pinned
Return the visible tasks pinned by the requester in the current project.
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /pinnedExample response
Status 200
Retrieve tasks pinned
Return the visible tasks pinned by the requester in the current project.
Required API key scopes
task:readResponse
Example request
GET /api /projects /:project_id /tasks /pinned