This feature is available exclusively as part of the Pro plan and is not included in the Lite plan. Please refer to our pricing page for more information about our plans and features.

Overview

Generate single-use reports instantly using the CodeRabbit API. On-demand reports are ideal for testing report formats or getting quick insights without setting up recurring schedules.
For a conceptual overview of reports in CodeRabbit, see Generate reports.
Recommended approach: Use Scheduled reports for regular monitoring. On-demand reports have limitations and don’t offer additional benefits over scheduled reports.

API access

CodeRabbit offers a way to generate on-demand reports using the CodeRabbit API. You will need an API Key to access the CodeRabbit API and generate an on-demand report.

Create an API key

1

Navigate to API Keys

Sign in to your CodeRabbit account and navigate to the API Keys page under ‘Organization Settings’ in the left sidebar
2

Create new key

Click on the Create API Key button and enter a name for the API Key
3

Save your key

Copy the API key, and keep it safe as it won’t be visible again
API Keys

Generate an on-demand report

Once you have the API key, pass it in the x-coderabbitai-api-key header when calling the API:
curl -X 'POST' \
  'https://api.coderabbit.ai/api/v1/report.generate' \
  -H 'accept: application/json' \
  -H 'x-coderabbitai-api-key: cr-xxxxxxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "2024-05-01",
    "to": "2024-05-15"
  }'

Sample response

JSON
[
  {
    "group": "Developer Activity",
    "report": "*Developer Activity*:\n\n 🟢 **Update README.md** [#10](https://gitlab.com/master-group123/sub-group/project1/-/merge_requests/10)\n• Summary: The change updates the project description and modifies a section header for clearer instructions.\n• Last activity: 1 day ago, mergeable\n• Insights:\n - :magnifying_glass: @user2 Suggested updating the wording to make it clearer"
  }
]
If you get a 401 UNAUTHORIZED error, check if you’re passing the right API key in the x-coderabbitai-api-key header

API schema

The on-demand report generation endpoints take in inputs as per the schema shown below:

API Reference

View complete API documentation and request/response schemas

What’s next