Before you start
- See Authentication for the keys each operation accepts and Conventions for base URLs, pagination, errors, and rate limits. The metrics exports are export and user-management operations, and they need the Enterprise plan. The usage, credit, budget, and report operations are product operations, which follow each featureâs access rules: reports, for example, follow your planâs reporting access. See Plans.
- The curl examples read the key from
CODERABBIT_API_KEY. The CLI examples use thecoderabbit apicommand with a key file.
Retry busy metrics requests
When a metrics request returns429 or 503, wait at least the Retry-After interval. Then send the same request again with the same cursor. Donât move to the next cursor after an error. Every page you request counts against the rate limit.
Export review metrics
-
Call Get PR metrics for organization with
start_dateandend_date.statusdecides whether the dates match merge dates, close dates, or both; merged pull requests are the default. -
To narrow the results, filter by repository or user. With a workspace token, add
org_idto read one organization; without it, the response covers every organization in the workspace. -
While
next_cursorisnâtnull, request the next page withcursorset to that value and the same dates and filters. A page holds up to 1,000 pull requests (limit). Pages follow the order in which CodeRabbit recorded the data, not merge dates, so a pull request recorded late can appear on a later page. Read every page before you treat the data as complete.
Download review metrics as CSV
Addformat=csv to download a file with one row per pull request. The nested coderabbit_comments object becomes flat columns, such as total_coderabbit_comments_posted and critical_comments_accepted, and the status and review_iterations columns follow merged_at. Data Export describes the other columns.
limit rows and has no cursor. If the file has as many rows as limit, split the date range into smaller windows, or use JSON. A file larger than 16 MiB returns 400 RESPONSE_TOO_LARGE; shorten the date range or add filters. The CLI prints JSON only, so download CSV with curl.
Read review comment metrics
Call Get review comment metrics for merged pull requests for finding-level data, such as trends by severity or category. Use review metrics for per-pull-request totals.- The dates select pull requests by merge date in UTC, whenever their comments were posted.
- Each nested comment entry is one finding. A comment URL can appear more than once when a comment holds several findings. Comment text isnât returned.
- The response is JSON only. Sending
formatorstatusreturns400. limitcounts pull requests, not comments. A page larger than 16 MiB returns413. One pull requestâs comments canât span pages, so lowerlimitor shorten the date range.
Read MCP server usage
Get MCP server usage by pull request measures how CodeRabbit used the MCP servers you connected to CodeRabbit for review context. It has nothing to do with the CodeRabbit MCP server that your own clients connect to. Each row is a merged, reviewed pull request that used MCP, with its servers and their tools nested. Join rows to review metrics onpr_url. The counts are best-effort usage telemetry.
Check usage and credits
-
Call Read current usage and permitted credit balances. It returns usage billing settings for the billing period, the review spending cap, the key ownerâs own usage in
callerUsage, and the credit balances the key owner can see. -
Check the
stateof each section. Anavailablesection holds values. Anunavailablesection has areason, such asforbiddenornot_supported; treat its values as unknown, not zero.
callerUsage counts only the reviews, spend, and waived amounts of the person who owns the key. For everyoneâs spend in the period, read spent_cents from the usage budget.
Read permitted credit balances returns only the credit balances. Credit balances and usage budgets need the key ownerâs role to include read access to Subscription and Billing, which Admins have; see Role-based access. Without it, the credit sections come back unavailable with the reason forbidden. These reads donât give the caller permission to spend.
Read usage budgets
Read current usage budget policy and consumption returns the budgetâsstatus, the default limit per member, when enforcement starts, the current period, and spent_cents, the workspaceâs total spend for the period. spent_cents is null unless the budget is active. member_usage_complete is false when part of the spend canât be attributed to a member.
Read paginated member usage budgets returns each memberâs spend, effective limit, and whether the member has an override, paged with page and page_size. The API reads budgets only; change them in the CodeRabbit app.
Amounts in the usage, credit, and budget responses are in US cents.
Schedule reports
The Reports operations manage the same reports as the CodeRabbit app.- Call Create an on-demand or scheduled report. Set
typetoWEEKLY(days of the week and a frequency in weeks),MONTHLY(days of the month), orONDEMAND(afromandtorange, generated once). Choose where CodeRabbit delivers it withplatform(SLACK,DISCORD,EMAIL, orTEAMS), and set filters, grouping, and apromptTemplateor your ownprompt. - Keep the returned
report_id. It identifies the report configuration; CodeRabbit delivers the generated report to the destination you chose. - Manage the report with Replace a recurring report configuration (weekly and monthly reports only), Enable or disable a report schedule, and Delete a report configuration. Read a report configuration returns the configuration, not report content or delivery status.
Whatâs next
Data Export
Look up what each exported review metrics column means.
Reports overview
Learn what CodeRabbit reports contain and how teams use them.
Handle responses
Review pagination, error formats, and rate limits shared by every operation.