| agg | string | no | avg (default), p50, or p90 - percentiles only apply to distribution-backed metrics (cycle_time_hrs, review_wait_hrs, pr_size_lines, ci_duration_mins, reviews_per_pr, approval_to_merge_hrs, review_request_to_first_review_hrs, draft_duration_hrs, ci_runs_per_pr, rework_lines, time_to_green_hrs, ci_duration_by_check_mins) |
| fill | boolean | null | no | Default true: group_by day or week returns every calendar bucket in the range, with value null (or 0 for pr_count and ci_wasted_mins_by_check) where nothing qualified. false returns only the buckets that have data. No effect on other group_by values or on split |
| from | string | no | Custom range start, ISO 8601 date (e.g. 2026-01-01) - requires to, mutually exclusive with range |
| group_by | string | yes | day, week, repo, or team - plus check_name, valid only for ci_flakiness_rate, ci_failure_rate_by_check, ci_duration_by_check_mins, and ci_wasted_mins_by_check - plus origin or agent, valid only for PR metrics (origin: see origin; agent: one bucket per AI agent named in get_ai_detection, plus multiple when a PR matches more than one agent, covering AI PRs only and not combinable with origin or split) |
| limit | integer | no | Max series points returned. Default is unbounded (every matching bucket). Same group_by-dimension-only restriction as sort |
| metric | string | yes | cycle_time_hrs, review_wait_hrs, pr_count, pr_size_lines, ci_duration_mins, ci_success_rate, merged_pr_rate, self_merge_rate, reviews_per_pr, approval_to_merge_hrs, review_request_to_first_review_hrs, draft_duration_hrs, stale_review_request_rate, ci_runs_per_pr, force_push_rate, rework_lines, ci_flakiness_rate, time_to_green_hrs, ci_failure_rate_by_check, ci_duration_by_check_mins, or ci_wasted_mins_by_check |
| order | string | no | asc or desc, default desc. Same group_by-dimension-only restriction as sort |
| org_id | integer | yes | Sourcebee org ID to query |
| origin | string | no | ai, automation, or unclassified - restrict a PR metric to PRs of that origin. ai means the PR's author login, head branch or a label matches an AI agent's patterns (get_ai_detection); automation means a bot author that is not AI (dependabot, renovate); unclassified is everyone else, people and any AI the patterns missed, so it is NOT a measure of human work. Every point then carries count, the PRs behind the value; treat a small count as noise. Not valid with split, group_by=origin or group_by=agent, and not valid for CI metrics |
| range | string | no | 7d, 30d, or 90d - mutually exclusive with from/to; exactly one of range or from+to is required |
| repo_id | array | null | no | Filter to any of these repo IDs |
| sort | string | no | value, count, or bucket - only valid when group_by is repo, team, check_name, origin or agent (400s combined with day/week, whose time order pagination would otherwise break). sort=count is valid for ci_failure_rate_by_check and ci_flakiness_rate (the CI metrics with a count denominator) and for PR metrics (the PRs behind each value) when origin, split or group_by=origin|agent is set. Omit for the default order (bucket ascending for day/week, value descending for dimension group_bys) |
| split | string | no | origin - return one series per origin in a single response, each point tagged with origin and count. Works with any group_by except origin; with repo or team, sort may only be bucket or count and start/limit page over buckets. PR metrics only |
| start | integer | no | Pagination offset into the sorted series (default 0). Same group_by-dimension-only restriction as sort |
| team_id | array | null | no | Filter to repos owned by any of these teams |
| to | string | no | Custom range end, ISO 8601 date, inclusive - requires from, mutually exclusive with range |