Skip to content
GitmoapAPIBeta
Organizeinsights
GET/repositories/{repo_id}/insights

Get one repository's flow metrics over a window

get_repo_insights
  • insights:read
    A token needs the insights:read scope: Read flow metrics and cycle times for repositories and namespacesGranted by mcp_agent, mcp_agent_write, read_api, write_api.Every operation this scope unlocks

Throughput totals, mean durations and a series bucketed by day, week or month over a window of whole days (UTC; the last 30 by default, at most 366), plus DORA figures: release frequency and the median merge lead time. Change-failure rate and time to restore are left empty, with the reason. 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
  • granularitystringoptionalday | week | month (default: day)

Responses

200Throughput, means, a bucketed series and DORAapplication/json
  • doraDoraSummary
    • The DoraSummary schema
    • unavailableobjectFor each metric above that is never reported, its field name and the reason — as opposed to a metric that is null only because this window had no data.
    • change_failure_rateRatePair or nulloptionalNot reported: it needs deployment records. unavailable gives the reason.
    • merge_lead_time_seconds_p50number · double or nulloptionalThe median time from a merge request's creation to its merge, in seconds. Narrower than commit-to-production lead time.
    • release_frequency_per_weeknumber · double or nulloptionalPublished, non-draft releases per week over the window.
    • time_to_restore_secondsnumber · double or nulloptionalNot reported: it needs to know when service was degraded. unavailable gives the reason.
  • fromstring
  • granularityGranularitydayweekmonthHow a series is bucketed.
  • meansInsightMeans
    • The InsightMeans schema
    • run_duration_secondsnumber · double or nulloptional
    • time_to_first_review_secondsnumber · double or nulloptional
    • time_to_merge_secondsnumber · double or nulloptional
  • scopeActivityScope
  • seriesarray of InsightBucket
    • The InsightBucket schema
    • datestring
    • issues_closedinteger · int640–∞
    • issues_openedinteger · int640–∞
    • mrs_closedinteger · int640–∞
    • mrs_mergedinteger · int640–∞
    • mrs_openedinteger · int640–∞
    • pushesinteger · int640–∞
    • releases_publishedinteger · int640–∞
    • reviews_submittedinteger · int640–∞
    • runs_failedinteger · int640–∞
    • runs_succeededinteger · int640–∞
    • runs_totalinteger · int640–∞
  • tostring
  • totalsInsightTotals
    • The InsightTotals schema
    • active_contributorsinteger · int640–∞How many different people and service accounts contributed in the window.
    • issues_closedinteger · int640–∞
    • issues_openedinteger · int640–∞
    • mrs_closedinteger · int640–∞
    • mrs_mergedinteger · int640–∞
    • mrs_openedinteger · int640–∞
    • pushesinteger · int640–∞
    • releases_publishedinteger · int640–∞
    • reviews_submittedinteger · int640–∞
    • runsRunTotals
      • The RunTotals schema
      • failedinteger · int640–∞
      • succeededinteger · int640–∞
      • totalinteger · int640–∞
  • breakdown_truncatedbooleanoptionalWhether by_repository lists only the first 25 of the group's repositories. Absent when it lists them all.
  • by_repositoryarray of ScopeTotals or nulloptionalTotals per repository, for a group asked for with breakdown=repository; at most 25. breakdown_truncated says whether the group holds more.
    • The ScopeTotals schema
    • scopeActivityScope
    • totalsInsightTotals
      • The InsightTotals schema
      • active_contributorsinteger · int640–∞How many different people and service accounts contributed in the window.
      • issues_closedinteger · int640–∞
      • issues_openedinteger · int640–∞
      • mrs_closedinteger · int640–∞
      • mrs_mergedinteger · int640–∞
      • mrs_openedinteger · int640–∞
      • pushesinteger · int640–∞
      • releases_publishedinteger · int640–∞
      • reviews_submittedinteger · int640–∞
200 exampleSynthesized example
{
"dora": {
"unavailable": {},
"change_failure_rate": {
"denominator": 79,
"numerator": 46
},
"merge_lead_time_seconds_p50": 65,
"release_frequency_per_week": 30,
"time_to_restore_seconds": 27
},
"from": "from-bb61",
"granularity": "day",
"means": {
"run_duration_seconds": 70,
"time_to_first_review_seconds": 72,
"time_to_merge_seconds": 86
},
"scope": {
"full_path": "acme/payments-api",
"id": "id-767d",
"type": "group"
},
"series": [
{
"date": "date-8590",
"issues_closed": 17,
"issues_opened": 42,
"mrs_closed": 6,
"mrs_merged": 5,
"mrs_opened": 79,
"pushes": 72,
"releases_published": 34,
"reviews_submitted": 14,
"runs_failed": 2,
"runs_succeeded": 47,
"runs_total": 5
}
],
"to": "to-93ea",
"totals": {
"active_contributors": 88,
"issues_closed": 67,
"issues_opened": 67,
"mrs_closed": 79,
"mrs_merged": 62,
"mrs_opened": 6,
"pushes": 16,
"releases_published": 86,
"reviews_submitted": 87,
"runs": {
"failed": 32,
"succeeded": 74,
"total": 6
}
},
"breakdown_truncated": false,
"by_repository": [
{
"scope": {
"full_path": "acme/payments-api",
"id": "id-b380",
"type": "group"
},
"totals": {
"active_contributors": 1,
"issues_closed": 47,
"issues_opened": 80,
"mrs_closed": 62,
"mrs_merged": 84,
"mrs_opened": 35,
"pushes": 60,
"releases_published": 79,
"reviews_submitted": 8,
"runs": {
"failed": 69,
"succeeded": 14,
"total": 2
}
}
},
{
"scope": {
"full_path": "acme/payments-api",
"id": "id-4f10",
"type": "group"
},
"totals": {
"active_contributors": 20,
"issues_closed": 89,
"issues_opened": 3,
"mrs_closed": 80,
"mrs_merged": 26,
"mrs_opened": 74,
"pushes": 38,
"releases_published": 72,
"reviews_submitted": 20,
"runs": {
"failed": 44,
"succeeded": 38,
"total": 4
}
}
}
]
}
400Malformed window or unknown granularityapplication/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 reason or code.
    • fieldstring or nulloptionalOn a 400 that 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 on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): 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-7f2f",
"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 reason or code.
    • fieldstring or nulloptionalOn a 400 that 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 on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): 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-f428",
"message": "Label every synthesized example"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
  • FORBIDDENYou are signed in but may not do this here; reason names the permission or the rule that refused it
  • INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs; required_scope names 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 reason or code.
    • fieldstring or nulloptionalOn a 400 that 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 on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): 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-69af",
"message": "Draw the region map from operation density"
}
}
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 reason or code.
    • fieldstring or nulloptionalOn a 400 that 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 on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): 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-5bd4",
"message": "Stream pipeline status into the run header"
}
}

CLI

gitmoap insights get-repo-insights

  • --repo-ididThe repository's id (id or owner/repo path)
  • --fromstringoptionalYYYY-MM-DD start of the window
  • --granularitystringoptionalday | week | month (default: day)
  • --tostringoptionalYYYY-MM-DD end, inclusive

Used in these guides