Tasks

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST
POST

Create tasks summaries

Returns summary for the requested tasks: id, title, repository, created_at, updated_at, and the latest run's status and environment.

Required API key scopes

task:read

Query parameters

  • limit
    integer
  • offset
    integer

Request parameters

  • ids
    array

Response


Example request

POST /api/projects/:project_id/tasks/summaries
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/summaries/\
-d ids="array"

Example response

Status 200 Summary fields for the requested tasks
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"repository": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"origin_product": "string",
"latest_run": {
"status": "not_started",
"environment": "local"
}
}
]
}

Create tasks summaries

Returns summary for the requested tasks: id, title, repository, created_at, updated_at, and the latest run's status and environment.

Required API key scopes

task:read

Query parameters

  • limit
    integer
  • offset
    integer

Request parameters

  • ids
    array

Response


Example request

POST /api/projects/:project_id/tasks/summaries
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/summaries/\
-d ids="array"

Example response

Status 200 Summary fields for the requested tasks
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"repository": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"origin_product": "string",
"latest_run": {
"status": "not_started",
"environment": "local"
}
}
]
}

Create tasks warm

Warm a full idling Run for a Code-app cloud task while the user composes: boot a sandbox, clone the repo, check out the branch, and start the agent, then idle awaiting the first message. On submit the normal create+run path transparently reuses and activates this Run; abandoned warms are reaped by the Run's inactivity timeout. Best-effort: returns an empty body when the feature flag is off, the warm pool is full, or the GitHub integration doesn't belong to the team.

Required API key scopes

task:write

Request parameters

  • repository
    string
  • github_integration
    integer
  • branch
    stringnull
  • runtime_adapter
  • model
    stringnull
  • reasoning_effort
  • sandbox_environment_id
    stringnull
  • custom_image_id
    stringnull

Response


Example request

POST /api/projects/:project_id/tasks/warm
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/warm/\
-d repository="string",\
-d github_integration="integer"

Example response

Status 200 Warm Run provisioned (`task_id`/`run_id` to activate on submit), or an empty body when the feature is off, capped, or the integration didn't resolve.
RESPONSE
{
"task_id": "736fde4d-9029-4915-8189-01353d6982cb",
"run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec"
}

Create tasks warm

Warm a full idling Run for a Code-app cloud task while the user composes: boot a sandbox, clone the repo, check out the branch, and start the agent, then idle awaiting the first message. On submit the normal create+run path transparently reuses and activates this Run; abandoned warms are reaped by the Run's inactivity timeout. Best-effort: returns an empty body when the feature flag is off, the warm pool is full, or the GitHub integration doesn't belong to the team.

Required API key scopes

task:write

Request parameters

  • repository
    string
  • github_integration
    integer
  • branch
    stringnull
  • runtime_adapter
  • model
    stringnull
  • reasoning_effort
  • sandbox_environment_id
    stringnull
  • custom_image_id
    stringnull

Response


Example request

POST /api/projects/:project_id/tasks/warm
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/warm/\
-d repository="string",\
-d github_integration="integer"

Example response

Status 200 Warm Run provisioned (`task_id`/`run_id` to activate on submit), or an empty body when the feature is off, capped, or the integration didn't resolve.
RESPONSE
{
"task_id": "736fde4d-9029-4915-8189-01353d6982cb",
"run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec"
}

Community questions