Organizeinsights
GET/repositories/{repo_id}/insights/cycle-time
Get exact p50 and p95 for a repository's four cycle-time durations
get_repo_cycle_time
insights:read
A token needs theinsights:readscope: Read flow metrics and cycle times for repositories and namespacesGranted bymcp_agent,mcp_agent_write,read_api,write_api.Every operation this scope unlocks
Time to merge, time to first review, work-item cycle time and pipeline duration, each as a median and 95th percentile with the number of samples behind it, over a window of whole days (UTC; the last 30 by default, at most 366). Anyone who can see the repository may read it.
Parameters
Path
- repo_idRepositoryId (string · uuid)The repository's id
Query
- fromstringoptionalYYYY-MM-DD start of the window
- tostringoptionalYYYY-MM-DD end, inclusive
Responses
200Four percentile surfaces, each with its sample countapplication/json
- fromstring
issue_cycle_timePercentileSurface
- The PercentileSurface schema
- ninteger · int640–∞
- truncatedbooleanWhether the window held more than 20,000 measurements, in which case the percentiles are computed over 20,000 of them and
nis that limit rather than the full count. - p50_secondsnumber · double or nulloptionalThe median, in seconds. Absent when the window held nothing to measure — which is different from a median of zero.
- p95_secondsnumber · double or nulloptional
pipeline_durationPercentileSurface
- The PercentileSurface schema
- ninteger · int640–∞
- truncatedbooleanWhether the window held more than 20,000 measurements, in which case the percentiles are computed over 20,000 of them and
nis that limit rather than the full count. - p50_secondsnumber · double or nulloptionalThe median, in seconds. Absent when the window held nothing to measure — which is different from a median of zero.
- p95_secondsnumber · double or nulloptional
scopeActivityScope
- The ActivityScope schema
- full_pathstring
- idstring
- typeScopeTypegrouprepository
time_to_first_reviewPercentileSurface
- The PercentileSurface schema
- ninteger · int640–∞
- truncatedbooleanWhether the window held more than 20,000 measurements, in which case the percentiles are computed over 20,000 of them and
nis that limit rather than the full count. - p50_secondsnumber · double or nulloptionalThe median, in seconds. Absent when the window held nothing to measure — which is different from a median of zero.
- p95_secondsnumber · double or nulloptional
time_to_mergePercentileSurface
- The PercentileSurface schema
- ninteger · int640–∞
- truncatedbooleanWhether the window held more than 20,000 measurements, in which case the percentiles are computed over 20,000 of them and
nis that limit rather than the full count. - p50_secondsnumber · double or nulloptionalThe median, in seconds. Absent when the window held nothing to measure — which is different from a median of zero.
- p95_secondsnumber · double or nulloptional
- tostring
200 exampleSynthesized example
{
"from": "from-1163",
"issue_cycle_time": {
"n": 73,
"truncated": false,
"p50_seconds": 64,
"p95_seconds": 18
},
"pipeline_duration": {
"n": 82,
"truncated": false,
"p50_seconds": 62,
"p95_seconds": 24
},
"scope": {
"full_path": "acme/payments-api",
"id": "id-5cd3",
"type": "group"
},
"time_to_first_review": {
"n": 69,
"truncated": false,
"p50_seconds": 84,
"p95_seconds": 35
},
"time_to_merge": {
"n": 0,
"truncated": false,
"p50_seconds": 64,
"p95_seconds": 1
},
"to": "to-6d85"
}
400Malformed or oversized windowapplication/json
Error codes
- BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-2231",
"message": "Pin a page's payload to the build that rendered it"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
- UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-acc4",
"message": "Pin a page's payload to the build that rendered it"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
- FORBIDDENYou are signed in but may not do this here;
reasonnames the permission or the rule that refused it - INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs;
required_scopenames it - PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-6e35",
"message": "Label every synthesized example"
}
}
404No such repository, or it is not visible to the callerapplication/json
Error codes
- NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-2201",
"message": "Pin a page's payload to the build that rendered it"
}
}
CLI
gitmoap insights get-repo-cycle-time
- --repo-ididThe repository's id (id or owner/repo path)
- --fromstringoptionalYYYY-MM-DD start of the window
- --tostringoptionalYYYY-MM-DD end, inclusive