Before you start
- See Authentication for the keys each operation family accepts and Conventions for base URLs, pagination, errors, and rate limits.
- The curl examples read the key from
CODERABBIT_API_KEY. The CLI examples use thecoderabbit apicommand with a key file.
Choose an operation set
Use the organization Learnings operations to:
- Export Learnings to CSV.
- Read the Learnings of every organization in an SSO workspace at once with a workspace API token.
- Work with GitLab, Bitbucket, Azure DevOps, or self-hosted CodeRabbit.
- Create Learnings.
- Read usage statistics or the values you can filter by.
- Work through the MCP server.
List and export organization Learnings
-
Call List learnings for an organization. Its reference lists the filters: text search, file paths, repositories, authors, and recent use.
-
While
next_cursorisnâtnull, request the next page withcursorset to that value and the same filters. Results come newest first, up to 1,000 per page. -
To download a file instead, add
format=csv. The CSV columns match the JSON fields. A CSV response holds a single page of up tolimitrows and has no cursor, so use JSON when you expect more rows thanlimit. The CLI prints JSON only; download CSV with curl.
413; add filters or lower limit. With a workspace token, org_id selects one organization; without it, the response covers every organization in the workspace.
Update or delete organization Learnings
-
Take the Learningâs
idfrom the list. -
Call Update a learning (
PATCH /v1/learnings/{learning_id}) with the new text inlearning. With a workspace token, also sendorg_id. CodeRabbit trims the text and redacts recognized credentials before saving it. A204response means the update is saved. The CLI example reads the same body fromlearning.json. -
To remove a Learning, call Delete a learning (
DELETE /v1/learnings/{learning_id}), withorg_idin the query for a workspace token. Deletion is idempotent: it returns204even when the Learning is already gone, so a retry is safe.
learning:write permission, which the Read and Write level of the Learnings permission grants. If an update returns 500, send the same request again.
Create Learnings in the Knowledge Base
-
Call Save Learnings with a
learningsarray. Each item needsrepoOwner,repoName,learning, anduser. Addfile,startLine,endLine,pullRequest, orurlto tie the Learning to code. The CLI example reads the same body fromlearnings.json. -
Read
learning_idsin the response. Saving can create new Learnings or update matching ones, so an ID can belong to a Learning you saved before. Iflearning_idsisnull, donât send the request again to find the IDs; list the Learnings instead. -
Read a Learning with Read a saved Learning, change its text with Update a Learning (
PATCH /v1/knowledge/learnings/{learning_id}), or remove it with Delete a Learning (DELETE /v1/knowledge/learnings/{learning_id}).
Find and analyze Knowledge Base Learnings
- List saved Learnings returns numbered pages of up to 100 Learnings, sorted and filtered the way the Learnings page in the app does.
- Read available Learning filters returns the repository names, files, and users you can filter by.
- Read recorded Learning usage statistics returns four counts for the filters you pass: all Learnings, active Learnings, Learnings never used, and Learnings created this week.
- Export saved Learnings returns every matching Learning in one JSON response, without paging.
usage_count and last_used reflect the usage CodeRabbit recorded. Treat them as best effort, not as proof that a Learning was or wasnât applied. The key ownerâs Learnings permissions apply to every operation.
For errors and paging details, see Errors and Pagination.
Whatâs next
Learnings
Learn how CodeRabbit records Learnings, applies them in reviews, and scopes them to repositories.
Connect an MCP client
Connect an MCP client to manage Learnings with the same operations as tools.
Review instructions
Write lasting path-based review rules when a Learning isnât the right fit.