curl --request GET \
--url https://api.coderabbit.ai/v1/learnings \
--header 'x-coderabbitai-api-key: <api-key>'import requests
url = "https://api.coderabbit.ai/v1/learnings"
headers = {"x-coderabbitai-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-coderabbitai-api-key': '<api-key>'}};
fetch('https://api.coderabbit.ai/v1/learnings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coderabbit.ai/v1/learnings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-coderabbitai-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.coderabbit.ai/v1/learnings"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-coderabbitai-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.coderabbit.ai/v1/learnings")
.header("x-coderabbitai-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coderabbit.ai/v1/learnings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-coderabbitai-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "<string>",
"learning": "<string>",
"repository_name": "<string>",
"author_username": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"usage_count": 123,
"organization_id": "<string>",
"organization_name": "<string>",
"repository_id": "<string>",
"author_id": "<string>",
"file": "<string>",
"source_url": "<string>",
"pull_request": 123,
"last_used_at": "2023-11-07T05:31:56Z"
}
],
"next_cursor": "<string>"
}Learnings
Programmatic access to an organization’s CodeRabbit learnings. Returns paginated JSON or a CSV download. Enterprise plan only. Mirrors the auth, rate-limit and response-size contract of the Metrics public API.
curl --request GET \
--url https://api.coderabbit.ai/v1/learnings \
--header 'x-coderabbitai-api-key: <api-key>'import requests
url = "https://api.coderabbit.ai/v1/learnings"
headers = {"x-coderabbitai-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-coderabbitai-api-key': '<api-key>'}};
fetch('https://api.coderabbit.ai/v1/learnings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coderabbit.ai/v1/learnings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-coderabbitai-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.coderabbit.ai/v1/learnings"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-coderabbitai-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.coderabbit.ai/v1/learnings")
.header("x-coderabbitai-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coderabbit.ai/v1/learnings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-coderabbitai-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "<string>",
"learning": "<string>",
"repository_name": "<string>",
"author_username": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"usage_count": 123,
"organization_id": "<string>",
"organization_name": "<string>",
"repository_id": "<string>",
"author_id": "<string>",
"file": "<string>",
"source_url": "<string>",
"pull_request": 123,
"last_used_at": "2023-11-07T05:31:56Z"
}
],
"next_cursor": "<string>"
}Filter Learnings
Text search performs a case-insensitive substring match against Learning text. You can also filter by up to 10 exact file paths or by usage state:- Active: used in the last 30 days.
- Never used: no recorded usage.
- Created this week: created in the last 7 days.
Repository access with a full path
Use the full repository path when selecting a repository by name. GitHub requiresowner/repository. GitLab requires the entire namespace, including every subgroup, such as group/platform/tools/repository. A short name such as repository is not unique. Paths match exactly and are case-sensitive, and URLs are not accepted.
The name-based request requires a user-scoped organization API key for GitHub Cloud or GitLab Cloud and that user’s connected provider account. The API identifies one active repository within the key’s organization and checks the connected user’s repository read permission before querying Learnings. It does not substitute organization administrator privileges or installation-wide access for the user’s permission.
Legacy organization keys, workspace keys, self-hosted requests, unsupported providers, missing user identities and ambiguous repository matches are rejected on this path. Denied or unverifiable access returns no Learnings. Verification failures do not fall back to a broader listing. An authorized repository can still return an empty page when no Learnings match the other filters.
Keep the same full path when following pagination. Authorization is checked again for each request. If you also supply repository IDs, they must include the verified repository ID. Stored historical names can differ after a rename, so an empty result does not prove that no relevant guidance exists.
CSV format
CSV responses use a flat structure with one row per Learning. For the complete list of CSV columns and field descriptions, see Data Export - Exported fields. For a guided overview of learnings, see the Learnings documentation.Authorizations
API key for authentication. You can create an API key from the CodeRabbit dashboard.
Headers
API key for authentication
Query Parameters
Workspace-scoped API tokens only. When provided, scopes learnings to that single git-provider organization within the token's workspace; when omitted, aggregates every organization in the workspace. Ignored for organization and self-hosted keys.
Comma-separated provider repository IDs (max 10).
"1027529638,987654321"
Comma-separated provider user IDs (max 10).
"87397876,12345678"
Case-insensitive substring search over learning text.
Comma-separated exact file paths (max 10).
"src/api.ts,src/auth.ts"
Filter by recent usage, zero usage, or creation in the last seven days.
total, active, never_used, created_this_week Comma-separated provider organization IDs (max 10). Self-hosted instances only.
"184456712,103539130"
Maximum number of records to return.
1 <= x <= 1000Pagination cursor returned as next_cursor on the previous page.
Response format. json (default) returns paginated JSON; csv returns a CSV download.
json, csv Was this page helpful?