Tasks-3

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

Endpoints

GET
GET
GET
POST

Retrieve tasks runs stream

API for managing task runs. Each run represents an execution of a task.

Required API key scopes

task:read

Path parameters

  • id
    string
  • task_id
    string

Example request

GET /api/projects/:project_id/tasks/:task_id/runs/:id/stream
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/:task_id/runs/:id/stream/

Example response

Status 200

Retrieve tasks repositories

Return the set of repositories referenced by non-deleted, non-internal tasks in the current project. Used to populate repository filter pickers without being constrained by task list pagination.

Required API key scopes

task:read

Response


Example request

GET /api/projects/:project_id/tasks/repositories
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/repositories/

Example response

Status 200 Distinct repositories used by tasks in the current project.
RESPONSE
{
"repositories": [
"string"
]
}

Retrieve tasks repositories

Return the set of repositories referenced by non-deleted, non-internal tasks in the current project. Used to populate repository filter pickers without being constrained by task list pagination.

Required API key scopes

task:read

Response


Example request

GET /api/projects/:project_id/tasks/repositories
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/repositories/

Example response

Status 200 Distinct repositories used by tasks in the current project.
RESPONSE
{
"repositories": [
"string"
]
}

Retrieve tasks repository readiness

Get autonomy readiness details for a specific repository in the current project.

Required API key scopes

task:read

Query parameters

  • refresh
    boolean
    Default: false
  • repository
    string
  • window_days
    integer
    Default: 7

Response


Example request

GET /api/projects/:project_id/tasks/repository_readiness
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/repository_readiness/

Example response

Status 200 Repository readiness status
RESPONSE
{
"repository": "string",
"classification": "string",
"excluded": true,
"coreSuggestions": {
"state": "needs_setup",
"estimated": true,
"reason": "string",
"evidence": {}
},
"replayInsights": {
"state": "needs_setup",
"estimated": true,
"reason": "string",
"evidence": {}
},
"errorInsights": {
"state": "needs_setup",
"estimated": true,
"reason": "string",
"evidence": {}
},
"overall": "string",
"evidenceTaskCount": 0,
"windowDays": 0,
"generatedAt": "string",
"cacheAgeSeconds": 0,
"scan": {
"filesScanned": 0,
"detectedFilesCount": 0,
"eventNameCount": 0,
"foundPosthogInit": true,
"foundPosthogCapture": true,
"foundErrorSignal": true
}
}

Retrieve tasks repository readiness

Get autonomy readiness details for a specific repository in the current project.

Required API key scopes

task:read

Query parameters

  • refresh
    boolean
    Default: false
  • repository
    string
  • window_days
    integer
    Default: 7

Response


Example request

GET /api/projects/:project_id/tasks/repository_readiness
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/repository_readiness/

Example response

Status 200 Repository readiness status
RESPONSE
{
"repository": "string",
"classification": "string",
"excluded": true,
"coreSuggestions": {
"state": "needs_setup",
"estimated": true,
"reason": "string",
"evidence": {}
},
"replayInsights": {
"state": "needs_setup",
"estimated": true,
"reason": "string",
"evidence": {}
},
"errorInsights": {
"state": "needs_setup",
"estimated": true,
"reason": "string",
"evidence": {}
},
"overall": "string",
"evidenceTaskCount": 0,
"windowDays": 0,
"generatedAt": "string",
"cacheAgeSeconds": 0,
"scan": {
"filesScanned": 0,
"detectedFilesCount": 0,
"eventNameCount": 0,
"foundPosthogInit": true,
"foundPosthogCapture": true,
"foundErrorSignal": true
}
}

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",
"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",
"latest_run": {
"status": "not_started",
"environment": "local"
}
}
]
}

Community questions

Questions about this page? or post a community question.