Engineering

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

Endpoints

GET
GET
GET
GET
GET
GET
GET
GET
GET
GET

Retrieve engineering analytics job log

What one GitHub Actions job's log says it did: cache restores (hit, older cache, miss, restore failed) and migrations applied, for the job and per step. Reads the log from GitHub on demand. Only a completed job's answer is cached. log_read is false, never an error, when there is no log to read: a Depot CI job, a job the source does not hold, an expired log, or a failed fetch.

Required API key scopes

engineering_analytics:read

Query parameters

  • ci_engine
    string
    One of: "github_actions""depot_ci"
  • job_id
    integer
  • repo
    string
  • run_id
    integer
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"job": [
{
"kind": "cache",
"state": "hit",
"count": 0,
"detail": [
"string"
]
}
],
"steps": [
{
"badges": [
{
"kind": "cache",
"state": "hit",
"count": 0,
"detail": [
"string"
]
}
],
"number": 0
}
],
"log_read": true,
"attributed_to_steps": true,
"log_truncated": true
}
Status 400 Missing or invalid repo, run_id, job_id, ci_engine or source_id, or an ambiguous job_id.

Retrieve engineering analytics job log

What one GitHub Actions job's log says it did: cache restores (hit, older cache, miss, restore failed) and migrations applied, for the job and per step. Reads the log from GitHub on demand. Only a completed job's answer is cached. log_read is false, never an error, when there is no log to read: a Depot CI job, a job the source does not hold, an expired log, or a failed fetch.

Required API key scopes

engineering_analytics:read

Query parameters

  • ci_engine
    string
    One of: "github_actions""depot_ci"
  • job_id
    integer
  • repo
    string
  • run_id
    integer
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"job": [
{
"kind": "cache",
"state": "hit",
"count": 0,
"detail": [
"string"
]
}
],
"steps": [
{
"badges": [
{
"kind": "cache",
"state": "hit",
"count": 0,
"detail": [
"string"
]
}
],
"number": 0
}
],
"log_read": true,
"attributed_to_steps": true,
"log_truncated": true
}
Status 400 Missing or invalid repo, run_id, job_id, ci_engine or source_id, or an ambiguous job_id.

Retrieve engineering analytics llm spend

How much of a repository's agent LLM spend in a window (date_from default -30d) the pull request attribution reaches: the cost and count of $ai_generation events stamped with the repository, and the part credited to any pull request.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"cost_usd": 0.1,
"attributed_cost_usd": 0.1,
"generations": 0,
"attributed_generations": 0
}
Status 400 Invalid date, repo or source_id.

Retrieve engineering analytics llm spend

How much of a repository's agent LLM spend in a window (date_from default -30d) the pull request attribution reaches: the cost and count of $ai_generation events stamped with the repository, and the part credited to any pull request.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"cost_usd": 0.1,
"attributed_cost_usd": 0.1,
"generations": 0,
"attributed_generations": 0
}
Status 400 Invalid date, repo or source_id.

Retrieve engineering analytics master

Default-branch failures over a window (default -24h), grouped error-tracking style by (workflow, de-sharded failing job) with a run count and first/last seen, newest group first. branch overrides the detected default branch. PR-branch failures are deliberately excluded: at monorepo volume a flat feed is a firehose; those surface per PR. Groups degrade to workflow level (failed_job '') when the job-level source isn't synced.

Required API key scopes

engineering_analytics:read

Query parameters

  • branch
    string
  • date_from
    string
  • date_to
    string
  • repo
    string
  • source_id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"workflow_name": "string",
"failed_job": "string",
"run_count": 0,
"first_seen": "2019-08-24T14:15:22Z",
"last_seen": "2019-08-24T14:15:22Z",
"latest_run_id": 0,
"latest_ci_engine": "github_actions"
}
Status 400 Invalid date_from, date_to, or source_id, or a window over 366 days.

Retrieve engineering analytics master

Default-branch failures over a window (default -24h), grouped error-tracking style by (workflow, de-sharded failing job) with a run count and first/last seen, newest group first. branch overrides the detected default branch. PR-branch failures are deliberately excluded: at monorepo volume a flat feed is a firehose; those surface per PR. Groups degrade to workflow level (failed_job '') when the job-level source isn't synced.

Required API key scopes

engineering_analytics:read

Query parameters

  • branch
    string
  • date_from
    string
  • date_to
    string
  • repo
    string
  • source_id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"workflow_name": "string",
"failed_job": "string",
"run_count": 0,
"first_seen": "2019-08-24T14:15:22Z",
"last_seen": "2019-08-24T14:15:22Z",
"latest_run_id": 0,
"latest_ci_engine": "github_actions"
}
Status 400 Invalid date_from, date_to, or source_id, or a window over 366 days.

Retrieve engineering analytics pr

Estimated CI cost for a pull request, summed over the jobs of all its workflow runs. Billable self-hosted Linux runners only: provider-hosted (free GitHub-hosted) and non-Linux jobs are excluded. Every figure is zero/null with jobs_available false when the job-level source isn't synced yet. llm_spend carries the agent LLM token spend attributed to the PR by git branch, or null when no $ai_generation event matched.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"by_workflow": [
{
"workflow_name": "string",
"billable_minutes": 0.1,
"estimated_cost_usd": 0,
"costed_jobs": 0,
"unsettled_jobs": 0,
"excluded_jobs": 0
}
],
"by_run": [
{
"run_id": 0,
"run_attempt": 0,
"billable_minutes": 0.1,
"estimated_cost_usd": 0,
"ci_engine": "github_actions"
}
],
"llm_spend": {
"cost_usd": 0.1,
"input_tokens": 0,
"output_tokens": 0,
"generations": 0,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"peak_context_tokens": 0
},
"jobs_available": true,
"billable_minutes": 0.1,
"estimated_cost_usd": 0,
"costed_jobs": 0,
"unsettled_jobs": 0,
"excluded_jobs": 0
}
Status 400 Missing pr_number/repo, or invalid repo or source_id.

Retrieve engineering analytics pr

Estimated CI cost for a pull request, summed over the jobs of all its workflow runs. Billable self-hosted Linux runners only: provider-hosted (free GitHub-hosted) and non-Linux jobs are excluded. Every figure is zero/null with jobs_available false when the job-level source isn't synced yet. llm_spend carries the agent LLM token spend attributed to the PR by git branch, or null when no $ai_generation event matched.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"by_workflow": [
{
"workflow_name": "string",
"billable_minutes": 0.1,
"estimated_cost_usd": 0,
"costed_jobs": 0,
"unsettled_jobs": 0,
"excluded_jobs": 0
}
],
"by_run": [
{
"run_id": 0,
"run_attempt": 0,
"billable_minutes": 0.1,
"estimated_cost_usd": 0,
"ci_engine": "github_actions"
}
],
"llm_spend": {
"cost_usd": 0.1,
"input_tokens": 0,
"output_tokens": 0,
"generations": 0,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"peak_context_tokens": 0
},
"jobs_available": true,
"billable_minutes": 0.1,
"estimated_cost_usd": 0,
"costed_jobs": 0,
"unsettled_jobs": 0,
"excluded_jobs": 0
}
Status 400 Missing pr_number/repo, or invalid repo or source_id.

Retrieve engineering analytics pr

The timeline of a single pull request: header plus ordered events (opened, CI started/finished, merged or closed). Use this to answer 'where is this PR stuck and what happened to it'. This is a partial view: review and comment events are not yet available.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"pull_request": {
"author": {
"handle": "string",
"display_name": "string",
"avatar_url": "string",
"is_bot": true
},
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"id": 0,
"number": 0,
"title": "string",
"state": "open",
"is_draft": true,
"created_at": "2019-08-24T14:15:22Z",
"merged_at": "2019-08-24T14:15:22Z",
"closed_at": "2019-08-24T14:15:22Z"
},
"events": [
{
"kind": "opened",
"at": "2019-08-24T14:15:22Z",
"detail": "string",
"run_id": 0,
"ci_engine": "github_actions"
}
],
"metric_quality": "precise"
}
Status 400 Missing pr_number/repo, or invalid repo or source_id.
Status 404 No pull request with that number in the warehouse.

Retrieve engineering analytics pr

The timeline of a single pull request: header plus ordered events (opened, CI started/finished, merged or closed). Use this to answer 'where is this PR stuck and what happened to it'. This is a partial view: review and comment events are not yet available.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"pull_request": {
"author": {
"handle": "string",
"display_name": "string",
"avatar_url": "string",
"is_bot": true
},
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"id": 0,
"number": 0,
"title": "string",
"state": "open",
"is_draft": true,
"created_at": "2019-08-24T14:15:22Z",
"merged_at": "2019-08-24T14:15:22Z",
"closed_at": "2019-08-24T14:15:22Z"
},
"events": [
{
"kind": "opened",
"at": "2019-08-24T14:15:22Z",
"detail": "string",
"run_id": 0,
"ci_engine": "github_actions"
}
],
"metric_quality": "precise"
}
Status 400 Missing pr_number/repo, or invalid repo or source_id.
Status 404 No pull request with that number in the warehouse.

Retrieve engineering analytics pr

Every workflow run attributed to a pull request, across all its commits (grouped by head SHA client-side), newest first. Run-level only.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"id": 0,
"workflow_name": "string",
"head_sha": "string",
"head_branch": "string",
"status": "string",
"conclusion": "string",
"run_started_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"duration_seconds": 0,
"run_attempt": 0,
"pr_number": 0,
"commit_pr_number": 0,
"is_merge_queue": true,
"ci_engine": "github_actions",
"native_run_id": "string",
"native_workflow_run_id": "string",
"workflow_id": 0,
"event": "string"
}
Status 400 Missing pr_number/repo, or invalid repo or source_id.

Retrieve engineering analytics pr

Every workflow run attributed to a pull request, across all its commits (grouped by head SHA client-side), newest first. Run-level only.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"id": 0,
"workflow_name": "string",
"head_sha": "string",
"head_branch": "string",
"status": "string",
"conclusion": "string",
"run_started_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"duration_seconds": 0,
"run_attempt": 0,
"pr_number": 0,
"commit_pr_number": 0,
"is_merge_queue": true,
"ci_engine": "github_actions",
"native_run_id": "string",
"native_workflow_run_id": "string",
"workflow_id": 0,
"event": "string"
}
Status 400 Missing pr_number/repo, or invalid repo or source_id.

Retrieve engineering analytics pull request

One merged pull request's friction as a multiple of the typical pull request, with the counts behind it: red CI by cause, re-runs that failed again, CI time per push, the wait for the first approval, merge-queue time and failed queue attempts, and rework. Covers pull requests merged in the last 30 days.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"pull_request": {
"groups": [
{
"group": "ci",
"score": 0.1
}
],
"score": 0.1,
"flake_red_count": 0,
"master_red_count": 0,
"unknown_red_count": 0,
"own_red_count": 0,
"futile_rerun_count": 0,
"push_count": 0,
"ci_wait_seconds": [
0.1
],
"first_approval_wait_seconds": 0,
"pushes_after_approval": 0,
"queue_seconds": 0,
"kickout_count": 0
},
"available": true,
"window_days": 0
}
Status 400 Missing pr_number or repo, or invalid source_id.

Retrieve engineering analytics pull request

One merged pull request's friction as a multiple of the typical pull request, with the counts behind it: red CI by cause, re-runs that failed again, CI time per push, the wait for the first approval, merge-queue time and failed queue attempts, and rework. Covers pull requests merged in the last 30 days.

Required API key scopes

engineering_analytics:read

Query parameters

  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"pull_request": {
"groups": [
{
"group": "ci",
"score": 0.1
}
],
"score": 0.1,
"flake_red_count": 0,
"master_red_count": 0,
"unknown_red_count": 0,
"own_red_count": 0,
"futile_rerun_count": 0,
"push_count": 0,
"ci_wait_seconds": [
0.1
],
"first_approval_wait_seconds": 0,
"pushes_after_approval": 0,
"queue_seconds": 0,
"kickout_count": 0
},
"available": true,
"window_days": 0
}
Status 400 Missing pr_number or repo, or invalid source_id.

Retrieve engineering analytics pull request

Pull requests as timelines of what each waited on from ready for review to merge or now: review, CI, red checks by what turned them green, and the merge queue. Scope to one author or one GitHub team (open PRs plus PRs merged in the window, date_from default -30d), or to one pull request with pr_number and repo.

Required API key scopes

engineering_analytics:read

Query parameters

  • author
    string
  • date_from
    string
  • date_to
    string
  • github_team
    string
  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"items": [
{
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"pushes": [
{
"head_sha": "string",
"pushed_at": "2019-08-24T14:15:22Z"
}
],
"segments": [
{
"kind": "draft",
"started_at": "2019-08-24T14:15:22Z",
"ended_at": "2019-08-24T14:15:22Z"
}
],
"number": 0,
"title": "string",
"author": {
"handle": "string",
"display_name": "string",
"avatar_url": "string",
"is_bot": true
},
"state": "open",
"is_draft": true,
"created_at": "2019-08-24T14:15:22Z",
"started_at": "2019-08-24T14:15:22Z",
"merged_at": "2019-08-24T14:15:22Z",
"estimated_cost_usd": 0,
"billable_minutes": 0
}
],
"red_seconds_per_merged_pr": [
{
"kind": "draft",
"seconds_per_merged_pr": 0.1
}
],
"scope_kind": "author",
"scope": "string",
"has_membership_data": true,
"review_data_available": true,
"jobs_available": true,
"merge_queue_state_available": true,
"generated_at": "2019-08-24T14:15:22Z",
"merged_pr_count": 0,
"truncated": true,
"limit": 0
}
Status 400 Not exactly one of author, github_team or pr_number, pr_number without repo, or invalid date or source_id.
Status 503 The complete result exceeds the request's warehouse query budget.

Retrieve engineering analytics pull request

Pull requests as timelines of what each waited on from ready for review to merge or now: review, CI, red checks by what turned them green, and the merge queue. Scope to one author or one GitHub team (open PRs plus PRs merged in the window, date_from default -30d), or to one pull request with pr_number and repo.

Required API key scopes

engineering_analytics:read

Query parameters

  • author
    string
  • date_from
    string
  • date_to
    string
  • github_team
    string
  • pr_number
    integer
  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"items": [
{
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"pushes": [
{
"head_sha": "string",
"pushed_at": "2019-08-24T14:15:22Z"
}
],
"segments": [
{
"kind": "draft",
"started_at": "2019-08-24T14:15:22Z",
"ended_at": "2019-08-24T14:15:22Z"
}
],
"number": 0,
"title": "string",
"author": {
"handle": "string",
"display_name": "string",
"avatar_url": "string",
"is_bot": true
},
"state": "open",
"is_draft": true,
"created_at": "2019-08-24T14:15:22Z",
"started_at": "2019-08-24T14:15:22Z",
"merged_at": "2019-08-24T14:15:22Z",
"estimated_cost_usd": 0,
"billable_minutes": 0
}
],
"red_seconds_per_merged_pr": [
{
"kind": "draft",
"seconds_per_merged_pr": 0.1
}
],
"scope_kind": "author",
"scope": "string",
"has_membership_data": true,
"review_data_available": true,
"jobs_available": true,
"merge_queue_state_available": true,
"generated_at": "2019-08-24T14:15:22Z",
"merged_pr_count": 0,
"truncated": true,
"limit": 0
}
Status 400 Not exactly one of author, github_team or pr_number, pr_number without repo, or invalid date or source_id.
Status 503 The complete result exceeds the request's warehouse query budget.

Retrieve engineering analytics pull

Open pull requests plus any merged or closed since date_from (default -30d), newest first, each with its head-SHA CI rollup. Pass state to list one state only. The list is paged by limit and offset; when more match, truncated is true and the ci_cards counts can exceed it. open_to_merge_seconds is coarse: it fuses draft and ready-for-review time; CI counts can lag until late completions settle. Cost and billable minutes can lag new CI by up to 5 minutes.

Required API key scopes

engineering_analytics:read

Query parameters

  • author
    string
  • date_from
    string
  • date_to
    string
  • limit
    integer
  • offset
    integer
  • repo
    string
  • source_id
    string
  • state
    string
    One of: "closed""merged""open"

Response


Example request

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

Example response

Status 200
RESPONSE
{
"items": [
{
"author": {
"handle": "string",
"display_name": "string",
"avatar_url": "string",
"is_bot": true
},
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"ci": {
"runs": 0,
"passing": 0,
"failing": 0,
"pending": 0,
"inconclusive": 0,
"failing_workflows": [
"string"
]
},
"push_history": [
{
"head_sha": "string",
"started_at": "2019-08-24T14:15:22Z",
"wall_seconds": 0,
"failed": true,
"pending": true
}
],
"number": 0,
"title": "string",
"state": "open",
"is_draft": true,
"created_at": "2019-08-24T14:15:22Z",
"merged_at": "2019-08-24T14:15:22Z",
"open_to_merge_seconds": 0,
"ready_to_merge_seconds": 0,
"labels": [
"string"
],
"pushes": 0,
"rerun_cycles": 0,
"estimated_cost_usd": 0,
"billable_minutes": 0
}
],
"truncated": true,
"limit": 0
}
Status 400 Invalid date_from, date_to, state, limit, offset, or source_id.

Retrieve engineering analytics pull

Open pull requests plus any merged or closed since date_from (default -30d), newest first, each with its head-SHA CI rollup. Pass state to list one state only. The list is paged by limit and offset; when more match, truncated is true and the ci_cards counts can exceed it. open_to_merge_seconds is coarse: it fuses draft and ready-for-review time; CI counts can lag until late completions settle. Cost and billable minutes can lag new CI by up to 5 minutes.

Required API key scopes

engineering_analytics:read

Query parameters

  • author
    string
  • date_from
    string
  • date_to
    string
  • limit
    integer
  • offset
    integer
  • repo
    string
  • source_id
    string
  • state
    string
    One of: "closed""merged""open"

Response


Example request

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

Example response

Status 200
RESPONSE
{
"items": [
{
"author": {
"handle": "string",
"display_name": "string",
"avatar_url": "string",
"is_bot": true
},
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"ci": {
"runs": 0,
"passing": 0,
"failing": 0,
"pending": 0,
"inconclusive": 0,
"failing_workflows": [
"string"
]
},
"push_history": [
{
"head_sha": "string",
"started_at": "2019-08-24T14:15:22Z",
"wall_seconds": 0,
"failed": true,
"pending": true
}
],
"number": 0,
"title": "string",
"state": "open",
"is_draft": true,
"created_at": "2019-08-24T14:15:22Z",
"merged_at": "2019-08-24T14:15:22Z",
"open_to_merge_seconds": 0,
"ready_to_merge_seconds": 0,
"labels": [
"string"
],
"pushes": 0,
"rerun_cycles": 0,
"estimated_cost_usd": 0,
"billable_minutes": 0
}
],
"truncated": true,
"limit": 0
}
Status 400 Invalid date_from, date_to, state, limit, offset, or source_id.

Retrieve engineering analytics

The repository's checked-in .test_quarantine.json: flaky tests temporarily quarantined with a hard expiry, classified by urgency (overdue, in grace, expiring soon, active). available is false when the repo has no quarantine file: that is not an error. Parsing is fail-open: malformed entries are reported in parse_errors while well-formed ones are kept.

Required API key scopes

engineering_analytics:read

Query parameters

  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"entries": [
{
"id": "string",
"runner": "string",
"reason": "string",
"owner": "string",
"issue": "string",
"added": "2019-08-24",
"expires": "2019-08-24",
"mode": "run",
"lifecycle": "active",
"days_until_expiry": 0,
"selector_kind": "product"
}
],
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"available": true,
"parse_errors": [
"string"
],
"parse_warnings": [
"string"
],
"source_url": "string",
"generated_at": "2019-08-24T14:15:22Z"
}
Status 400 Invalid repo or source_id.

Retrieve engineering analytics

The repository's checked-in .test_quarantine.json: flaky tests temporarily quarantined with a hard expiry, classified by urgency (overdue, in grace, expiring soon, active). available is false when the repo has no quarantine file: that is not an error. Parsing is fail-open: malformed entries are reported in parse_errors while well-formed ones are kept.

Required API key scopes

engineering_analytics:read

Query parameters

  • repo
    string
  • source_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"entries": [
{
"id": "string",
"runner": "string",
"reason": "string",
"owner": "string",
"issue": "string",
"added": "2019-08-24",
"expires": "2019-08-24",
"mode": "run",
"lifecycle": "active",
"days_until_expiry": 0,
"selector_kind": "product"
}
],
"repo": {
"provider": "string",
"owner": "string",
"name": "string"
},
"available": true,
"parse_errors": [
"string"
],
"parse_warnings": [
"string"
],
"source_url": "string",
"generated_at": "2019-08-24T14:15:22Z"
}
Status 400 Invalid repo or source_id.