Tasks
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
POST | |
DELETE | |
POST | |
POST | |
POST | |
GET | |
GET | |
POST | |
GET | |
PATCH | |
POST | |
POST |
Create tasks pin
API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- pinnedboolean
Response
Example request
POST /api /projects /:project_id /tasks /:id /pinExample response
Status 200
Create tasks pin
API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- pinnedboolean
Response
Example request
POST /api /projects /:project_id /tasks /:id /pinExample response
Status 200
Create tasks presence
Idempotent upsert: marks the calling user + device_id as actively watching this task for the next ~60 seconds. While at least one device for the user has a non-expired presence row for this task, the push fanout will skip ALL of that user's other registered devices for task notifications — the contract is 'if any device is demonstrably watching, suppress the others'. Clients call this every ~30s while the task screen is foregrounded. device_id is the UUID of the caller's UserPushToken row.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- device_idstring
Example request
POST /api /projects /:project_id /tasks /:id /presenceExample response
Status 204 Presence recorded for this device.
Status 404 `device_id` does not match a push token registered by the caller.
Create tasks presence
Idempotent upsert: marks the calling user + device_id as actively watching this task for the next ~60 seconds. While at least one device for the user has a non-expired presence row for this task, the push fanout will skip ALL of that user's other registered devices for task notifications — the contract is 'if any device is demonstrably watching, suppress the others'. Clients call this every ~30s while the task screen is foregrounded. device_id is the UUID of the caller's UserPushToken row.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- device_idstring
Example request
POST /api /projects /:project_id /tasks /:id /presenceExample response
Status 204 Presence recorded for this device.
Status 404 `device_id` does not match a push token registered by the caller.
Delete tasks presence
Idempotent upsert: marks the calling user + device_id as actively watching this task for the next ~60 seconds. While at least one device for the user has a non-expired presence row for this task, the push fanout will skip ALL of that user's other registered devices for task notifications — the contract is 'if any device is demonstrably watching, suppress the others'. Clients call this every ~30s while the task screen is foregrounded. device_id is the UUID of the caller's UserPushToken row.
Required API key scopes
task:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /tasks /:id /presenceExample response
Status 204 Presence recorded for this device.
Status 404 `device_id` does not match a push token registered by the caller.
Delete tasks presence
Idempotent upsert: marks the calling user + device_id as actively watching this task for the next ~60 seconds. While at least one device for the user has a non-expired presence row for this task, the push fanout will skip ALL of that user's other registered devices for task notifications — the contract is 'if any device is demonstrably watching, suppress the others'. Clients call this every ~30s while the task screen is foregrounded. device_id is the UUID of the caller's UserPushToken row.
Required API key scopes
task:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /tasks /:id /presenceExample response
Status 204 Presence recorded for this device.
Status 404 `device_id` does not match a push token registered by the caller.
Create tasks run
Create a new task run and kick off the workflow.
Required API key scopes
task:writePath parameters
- idstring
Response
Example request
Example response
Status 200 Task with updated latest run
Status 400 Invalid task run payload
Status 403 PostHog Desktop access is required, or Pi cloud runtime is disabled
Status 404 Task not found
Status 429 Team is over its posthog_code usage limit, or the task's signal report has reached its task limit (code `signal_report_task_cap`)
Create tasks run
Create a new task run and kick off the workflow.
Required API key scopes
task:writePath parameters
- idstring
Response
Example request
Example response
Status 200 Task with updated latest run
Status 400 Invalid task run payload
Status 403 PostHog Desktop access is required, or Pi cloud runtime is disabled
Status 404 Task not found
Status 429 Team is over its posthog_code usage limit, or the task's signal report has reached its task limit (code `signal_report_task_cap`)
Create tasks staged artifacts finalize upload
Verify staged S3 uploads and cache their metadata so they can be attached to the next run created for this task.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- artifactsarray
Response
Example request
POST /api /projects /:project_id /tasks /:id /staged_artifacts /finalize_uploadExample response
Status 200 Finalized staged artifacts available for the next task run
Status 400 Invalid artifact payload
Status 404 Task not found
Create tasks staged artifacts finalize upload
Verify staged S3 uploads and cache their metadata so they can be attached to the next run created for this task.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- artifactsarray
Response
Example request
POST /api /projects /:project_id /tasks /:id /staged_artifacts /finalize_uploadExample response
Status 200 Finalized staged artifacts available for the next task run
Status 400 Invalid artifact payload
Status 404 Task not found
Create tasks staged artifacts prepare upload
Reserve S3 object keys for task attachments before creating a new run and return presigned POST forms for direct uploads.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- artifactsarray
Response
Example request
POST /api /projects /:project_id /tasks /:id /staged_artifacts /prepare_uploadExample response
Status 200 Prepared staged uploads for the requested artifacts
Status 400 Invalid artifact payload
Status 404 Task not found
Create tasks staged artifacts prepare upload
Reserve S3 object keys for task attachments before creating a new run and return presigned POST forms for direct uploads.
Required API key scopes
task:writePath parameters
- idstring
Request parameters
- artifactsarray
Response
Example request
POST /api /projects /:project_id /tasks /:id /staged_artifacts /prepare_uploadExample response
Status 200 Prepared staged uploads for the requested artifacts
Status 400 Invalid artifact payload
Status 404 Task not found
Retrieve tasks usage
Return estimated model and cloud compute costs attributed to a task.
Required API key scopes
task:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /tasks /:id /usageExample response
Status 200
Retrieve tasks usage
Return estimated model and cloud compute costs attributed to a task.
Required API key scopes
task:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /tasks /:id /usageExample response
Status 200
List all tasks runs
Get a list of runs for a specific task.
Required API key scopes
task:readPath parameters
- task_idstring
Query parameters
- limitintegerDefault:
50 - offsetintegerDefault:
0
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runsExample response
Status 200 List of task runs
Create tasks runs
Create a new run for a specific task without starting execution.
Required API key scopes
task:writePath parameters
- task_idstring
Request parameters
- imported_mcp_serversarraynull
- relayed_mcp_serversarraynull
- environmentDefault:
local - modeDefault:
background - branchstringnull
- sandbox_environment_idstring
- custom_image_idstring
- pr_authorship_mode
- auto_publishbooleannull
- run_source
- signal_report_idstring
- runtime_adapter
- modelstring
- reasoning_effort
- context_window
- fast_modebooleannull
- github_user_tokenstring
- initial_permission_mode
- rtk_enabledbooleannull
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runsExample response
Status 201 Created task run
Status 400 Invalid task run payload
Status 403 PostHog Desktop access is required, or Pi cloud runtime is disabled
Status 429 Team is over its posthog_code usage limit
Retrieve tasks runs
Retrieve a single run for a specific task.
Required API key scopes
task:readPath parameters
- idstring
- task_idstring
Response
Example request
GET /api /projects /:project_id /tasks /:task_id /runs /:idExample response
Status 200 Task run
Status 404 Task run not found
Update tasks runs
API for managing task runs. Each run represents an execution of a task.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Request parameters
- status
- branchstringnull
- stagestringnull
- output
- state
- state_remove_keysarray
- state_appendobject
- error_messagestringnull
- environment
Response
Example request
PATCH /api /projects /:project_id /tasks /:task_id /runs /:idExample response
Status 200 Updated task run
Status 400 Invalid update data
Status 404 Task run not found
Create tasks runs analysis insight
Store one verified inefficiency finding on a task-analysis run. Only the run's own task-bound sandbox agent may call it, and only on a task-analysis run. The findings list is server-owned: it is not writable through the run update endpoint.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Request parameters
- no_findings_reason
- observationstring
- evidencearray
- occurrence_countinteger
- category
- other_justificationstring
- wasted_effort
- recurrence
- confidence_basis
- suggested_fix
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:id /analysis-insightExample response
Status 201 Finding stored on the run
Status 400 The finding is invalid, or the run already holds the maximum
Status 403 Only the run's own analysis sandbox may report findings
Status 404 Run not found
Create tasks runs analyze
Create a PostHog-funded analysis task that reviews this run's transcript for inefficiencies and reports findings. Idempotent per run: if an analysis task already exists for this run, it is returned instead of creating another. The analysis is not billed to the customer.
Required API key scopes
task:writePath parameters
- idstring
- task_idstring
Response
Example request
POST /api /projects /:project_id /tasks /:task_id /runs /:id /analyze