Engineering

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

Endpoints

POST
GET
GET
GET
GET
GET
GET
GET
GET
GET

Create engineering analytics quarantine

Opens a pull request that edits the repository's checked-in .test_quarantine.json and, for a new quarantine, opens a tracking issue that the PR links but does not close. The file stays the source of truth that CI enforces; this never bypasses it. A quarantine only affects CI runs that start after the PR merges.

Required API key scopes

engineering_analytics:write

Request parameters

  • operation
  • selector
    string
  • runner
  • repo
    string | null
  • reason
    string
  • owner
    string
  • issue
    string
  • expires
    string | null
  • mode

Response


Example request

POST /api/projects/:project_id/engineering_analytics/quarantine/request
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/engineering_analytics/quarantine/request/\
-d operation=undefined,\
-d selector="string"

Example response

Status 201 The opened pull request, plus the tracking issue for a new quarantine.
RESPONSE
{
"pr_url": "string",
"issue_url": "string",
"branch": "string"
}
Status 400 Invalid input, or the write could not be completed (no GitHub App installed on the repo's org, a malformed quarantine file, or a GitHub failure). The detail message is safe to show.

Create engineering analytics quarantine

Opens a pull request that edits the repository's checked-in .test_quarantine.json and, for a new quarantine, opens a tracking issue that the PR links but does not close. The file stays the source of truth that CI enforces; this never bypasses it. A quarantine only affects CI runs that start after the PR merges.

Required API key scopes

engineering_analytics:write

Request parameters

  • operation
  • selector
    string
  • runner
  • repo
    string | null
  • reason
    string
  • owner
    string
  • issue
    string
  • expires
    string | null
  • mode

Response


Example request

POST /api/projects/:project_id/engineering_analytics/quarantine/request
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/engineering_analytics/quarantine/request/\
-d operation=undefined,\
-d selector="string"

Example response

Status 201 The opened pull request, plus the tracking issue for a new quarantine.
RESPONSE
{
"pr_url": "string",
"issue_url": "string",
"branch": "string"
}
Status 400 Invalid input, or the write could not be completed (no GitHub App installed on the repo's org, a malformed quarantine file, or a GitHub failure). The detail message is safe to show.

Retrieve engineering analytics repo

Repo-level headline aggregates over a window (default -30d): run count, conclusive-run success rate, re-run cycles, merged-PR count (bots included), reverting-PR count and revert share (merges whose title names a revert, over all merges), median PR open-to-merge (bots and drafts excluded; coarse: draft and ready time fused), median time-to-green, billable minutes + estimated cost (with the merge-queue slice of billable minutes broken out), and merge-queue landing stats (queue-landed merges, first-gate-to-merge median and p90, gate attempts, failed-gate share): each with its equal-length previous-window twin so a caller can render honest deltas. Also carries the detected default branch and its completed-run history series (skippable via include_series=false). Cost figures are null until the job-level source is synced.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • include_series
    boolean
  • repo
    string
  • source_id
    string

Response


Example request

GET /api/projects/:project_id/engineering_analytics/repo_overview
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/repo_overview/

Example response

Status 200
RESPONSE
{
"cost_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"estimated_cost_usd": 0,
"merges": 0,
"cost_per_merge_usd": 0
}
],
"time_to_green_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"p50_seconds": 0
}
],
"success_rate_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"success_rate": 0
}
],
"open_to_merge_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"p50_seconds": 0
}
],
"delivery_pipeline": {
"stages": [
{
"stage": "open_to_gate",
"median_seconds": 0,
"p90_seconds": 0,
"pr_count": 0
}
],
"merged_pr_count": 0
},
"ready_to_merge_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"p50_seconds": 0
}
],
"revert_share_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"merged_pr_count": 0,
"reverting_pr_count": 0,
"revert_share": 0
}
],
"run_count": 0,
"run_count_prev": 0,
"success_rate": 0,
"success_rate_prev": 0,
"rerun_cycles": 0,
"rerun_cycles_prev": 0,
"merged_pr_count": 0,
"merged_pr_count_prev": 0,
"reverting_pr_count": 0,
"reverting_pr_count_prev": 0,
"revert_share": 0,
"revert_share_prev": 0,
"median_open_to_merge_seconds": 0,
"median_open_to_merge_seconds_prev": 0,
"median_ready_to_merge_seconds": 0,
"median_ready_to_merge_seconds_prev": 0,
"billable_minutes": 0,
"billable_minutes_prev": 0,
"estimated_cost_usd": 0,
"estimated_cost_usd_prev": 0,
"cost_per_merge_usd": 0,
"cost_per_merge_usd_prev": 0,
"merge_queue_billable_minutes": 0,
"merge_queue_billable_minutes_prev": 0,
"depot_ci_billable_minutes": 0,
"depot_ci_billable_minutes_prev": 0,
"merge_queue_merged_pr_count": 0,
"merge_queue_merged_pr_count_prev": 0,
"merge_queue_median_first_gate_to_merge_seconds": 0,
"merge_queue_median_first_gate_to_merge_seconds_prev": 0,
"merge_queue_p90_first_gate_to_merge_seconds": 0,
"merge_queue_p90_first_gate_to_merge_seconds_prev": 0,
"merge_queue_p95_first_gate_to_merge_seconds": 0,
"merge_queue_p95_first_gate_to_merge_seconds_prev": 0,
"merge_queue_p99_first_gate_to_merge_seconds": 0,
"merge_queue_p99_first_gate_to_merge_seconds_prev": 0,
"merge_queue_avg_attempts_per_merge": 0,
"merge_queue_avg_attempts_per_merge_prev": 0,
"merge_queue_multi_attempt_merge_share": 0,
"merge_queue_multi_attempt_merge_share_prev": 0,
"merge_queue_failed_gate_merge_share": 0,
"merge_queue_failed_gate_merge_share_prev": 0,
"merge_queue_trunk_available": true,
"merge_queue_failed_or_cancelled_share": 0,
"merge_queue_failed_or_cancelled_share_prev": 0,
"merge_queue_skip_the_line_count": 0,
"merge_queue_skip_the_line_count_prev": 0,
"median_time_to_green_seconds": 0,
"median_time_to_green_seconds_prev": 0,
"jobs_available": true,
"default_branch": "string",
"cost_series_granularity": "string",
"time_to_green_series_granularity": "string",
"success_rate_series_granularity": "string",
"open_to_merge_series_granularity": "string",
"ready_to_merge_series_granularity": "string",
"revert_share_series_granularity": "string"
}
Status 400 Invalid date_from, date_to, or source_id, or a window over 366 days.

Retrieve engineering analytics repo

Repo-level headline aggregates over a window (default -30d): run count, conclusive-run success rate, re-run cycles, merged-PR count (bots included), reverting-PR count and revert share (merges whose title names a revert, over all merges), median PR open-to-merge (bots and drafts excluded; coarse: draft and ready time fused), median time-to-green, billable minutes + estimated cost (with the merge-queue slice of billable minutes broken out), and merge-queue landing stats (queue-landed merges, first-gate-to-merge median and p90, gate attempts, failed-gate share): each with its equal-length previous-window twin so a caller can render honest deltas. Also carries the detected default branch and its completed-run history series (skippable via include_series=false). Cost figures are null until the job-level source is synced.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • include_series
    boolean
  • repo
    string
  • source_id
    string

Response


Example request

GET /api/projects/:project_id/engineering_analytics/repo_overview
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/repo_overview/

Example response

Status 200
RESPONSE
{
"cost_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"estimated_cost_usd": 0,
"merges": 0,
"cost_per_merge_usd": 0
}
],
"time_to_green_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"p50_seconds": 0
}
],
"success_rate_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"success_rate": 0
}
],
"open_to_merge_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"p50_seconds": 0
}
],
"delivery_pipeline": {
"stages": [
{
"stage": "open_to_gate",
"median_seconds": 0,
"p90_seconds": 0,
"pr_count": 0
}
],
"merged_pr_count": 0
},
"ready_to_merge_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"p50_seconds": 0
}
],
"revert_share_series": [
{
"bucket_start": "2019-08-24T14:15:22Z",
"merged_pr_count": 0,
"reverting_pr_count": 0,
"revert_share": 0
}
],
"run_count": 0,
"run_count_prev": 0,
"success_rate": 0,
"success_rate_prev": 0,
"rerun_cycles": 0,
"rerun_cycles_prev": 0,
"merged_pr_count": 0,
"merged_pr_count_prev": 0,
"reverting_pr_count": 0,
"reverting_pr_count_prev": 0,
"revert_share": 0,
"revert_share_prev": 0,
"median_open_to_merge_seconds": 0,
"median_open_to_merge_seconds_prev": 0,
"median_ready_to_merge_seconds": 0,
"median_ready_to_merge_seconds_prev": 0,
"billable_minutes": 0,
"billable_minutes_prev": 0,
"estimated_cost_usd": 0,
"estimated_cost_usd_prev": 0,
"cost_per_merge_usd": 0,
"cost_per_merge_usd_prev": 0,
"merge_queue_billable_minutes": 0,
"merge_queue_billable_minutes_prev": 0,
"depot_ci_billable_minutes": 0,
"depot_ci_billable_minutes_prev": 0,
"merge_queue_merged_pr_count": 0,
"merge_queue_merged_pr_count_prev": 0,
"merge_queue_median_first_gate_to_merge_seconds": 0,
"merge_queue_median_first_gate_to_merge_seconds_prev": 0,
"merge_queue_p90_first_gate_to_merge_seconds": 0,
"merge_queue_p90_first_gate_to_merge_seconds_prev": 0,
"merge_queue_p95_first_gate_to_merge_seconds": 0,
"merge_queue_p95_first_gate_to_merge_seconds_prev": 0,
"merge_queue_p99_first_gate_to_merge_seconds": 0,
"merge_queue_p99_first_gate_to_merge_seconds_prev": 0,
"merge_queue_avg_attempts_per_merge": 0,
"merge_queue_avg_attempts_per_merge_prev": 0,
"merge_queue_multi_attempt_merge_share": 0,
"merge_queue_multi_attempt_merge_share_prev": 0,
"merge_queue_failed_gate_merge_share": 0,
"merge_queue_failed_gate_merge_share_prev": 0,
"merge_queue_trunk_available": true,
"merge_queue_failed_or_cancelled_share": 0,
"merge_queue_failed_or_cancelled_share_prev": 0,
"merge_queue_skip_the_line_count": 0,
"merge_queue_skip_the_line_count_prev": 0,
"median_time_to_green_seconds": 0,
"median_time_to_green_seconds_prev": 0,
"jobs_available": true,
"default_branch": "string",
"cost_series_granularity": "string",
"time_to_green_series_granularity": "string",
"success_rate_series_granularity": "string",
"open_to_merge_series_granularity": "string",
"ready_to_merge_series_granularity": "string",
"revert_share_series_granularity": "string"
}
Status 400 Invalid date_from, date_to, or source_id, or a window over 366 days.

Retrieve engineering analytics repo run

Default-branch health as compact chart points over a window (default -30d), newest first, for the repo-hub run-activity chart. All of a commit's workflow runs are collapsed into ONE point per commit (head SHA): its earliest workflow start, wall-clock duration until the last workflow settled (null while any is still running), and an overall conclusion that is 'failure' if any workflow decisively failed, else 'success' when at least one passed, else 'neutral'. branch overrides the detected default branch. truncated is true when more commits matched than the cap, so the chart covers only the most recent commits.

Required API key scopes

engineering_analytics:read

Query parameters

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

Response


Example request

GET /api/projects/:project_id/engineering_analytics/repo_run_activity
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/repo_run_activity/

Example response

Status 200
RESPONSE
{
"points": [
{
"run_id": 0,
"conclusion": "string",
"run_started_at": "2019-08-24T14:15:22Z",
"duration_seconds": 0,
"head_branch": "string",
"pr_number": 0,
"head_sha": "string",
"ci_engine": "github_actions"
}
],
"truncated": true,
"limit": 0
}
Status 400 Invalid date_from, date_to, or source_id, or a window over 366 days.

Retrieve engineering analytics repo run

Default-branch health as compact chart points over a window (default -30d), newest first, for the repo-hub run-activity chart. All of a commit's workflow runs are collapsed into ONE point per commit (head SHA): its earliest workflow start, wall-clock duration until the last workflow settled (null while any is still running), and an overall conclusion that is 'failure' if any workflow decisively failed, else 'success' when at least one passed, else 'neutral'. branch overrides the detected default branch. truncated is true when more commits matched than the cap, so the chart covers only the most recent commits.

Required API key scopes

engineering_analytics:read

Query parameters

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

Response


Example request

GET /api/projects/:project_id/engineering_analytics/repo_run_activity
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/repo_run_activity/

Example response

Status 200
RESPONSE
{
"points": [
{
"run_id": 0,
"conclusion": "string",
"run_started_at": "2019-08-24T14:15:22Z",
"duration_seconds": 0,
"head_branch": "string",
"pr_number": 0,
"head_sha": "string",
"ci_engine": "github_actions"
}
],
"truncated": true,
"limit": 0
}
Status 400 Invalid date_from, date_to, or source_id, or a window over 366 days.

Retrieve engineering analytics resolve

Resolve a git branch to the pull request(s) it belongs to: the cross-product link seam so another product (the LLM analytics UI) can turn a git branch into a PR detail link. Matches the PR's head ref, open PRs first then most recently updated. Pass timestamp (the trace's capture time) to prefer the PR that was active at that moment when a branch name has been reused across PRs. branch is required. Returns a possibly-empty, possibly-multi list: an empty list is a valid 200 (the caller renders a plain chip).

Required API key scopes

engineering_analytics:read

Query parameters

  • branch
    string
  • repo
    string
  • source_id
    string
  • timestamp
    string

Example request

GET /api/projects/:project_id/engineering_analytics/resolve_branch
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/resolve_branch/

Example response

Status 200
RESPONSE
{
"repo": "string",
"number": 0,
"title": "string",
"state": "string"
}
Status 400 Branch missing/empty, or invalid repo/timestamp/source_id.

Retrieve engineering analytics resolve

Resolve a git branch to the pull request(s) it belongs to: the cross-product link seam so another product (the LLM analytics UI) can turn a git branch into a PR detail link. Matches the PR's head ref, open PRs first then most recently updated. Pass timestamp (the trace's capture time) to prefer the PR that was active at that moment when a branch name has been reused across PRs. branch is required. Returns a possibly-empty, possibly-multi list: an empty list is a valid 200 (the caller renders a plain chip).

Required API key scopes

engineering_analytics:read

Query parameters

  • branch
    string
  • repo
    string
  • source_id
    string
  • timestamp
    string

Example request

GET /api/projects/:project_id/engineering_analytics/resolve_branch
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/resolve_branch/

Example response

Status 200
RESPONSE
{
"repo": "string",
"number": 0,
"title": "string",
"state": "string"
}
Status 400 Branch missing/empty, or invalid repo/timestamp/source_id.

Retrieve engineering analytics revert

How many pull requests merged in the window were later reverted, split by how each was authored and by who approved it, with the list of reverted pull requests. A revert is linked to the pull request it undid through the 'Reverts #N' line in the revert's description, so a revert without that line is not counted. Pull requests that are themselves reverts are left out of every count.

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/revert_outcomes
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/revert_outcomes/

Example response

Status 200
RESPONSE
{
"by_authorship": [
{
"authorship": "bot",
"merged_pr_count": 0,
"reverted_pr_count": 0,
"reverted_share": 0
}
],
"by_approval": [
{
"approval": "human",
"merged_pr_count": 0,
"reverted_pr_count": 0,
"reverted_share": 0
}
],
"reverted_pull_requests": [
{
"number": 0,
"title": "string",
"merged_at": "2019-08-24T14:15:22Z",
"authorship": "bot",
"approval": "human",
"reverting_pr_number": 0,
"reverted_at": "2019-08-24T14:15:22Z",
"merge_to_revert_seconds": 0
}
],
"merged_pr_count": 0,
"reverted_pr_count": 0,
"reverted_share": 0,
"body_data_available": true,
"review_data_available": true,
"truncated": true,
"limit": 0
}
Status 400 Invalid date_from, date_to, or source_id.

Retrieve engineering analytics revert

How many pull requests merged in the window were later reverted, split by how each was authored and by who approved it, with the list of reverted pull requests. A revert is linked to the pull request it undid through the 'Reverts #N' line in the revert's description, so a revert without that line is not counted. Pull requests that are themselves reverts are left out of every count.

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/revert_outcomes
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/revert_outcomes/

Example response

Status 200
RESPONSE
{
"by_authorship": [
{
"authorship": "bot",
"merged_pr_count": 0,
"reverted_pr_count": 0,
"reverted_share": 0
}
],
"by_approval": [
{
"approval": "human",
"merged_pr_count": 0,
"reverted_pr_count": 0,
"reverted_share": 0
}
],
"reverted_pull_requests": [
{
"number": 0,
"title": "string",
"merged_at": "2019-08-24T14:15:22Z",
"authorship": "bot",
"approval": "human",
"reverting_pr_number": 0,
"reverted_at": "2019-08-24T14:15:22Z",
"merge_to_revert_seconds": 0
}
],
"merged_pr_count": 0,
"reverted_pr_count": 0,
"reverted_share": 0,
"body_data_available": true,
"review_data_available": true,
"truncated": true,
"limit": 0
}
Status 400 Invalid date_from, date_to, or source_id.

Retrieve engineering analytics run failure

The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of ci_failure_logs for surfaces that aren't PR-scoped (default-branch failures, the run page). logs_available is false when the run didn't fail or its logs aged out of the short Logs retention.

Required API key scopes

engineering_analytics:read

Query parameters

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

Response


Example request

GET /api/projects/:project_id/engineering_analytics/run_failure_logs
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/run_failure_logs/

Example response

Status 200
RESPONSE
{
"jobs": [
{
"lines": [
{
"original_line": 0,
"text": "string"
}
],
"job_id": 0,
"run_id": 0,
"conclusion": "string",
"branch": "string",
"original_total_lines": 0,
"line_count": 0,
"truncated": true,
"ci_engine": "github_actions"
}
],
"run_id": 0,
"logs_available": true,
"truncated": true,
"ci_engine": "github_actions"
}
Status 400 Missing or non-integer run_id, ambiguous run identity, or invalid ci_engine/source_id.

Retrieve engineering analytics run failure

The thinned CI failure logs of one workflow run, grouped by failed job: the run-scoped twin of ci_failure_logs for surfaces that aren't PR-scoped (default-branch failures, the run page). logs_available is false when the run didn't fail or its logs aged out of the short Logs retention.

Required API key scopes

engineering_analytics:read

Query parameters

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

Response


Example request

GET /api/projects/:project_id/engineering_analytics/run_failure_logs
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/run_failure_logs/

Example response

Status 200
RESPONSE
{
"jobs": [
{
"lines": [
{
"original_line": 0,
"text": "string"
}
],
"job_id": 0,
"run_id": 0,
"conclusion": "string",
"branch": "string",
"original_total_lines": 0,
"line_count": 0,
"truncated": true,
"ci_engine": "github_actions"
}
],
"run_id": 0,
"logs_available": true,
"truncated": true,
"ci_engine": "github_actions"
}
Status 400 Missing or non-integer run_id, ambiguous run identity, or invalid ci_engine/source_id.

Retrieve engineering analytics

The team's selectable GitHub repositories, oldest source first: one entry per repository a source is configured to sync, so a source syncing several repositories appears once per repo. Populate a repo picker from this and pass a chosen entry's id back as source_id and its repo back as repo to the other endpoints. Includes repositories whose tables aren't fully synced yet.

Required API key scopes

engineering_analytics:read

Example request

GET /api/projects/:project_id/engineering_analytics/sources
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/sources/

Example response

Status 200
RESPONSE
{
"id": "string",
"repo": "string",
"prefix": "string",
"synced": true
}

Retrieve engineering analytics

The team's selectable GitHub repositories, oldest source first: one entry per repository a source is configured to sync, so a source syncing several repositories appears once per repo. Populate a repo picker from this and pass a chosen entry's id back as source_id and its repo back as repo to the other endpoints. Includes repositories whose tables aren't fully synced yet.

Required API key scopes

engineering_analytics:read

Example request

GET /api/projects/:project_id/engineering_analytics/sources
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/sources/

Example response

Status 200
RESPONSE
{
"id": "string",
"repo": "string",
"prefix": "string",
"synced": true
}

Retrieve engineering analytics team ci

One owning team's CI test activity: per-test current-vs-prior signal pairs (the before/after comparison) over the window and its equal-length prior twin. Signal = runs where an owned test failed, errored, or a retry recovered it. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • owner_team
    string
  • repo
    string
  • source_id
    string
  • test_limit
    integer

Response


Example request

GET /api/projects/:project_id/engineering_analytics/team_ci_activity
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/team_ci_activity/

Example response

Status 200
RESPONSE
{
"tests": [
{
"runner": "pytest",
"nodeid": "string",
"selector": "string",
"signal_count": 0,
"signal_count_prior": 0,
"last_seen_at": "2019-08-24T14:15:22Z"
}
],
"owner_team": "string",
"truncated_tests": true
}
Status 400 Missing owner_team, invalid date, test_limit, or source_id, or a window longer than 30 days.

Retrieve engineering analytics team ci

One owning team's CI test activity: per-test current-vs-prior signal pairs (the before/after comparison) over the window and its equal-length prior twin. Signal = runs where an owned test failed, errored, or a retry recovered it. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • owner_team
    string
  • repo
    string
  • source_id
    string
  • test_limit
    integer

Response


Example request

GET /api/projects/:project_id/engineering_analytics/team_ci_activity
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/team_ci_activity/

Example response

Status 200
RESPONSE
{
"tests": [
{
"runner": "pytest",
"nodeid": "string",
"selector": "string",
"signal_count": 0,
"signal_count_prior": 0,
"last_seen_at": "2019-08-24T14:15:22Z"
}
],
"owner_team": "string",
"truncated_tests": true
}
Status 400 Missing owner_team, invalid date, test_limit, or source_id, or a window longer than 30 days.

Retrieve engineering analytics team ci

Per-owning-team rollup of the CI test surfaces each team owns, over the same run evidence as flaky_tests and with the same meaning of flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window, regression_test_count is owned tests that failed with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI emission time from the repo's ownership map (the distributed owners.yaml files); unstamped spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest owner only. Each row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at. Teams are organizational owners of code surfaces, never authors. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • limit
    integer
  • min_failed_prs
    integer
  • owner_team
    string
  • repo
    string
  • source_id
    string

Response


Example request

GET /api/projects/:project_id/engineering_analytics/team_ci_health
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/team_ci_health/

Example response

Status 200
RESPONSE
{
"items": [
{
"owner_team": "string",
"flaky_test_count": 0,
"flaky_test_count_prior": 0,
"regression_test_count": 0,
"regression_test_count_prior": 0,
"failed_run_count": 0,
"failed_run_count_prior": 0,
"same_commit_recovery_run_count": 0,
"same_commit_recovery_run_count_prior": 0,
"quarantined_failed_run_count": 0,
"quarantined_failed_run_count_prior": 0,
"last_seen_at": "2019-08-24T14:15:22Z",
"test_file_count": 0,
"test_file_count_prior": 0,
"merged_pr_count": 0,
"merged_pr_count_prior": 0
}
],
"truncated": true,
"limit": 0
}
Status 400 Invalid date, threshold, limit, or source_id, or a window longer than 30 days.

Retrieve engineering analytics team ci

Per-owning-team rollup of the CI test surfaces each team owns, over the same run evidence as flaky_tests and with the same meaning of flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window, regression_test_count is owned tests that failed with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI emission time from the repo's ownership map (the distributed owners.yaml files); unstamped spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest owner only. Each row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at. Teams are organizational owners of code surfaces, never authors. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.

Required API key scopes

engineering_analytics:read

Query parameters

  • date_from
    string
  • date_to
    string
  • limit
    integer
  • min_failed_prs
    integer
  • owner_team
    string
  • repo
    string
  • source_id
    string

Response


Example request

GET /api/projects/:project_id/engineering_analytics/team_ci_health
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/team_ci_health/

Example response

Status 200
RESPONSE
{
"items": [
{
"owner_team": "string",
"flaky_test_count": 0,
"flaky_test_count_prior": 0,
"regression_test_count": 0,
"regression_test_count_prior": 0,
"failed_run_count": 0,
"failed_run_count_prior": 0,
"same_commit_recovery_run_count": 0,
"same_commit_recovery_run_count_prior": 0,
"quarantined_failed_run_count": 0,
"quarantined_failed_run_count_prior": 0,
"last_seen_at": "2019-08-24T14:15:22Z",
"test_file_count": 0,
"test_file_count_prior": 0,
"merged_pr_count": 0,
"merged_pr_count_prior": 0
}
],
"truncated": true,
"limit": 0
}
Status 400 Invalid date, threshold, limit, or source_id, or a window longer than 30 days.

Retrieve engineering analytics team merge

One team's daily time-to-merge trend: the median and average open→merge seconds over the PRs the team's members merged each day (PR author login → GitHub org team membership). Team-level aggregates only, never per-member figures or cross-team rankings. Timing is the coarse open→merge (draft + review time combined); bots are excluded. Requires the GitHub source's team_members snapshot; has_membership_data is false without it.

Required API key scopes

engineering_analytics:read

Query parameters

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

Response


Example request

GET /api/projects/:project_id/engineering_analytics/team_merge_trend
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/team_merge_trend/

Example response

Status 200
RESPONSE
{
"points": [
{
"day": "2019-08-24T14:15:22Z",
"median_seconds": 0,
"average_seconds": 0,
"merged_count": 0
}
],
"owner_team": "string",
"has_membership_data": true
}
Status 400 Missing owner_team, invalid date or source_id, or a window longer than 30 days.

Retrieve engineering analytics team merge

One team's daily time-to-merge trend: the median and average open→merge seconds over the PRs the team's members merged each day (PR author login → GitHub org team membership). Team-level aggregates only, never per-member figures or cross-team rankings. Timing is the coarse open→merge (draft + review time combined); bots are excluded. Requires the GitHub source's team_members snapshot; has_membership_data is false without it.

Required API key scopes

engineering_analytics:read

Query parameters

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

Response


Example request

GET /api/projects/:project_id/engineering_analytics/team_merge_trend
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/team_merge_trend/

Example response

Status 200
RESPONSE
{
"points": [
{
"day": "2019-08-24T14:15:22Z",
"median_seconds": 0,
"average_seconds": 0,
"merged_count": 0
}
],
"owner_team": "string",
"has_membership_data": true
}
Status 400 Missing owner_team, invalid date or source_id, or a window longer than 30 days.