Skip to main content
In this quickstart you create an API key and make three calls: check which organization the key belongs to, list the repositories you can access, and read CodeRabbit’s review status for a pull request. It takes about five minutes.

Before you start

  • CodeRabbit is installed on a GitHub Cloud organization, and you know a pull request it reviewed.
  • You know your organization’s region: US if you sign in at app.coderabbit.ai, EU if you sign in at app.eu.coderabbit.ai.
  • You have curl, or the CodeRabbit CLI for the CLI examples. See CLI for the version that includes coderabbit api.

Create an API key

In the CodeRabbit app for your region, open API keys (US or EU) and create a key of type User, as Create a user or agentic key describes. If Type offers only Agentic, choose it: an agentic key works for every call on this page. Copy the key when you save it, because CodeRabbit shows it only once.

Set up your shell

Read the key into an environment variable without echoing it or writing it to your shell history:
Set the API host of the region where you created the key. The EU settings also point the CLI at the EU region; see Choose the region.
For the CLI, also save the key to a file that only you can read. --api-key-file passes the file to each command without changing your CLI sign-in:

Check the key

Ask the API who you are with Get the authenticated principal:
The response names the key, its owner’s role, and the CodeRabbit organization the key belongs to:
If you get 401 unauthenticated, the key is missing, mistyped, deleted, or expired, or CODERABBIT_API_HOST isn’t the host of the region where you created the key. If you get 404 not_found, the key belongs to an organization that isn’t on GitHub Cloud, or it’s a self-hosted instance key. See Errors for the other codes.

List your repositories

List repositories returns the repositories in the organization that you can access:
Each entry in data has an id, GitHub’s numeric repository ID, and a full_name such as acme/api. Copy the id of the repository that has your pull request. When next_page_token isn’t null, more repositories are available: see Pagination.

Read a pull request’s review status

Read review status takes the repository ID and the pull request number. Replace 123456789 and 42 with yours:
head_sha is the pull request’s current head commit. To read review.status and check whether it covers that commit, see Follow the review status. This call only reads the status; to start a review, see Request a review.

What’s next

Authenticate requests

Choose between user keys, agentic keys, and workspace API tokens, and keep them safe.

Handle responses

Learn the base URLs, identifiers, pagination styles, errors, and rate limits that every operation shares.

Request and read reviews

Request a CodeRabbit review and follow it until the current head is reviewed.