Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
On-demand reporting docs
  • Loading branch information
Spikatrix committed Jul 9, 2024
commit 53cdb3692080733dd8b545ee0a202831f8bd143e
Binary file added docs/guides/images/api_keys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 44 additions & 3 deletions docs/guides/ondemand-reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,52 @@ This feature is in beta

:::

CodeRabbit offers a way to generate on-demand reports using the [API](https://api.coderabbit.ai/api/swagger/).
You will be able to use the API by creating an [API key](https://app.coderabbit.ai/settings/api-keys).
CodeRabbit offers a way to generate on-demand reports using the [CodeRabbit API](https://api.coderabbit.ai/api/swagger/).
You will need an API Key to access the CodeRabbit API and generate an on-demand report.

## Create an API key

On-demand report input schema:
Sign into your CodeRabbit account and navigate to the the [**API Keys**](https://app.coderabbit.ai/settings/api-keys) page under 'Organization Settings' in the left sidebar.
Click on the **Create API Key** button and enter a name for the API Key.
Copy the API key and keep it safe as it won't be visible again.

![API Keys](./images/api_keys.png)

## Generate an On-demand report

Once you have the API key, pass it in the `x-coderabbitai-api-key` header when calling the API:

```sh
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 output:

```sh
[
{
"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"
}
]
```


:::info

If you get a 401 UNAUTHORIZED error, check if you're passing the right API key in the `x-coderabbitai-api-key` header

:::

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

```mdx-code-block
<ReportSchema />
Expand Down