API Reference
Log In
API Reference

Get the PR Health trend by day, week or month

Calendar weeks, oldest first, starting Monday 00:00 UTC. Without startDate and endDate they are the 26 weeks ending with the current one. With them (both or neither, at most 366 days, startDate not after endDate, dates from 1970-01-01 to 9999-12-30, else a 400) they are every whole week holding one of the window's days: the first starts on the Monday on or before startDate and the last is the week holding endDate, so the edge weeks may include days outside the window. The last week is never later than the current one, and a window starting after the current week returns no weeks. startDate and endDate are echoed, null without a window. The current week, when listed, is the week so far (complete=false) and its asOf is now, every other asOf is the next Monday. closedUnmerged counts pull requests closed without merging in the week, with the report's eligibility, so whole weeks sum to the report's closedUnmerged over the same days. atRiskPrs counts the non-draft, non-automation pull requests that were open at asOf and had been idle for the team's rottingDays by the latest activity known at that moment: the last update when it is not after asOf, otherwise the last commit before asOf, otherwise the opening date. For the current week that is exactly the report's rule, so the last week's atRiskPrs equals the report's rottingPrs for the same department; past weeks are reconstructed from each pull request's last known activity and may read high. Each count comes with its AI-assisted part, and the team settings and departmentId apply as they do to the report's counts. pricedSince is where dollar estimates start (the report's pricedSince); weeks before it have no coding-assistant spend to price. historyStart is where the synced closed and merged history starts (per GitHub organization, the latest of their starts); covered is false for weeks before it, and for every week when it is null. With includeBasis=true each week also carries basisMergedPrs (the pull requests closed without merging or merged in the week plus those open at its end, automation out, organization-wide), basisOpenPrs (the part open at its end), aiWorkValue (the organization's coding-assistant completion cost that week) and costPerMergedPr (aiWorkValue over basisMergedPrs, 4 decimals, null when the week has no pull requests in its basis or no recorded coding-assistant spend, never 0); without it the four are explicit nulls and the cost data is not read; pull requests opened before the first coding-assistant day leave basisMergedPrs. Each week also carries pricedClosedUnmerged, pricedClosedUnmergedAssisted, pricedAtRiskPrs and pricedAtRiskPrsAssisted: the same counts cut to pull requests opened on or after pricedSince, summing to the report's priced totals as the counts sum to its counts. No dollars are returned: the caller multiplies the priced counts by a basis. With a window, granularity picks the bucket (day, week or month; echoed as granularity, always week without a window). weeks and weekStart keep their names and mean bucket and bucket start. Day buckets are the window's days; month buckets are calendar months clipped to the window, so the first starts at startDate and the last ends the day after endDate; weeks stay whole. Every week-level rule above holds per bucket, with asOf the bucket's end: at risk is counted at each bucket's end, one day, week or calendar month apart. At day grain with includeBasis=true, basisReadBack lists the 6 days before the first bucket, oldest first, each with its basisMergedPrs, basisOpenPrs and aiWorkValue, for a rolling 7-day cost per pull request: sum each day's basisMergedPrs minus basisOpenPrs over the 7 days, then add the last day's basisOpenPrs once, so an open pull request counts once; it is null otherwise.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
required

VCS source: github or gitlab

int64

Scope every figure to a single department (and, with includeDescendants, its subtree), by the department its members belong to today. Must belong to the caller's organization. Omit it for the whole organization.

boolean
Defaults to false

When departmentId is set, also include its descendant departments. Ignored when departmentId is omitted.

boolean
Defaults to false

Also return each week's basis pull requests, AI work value and cost per pull request. It reads cost data, so ask for it only when you need the weekly basis.

string

Team to read or write, as the team's hashid (the same id as /v2/api/teams/{id}). The caller must belong to it or be able to read it: 403 otherwise, 404 when no such team exists. An API key may only name its own organization. Omit it for the API key's organization, or for a signed-in user the first organization they belong to.

date

Start date (ISO yyyy-MM-dd) of the window the weeks cover. Omit it, with endDate, for the 26 weeks ending now.

date

End date (ISO yyyy-MM-dd), inclusive. Required with startDate.

string
Defaults to week

The bucket: day, week (Monday) or month (calendar), UTC. Honoured only with startDate and endDate; without them the trend is the 26 weeks and echoes week. day allows at most 92 days; week's own limit is 400, but the 366-day window cap above applies first, so today week is bounded by that.

Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
*/*