
Get AI commit details with the AI Code Tracking API
Retrieve blame annotations and referenced conversation metadata for one or more commits with GET https://api.cursor.com/analytics/ai-code/commits/:commitHash. Official reference: AI Code Tracking API → Get Commit Details.
This endpoint is in limited alpha and available only to select users. Response shapes may change. Authenticate with a team API key (Basic auth, key as username, empty password — same method as the Admin API). Create keys at cursor.com/dashboard → API Keys with scope admin:*. Broader AI Code Tracking availability is Enterprise only (contact sales). Rate limit: 20 requests per minute per endpoint. Metrics cover the git repository at the top level of the workspace root; multi-root workspaces are unsupported.
Path and query
| Field | Rules |
|---|---|
commitHash (path) |
Single hash, or comma-separated list (abc123,def456) |
branch (query) |
Optional branch name filter |
Response shape is the same for one hash or many: an object with commits and conversations arrays.
Single commit
curl -X GET "https://api.cursor.com/analytics/ai-code/commits/0aabf603dc906e05bf5e4d9fd423fdd517f2e43f?branch=main" \
-u YOUR_API_KEY:
Multiple commits
curl -X GET "https://api.cursor.com/analytics/ai-code/commits/abc123,def456,ghi789" \
-u YOUR_API_KEY:
Example response:
{
"commits": [
{
"commitHash": "0aabf603dc906e05bf5e4d9fd423fdd517f2e43f",
"commitSource": "ide",
"rangeAnnotations": [
{
"filePath": "src/analytics/report.ts",
"groups": [
{
"conversationId": "conv_abc123",
"model": "gpt-4o",
"operationType": "insert",
"ranges": [
{ "start": 10, "end": 25 },
{ "start": 42, "end": 58 }
]
}
]
}
]
}
],
"conversations": [
{
"id": "conv_abc123",
"title": "Refactor analytics module",
"tldr": "Extracted report generation into separate functions",
"overview": "Refactored the analytics module to improve maintainability by extracting report generation logic.",
"summaryBullets": [
"Created dedicated report generator class",
"Added unit tests for new functions",
"Updated imports across affected files"
]
}
]
}
Response fields
| Field | Type | Meaning |
|---|---|---|
commits |
array | Commit objects with blame annotations |
commits[].commitSource |
"ide" | "cli" | "cloud" |
Where the commit originated |
commits[].rangeAnnotations |
array | File-level blame data |
commits[].rangeAnnotations[].filePath |
string | Path inside the repo |
commits[].rangeAnnotations[].groups |
array | Annotation groups |
groups[].conversationId |
string | null | Conversation that generated the code |
groups[].model |
string | null | Model used |
groups[].operationType |
string | Operation type (for example insert) |
groups[].ranges |
array | Line ranges (start, end) |
conversations |
array | Metadata for every referenced conversation |
conversations[].id |
string | Conversation id (matches conversationId on groups) |
conversations[].title / tldr / overview |
string | null | Title and summaries |
conversations[].summaryBullets |
array | null | Bullet summary points |
Join with usage events
conversationId on annotation groups is the Agent session id. Join it with conversationId on rows from Get filtered usage events when you need cost / token rows for the same session.
Pitfalls
- Calling without limited-alpha access — expect failures until Cursor enables the route for your team.
- Treating the response as a single commit object — even one hash returns
{ commits, conversations }. - Assuming every group has a
conversationId— the field can be null. - Multi-root workspaces — only the top-level git repo is covered.
- Alpha churn on blame / conversation fields — pin docs before automating.
Aggregated commit lines: Get AI commit metrics. Accepted changes without a commit: Get AI code change metrics.