AI coding stats, rankings, repos, extensions, commit attribution, and detail/export APIs.
AI code metrics (aggregates) and AI code tracking (detail and CSV export). Pagination differs by section. Complete Get API Key first, then read Conventions.
Requirements
The AI Code Metrics API provides organization-level AI-assisted coding statistics, including code stats overview, daily trends, member rankings, repository lists, and file extension statistics.
The following parameters apply to all AI Code endpoints (required status varies by endpoint):
extItems[] — Agent code by language trend (Chart 2)
nextItems[] — Tab completion acceptance rate trend (Chart 3)
Error response shape: see Error responses in Conventions.
Beyond AI code metrics (aggregate stats), this section provides commit / change-level detail queries and CSV export. Authentication is the same:
The AI Code Tracking API provides commit-level and change-level per-record detail queries and CSV export capabilities, supplementing the AI Code Metrics (aggregate stats) above.
Each commit record contains 12 pairs of
The Tracking API uses offset-based pagination (
The following parameters apply to all Tracking endpoints:
data.pagination — Pagination info
The
data.pagination — Pagination info
Error response shape: see Error responses in Conventions.
- Valid API key (
Authorization: Bearer <api_key>) for the organization.
AI Code Metrics
Overview
The AI Code Metrics API provides organization-level AI-assisted coding statistics, including code stats overview, daily trends, member rankings, repository lists, and file extension statistics.
Key features
- Stats overview: Total AI contribution and share in committed code
- Daily trends: Daily AI code share, Agent code by language, Tab completion acceptance rate
- Member ranking: Rank members by AI code contribution
- Repository list: List repositories with AI code activity
- File extensions: AI code metrics by file type
- Commit details: Get commit-level AI code attribution details (file-level line range annotations)
Common query parameters
The following parameters apply to all AI Code endpoints (required status varies by endpoint):
| Parameter | Type | Description |
|---|---|---|
start_date | string | Start time; supports RFC 3339 format or Unix millisecond timestamp |
end_date | string | End time; supports RFC 3339 format or Unix millisecond timestamp |
repo_name | string | Filter by repository name |
primary_branch_only | string | Set to true to count primary branch only |
user_id | string | Filter by user ID |
file_extensions | string | Filter by file extension, comma-separated (e.g., .go,.ts) |
API list
1. Get AI code stats overview
GET /v1/organizations/{organization_id}/ai-code/stats/overview
Retrieve overall AI code statistics for the organization.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; specifically:| Parameter | Required | Description |
|---|---|---|
start_date | Yes | Start time |
end_date | Yes | End time |
Bothstart_dateandend_dateare required; the time range must not exceed 90 days.
Success response (200 OK)
Response fields
| Field | Type | Description |
|---|---|---|
totalLinesChanged | int64 | Total lines changed in committed code (added + deleted) |
aiLinesChanged | int64 | AI-edited lines in committed code (added + deleted) |
acceptedLinesChanged | int64 | Accepted AI-edited lines (added + deleted) |
committedTotalLinesEdit | int64 | Deprecated; scheduled for removal after January 31, 2027. Same value as totalLinesChanged |
committedAiLinesEdit | int64 | Deprecated; scheduled for removal after January 31, 2027. Same value as aiLinesChanged |
acceptedLinesEdit | int64 | Deprecated; scheduled for removal after January 31, 2027. Same value as acceptedLinesChanged |
aiShareRate | float64 | AI code share, aiLinesChanged / totalLinesChanged (percentage) |
agentEditCount | int64 | Agent edit count |
tabCompletionCount | int64 | Tab completion count |
messageCount | int64 | Chat message count |
2. Get AI code daily trend
GET /v1/organizations/{organization_id}/ai-code/stats/daily-trend
Retrieve daily trend data for AI code, including three datasets: AI code share trend, language distribution trend, and Tab completion acceptance rate trend.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; specifically:| Parameter | Required | Description |
|---|---|---|
start_date | Yes | Start time |
end_date | Yes | End time |
Bothstart_dateandend_dateare required; the time range must not exceed 90 days.
Success response (200 OK)
Response fields
items[] — AI code share trend (Chart 1)| Field | Type | Description |
|---|---|---|
date | string | Date (ISO 8601) |
totalLinesChanged | int64 | Total lines changed in committed code (added + deleted) |
aiLinesChanged | int64 | AI-edited lines in committed code (added + deleted) |
otherLinesChanged | int64 | Non-AI lines changed in committed code (added + deleted, floored at 0 per line) |
aiLinesAdded | int64 | Deprecated; scheduled for removal after January 31, 2027. Same value as aiLinesChanged |
otherLinesAdded | int64 | Non-AI lines added |
aiShareRate | float64 | AI code share, aiLinesChanged / totalLinesChanged (percentage) |
commitCount | int64 | Commit count |
| Field | Type | Description |
|---|---|---|
date | string | Date (ISO 8601) |
fileExtension | string | File extension |
totalLinesChanged | int64 | Total lines changed in committed code (added + deleted) |
aiLinesChanged | int64 | AI-edited lines in committed code (added + deleted) |
totalLinesAdded | int64 | Total lines added |
aiLinesAdded | int64 | Deprecated; scheduled for removal after January 31, 2027. Same value as aiLinesChanged |
| Field | Type | Description |
|---|---|---|
date | string | Date (ISO 8601) |
nextSuggestedCount | int64 | Suggestion count |
nextAcceptedCount | int64 | Acceptance count |
nextAcceptRate | float64 | Acceptance rate (percentage) |
3. Get member AI code ranking
GET /v1/organizations/{organization_id}/ai-code/stats/member-ranking
Retrieve organization member ranking by AI code contribution.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; specifically:| Parameter | Required | Description |
|---|---|---|
start_date | Yes | Start time |
end_date | Yes | End time |
BothAdditionally supported:start_dateandend_dateare required; the time range must not exceed 90 days.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit | integer | No | 10 | Maximum number of members to return |
Success response (200 OK)
Response fields
| Field | Type | Description |
|---|---|---|
items | array | Member ranking list |
items[].userId | string | User ID |
items[].email | string | Member email (may be empty) |
items[].displayName | string | Display name (may be empty) |
items[].totalLinesChanged | int64 | Total lines changed in committed code (added + deleted) |
items[].aiLinesChanged | int64 | AI-edited lines in committed code (added + deleted) |
items[].totalLinesAdded | int64 | Total lines added |
items[].aiLinesAdded | int64 | Deprecated; scheduled for removal after January 31, 2027. Same value as items[].aiLinesChanged |
items[].aiShareRate | float64 | AI code share, aiLinesChanged / totalLinesChanged (percentage) |
items[].commitCount | int64 | Commit count |
4. List repositories
GET /v1/organizations/{organization_id}/ai-code/repos
List repositories in the organization with AI code activity.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
start_date | string | No | — | Start time |
end_date | string | No | — | End time |
query | string | No | — | Search by repository name |
page | integer | No | 1 | Page number (starting from 1) |
per_page | integer | No | 30 | Items per page, max 100 |
Success response (200 OK)
Response fields
| Field | Type | Description |
|---|---|---|
repos | array | Repository list |
repos[].repoName | string | Repository name |
repos[].commitCount | int64 | Commit count |
repos[].totalLinesAdded | int64 | Total lines added |
totalCount | int32 | Total repository count |
page | int32 | Current page number |
perPage | int32 | Items per page |
5. List file extensions
GET /v1/organizations/{organization_id}/ai-code/file-extensions
List file extension statistics for AI code activity in the organization.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | string | No | Start time |
end_date | string | No | End time |
Success response (200 OK)
Response fields
| Field | Type | Description |
|---|---|---|
fileExtensions | array | File extension list |
fileExtensions[].extension | string | File extension |
fileExtensions[].changeCount | int64 | Change count |
fileExtensions[].totalLinesAdded | int64 | Total lines added |
fileExtensions[].aiShareRate | float64 | AI code share (percentage) |
6. Get commit AI attribution details
POST /v1/organizations/{organization_id}/ai-code-tracking/commits/detail
Batch retrieve commit-level AI code attribution details, including file-level line range annotations.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
commitHashes | string[] | Yes | List of commit hashes (max 50) |
branch | string | No | Branch name (to scope the query) |
Request example
Success response (200 OK)
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the request succeeded |
data.commits | array | Commit details list (preserves request order) |
data.commits[].commitHash | string | Commit hash |
data.commits[].rebaseType | string | How the commit was produced: amend, squash, fixup, pick, normal, cherry-pick, or "" (empty string) |
data.commits[].originalCommitIds | string[] | Original commit hashes replaced by this commit; omitted when the original commits cannot be traced |
data.commits[].rangeAnnotations | array | File-level AI attribution annotations |
data.commits[].rangeAnnotations[].filePath | string | File path |
data.commits[].rangeAnnotations[].groups | array | AI session contribution groups |
data.commits[].rangeAnnotations[].groups[].conversationId | string | AI session ID |
data.commits[].rangeAnnotations[].groups[].source | string | Source: AGENT, NEXT, QUEST, INLINECHAT |
data.commits[].rangeAnnotations[].groups[].productType | string | Product type (lowercase, e.g., ide) |
data.commits[].rangeAnnotations[].groups[].type | string | Type: added (added), deleted (deleted) |
data.commits[].rangeAnnotations[].groups[].ranges | array | Line range list |
data.commits[].rangeAnnotations[].groups[].ranges[].start | int32 | Start line number |
data.commits[].rangeAnnotations[].groups[].ranges[].end | int32 | End line number |
Usage examples
Get stats overview
Get daily trend (specific repo, primary branch)
Get member ranking (top 20)
Search repositories
Get file extension statistics
Get commit AI attribution details
Error codes
| Error code | HTTP status | Description |
|---|---|---|
BadRequest | 400 | Invalid request parameters (e.g., missing start_date / end_date, time range exceeds 90 days, commitHashes empty or exceeds 50) |
Unauthorized | 401 | API key missing or invalid |
Forbidden | 403 | No permission to access this organization |
InternalError | 500 | Internal server error |
AI Code Tracking
Beyond AI code metrics (aggregate stats), this section provides commit / change-level detail queries and CSV export. Authentication is the same: Authorization: Bearer <api_key>.
Before use, confirm that the organization has enabled the AI Code Data Analysis capability consistent with the console; if not enabled or unauthorized, the API may return 403 or similar errors—refer to the actual response. Fields and enums are based on the live API and OpenAPI definition; this document is for reference only.
Tracking capabilities
The AI Code Tracking API provides commit-level and change-level per-record detail queries and CSV export capabilities, supplementing the AI Code Metrics (aggregate stats) above.
Two-layer data model
| Layer | Meaning | Source | Available filter dimensions |
|---|---|---|---|
| Commit | Git commit | Code repository (pushed to remote) | Time, user, repository |
| Change | AI code edit event in IDE | Reported from IDE client (not yet a Git commit) | Time, user, source |
Changes are IDE events not yet committed to Git, so they do not haverepoName/branchNamedimensions.
Product × scenario breakdown (commit level)
Each commit record contains 12 pairs of linesAdded / linesDeleted columns, broken down by "product × scenario":
| Field prefix | Product | Scenario |
|---|---|---|
ideNext | IDE (VS Code) | Tab completion (next) |
pluginNext | JetBrains Plugin | Tab completion (next) |
ideAgent | IDE (VS Code) | Agent |
pluginAgent | JetBrains Plugin | Agent |
cliAgent | CLI | Agent |
ideQuest | IDE (VS Code) | Quest |
ideInlineChat | IDE (VS Code) | Inline Chat |
jbInlineChat | JetBrains Plugin | Inline Chat |
nonAi | — | Non-AI lines (unattributable) |
Key features
- Commit detail query: List commit-level AI code statistics (with product × scenario breakdown)
- Commit CSV export: Stream export all commit data
-
Change detail query: List IDE AI code edit events (filterable by
source) - Change CSV export: Stream export all change data
-
User email: Lists and exports populate
userEmailwhere available -
Filter by email: Supports
userEmailquery parameter to locate users
Pagination
The Tracking API uses offset-based pagination (page + pageSize), unlike the cursor-based pagination used by other endpoints. Responses include totalItems / totalPages for pagination display.
Common query parameters
The following parameters apply to all Tracking endpoints:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
startDate | string | No | — | Start time; supports RFC 3339 format or Unix millisecond timestamp. When omitted, the server constrains the queryable range by product policy (e.g., ~90 days max); actual behavior may vary |
endDate | string | No | Current time | End time; supports RFC 3339 format or Unix millisecond timestamp |
userId | string | No | — | Filter by user UUID |
userEmail | string | No | — | Filter by user email (server resolves to the corresponding user identifier) |
page | integer | No | 1 | Page number (starting from 1) |
pageSize | integer | No | 100 | Items per page, max 200 |
When bothuserIdanduserEmailare provided,userIdtakes precedence.
API list
1. List commit details
GET /v1/organizations/{organization_id}/ai-code-tracking/commits
List commit-level AI code statistics per record, ordered by commit time descending. Each record includes the product × scenario breakdown.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; additionally:| Parameter | Type | Required | Description |
|---|---|---|---|
repoName | string | No | Filter by repository name |
Success response (200 OK)
Response fields
success —true indicates the request succeeded
data.items[] — Commit detail list
| Field | Type | Description |
|---|---|---|
commitHash | string | Git commit SHA |
userId | string | User UUID |
userEmail | string | User email (may be empty) |
repoName | string | Repository name |
branchName | string | Branch name |
isPrimaryBranch | boolean | Whether it is the primary branch |
rebaseType | string | How the commit was produced: amend, squash, fixup, pick, normal, cherry-pick, or "" (empty string) |
originalCommitIds | string[] | Original commit hashes replaced by this commit, for client-side deduplication; omitted when the original commits cannot be traced |
totalLinesAdded | integer | Total lines added |
totalLinesDeleted | integer | Total lines deleted |
ideNextLinesAdded | integer | IDE Tab completion lines added |
ideNextLinesDeleted | integer | IDE Tab completion lines deleted |
pluginNextLinesAdded | integer | JetBrains Plugin Tab completion lines added |
pluginNextLinesDeleted | integer | JetBrains Plugin Tab completion lines deleted |
ideAgentLinesAdded | integer | IDE Agent lines added |
ideAgentLinesDeleted | integer | IDE Agent lines deleted |
pluginAgentLinesAdded | integer | JetBrains Plugin Agent lines added |
pluginAgentLinesDeleted | integer | JetBrains Plugin Agent lines deleted |
cliAgentLinesAdded | integer | CLI Agent lines added |
cliAgentLinesDeleted | integer | CLI Agent lines deleted |
ideQuestLinesAdded | integer | IDE Quest lines added |
ideQuestLinesDeleted | integer | IDE Quest lines deleted |
ideInlineChatLinesAdded | integer | IDE Inline Chat lines added |
ideInlineChatLinesDeleted | integer | IDE Inline Chat lines deleted |
jbInlineChatLinesAdded | integer | JetBrains Inline Chat lines added |
jbInlineChatLinesDeleted | integer | JetBrains Inline Chat lines deleted |
nonAiLinesAdded | integer | Non-AI lines added |
nonAiLinesDeleted | integer | Non-AI lines deleted |
message | string | Commit message (may be empty) |
commitTs | string | Commit time (ISO 8601) |
createdAt | string | Record creation time (ISO 8601) |
| Field | Type | Description |
|---|---|---|
currentPage | integer | Current page number |
pageSize | integer | Items per page |
totalItems | integer | Total record count |
totalPages | integer | Total page count |
2. Export commit CSV
GET /v1/organizations/{organization_id}/ai-code-tracking/commits/export
Export commit data in streaming CSV format. The server automatically handles pagination aggregation—callers do not need to paginate manually.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; additionally:| Parameter | Type | Required | Description |
|---|---|---|---|
repoName | string | No | Filter by repository name |
Success response (200 OK)
-
Content-Type:
text/csv; charset=utf-8 -
Content-Disposition:
attachment; filename="ai-code-commits.csv"
userName; JSON responses have removed it):
originalCommitIds column may contain multiple commit hashes joined with commas. It is empty when the original commits cannot be traced.
3. List change details
GET /v1/organizations/{organization_id}/ai-code-tracking/changes
List IDE AI code edit events (only action=suggested records), ordered by event time descending.
Changes are IDE events not yet committed to Git, so repoName filtering is not supported.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; additionally:| Parameter | Type | Required | Description |
|---|---|---|---|
source | string | No | Filter by usage scenario. Values: AGENT, NEXT, QUEST, INLINECHAT |
Success response (200 OK)
Response fields
success —true indicates the request succeeded
data.items[] — Change detail list
| Field | Type | Description |
|---|---|---|
changeId | string | Unique change event identifier |
userId | string | User UUID |
userEmail | string | User email (may be empty) |
source | string | Usage scenario (uppercase): NEXT, AGENT, QUEST, INLINECHAT |
model | string | Model tier: lite, efficient, auto (may be empty) |
totalLinesAdded | integer | Total lines added |
totalLinesDeleted | integer | Total lines deleted |
metadata | array | File-level change details (may be empty) |
metadata[].fileName | string | File name |
metadata[].fileExtension | string | File extension |
metadata[].linesAdded | integer | File lines added |
metadata[].linesDeleted | integer | File lines deleted |
createdAt | string | Event time (ISO 8601) |
| Field | Type | Description |
|---|---|---|
currentPage | integer | Current page number |
pageSize | integer | Items per page |
totalItems | integer | Total record count |
totalPages | integer | Total page count |
4. Export change CSV
GET /v1/organizations/{organization_id}/ai-code-tracking/changes/export
Export change data in streaming CSV format. The server automatically handles pagination aggregation—callers do not need to paginate manually.
CSV export uses a flat format and does not include metadata (file-level details).
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | Organization ID |
Query parameters
See "Common query parameters"; additionally:| Parameter | Type | Required | Description |
|---|---|---|---|
source | string | No | Filter by usage scenario. Values: AGENT, NEXT, QUEST, INLINECHAT |
Success response (200 OK)
-
Content-Type:
text/csv; charset=utf-8 -
Content-Disposition:
attachment; filename="ai-code-changes.csv"
Usage examples
Query commit details (filter by repo)
Query user commits by email
Export commit CSV
Query change details (filter by source)
Export change CSV
Error codes
| Error code | HTTP status | Description |
|---|---|---|
Unauthorized | 401 | API key missing or invalid |
Forbidden | 403 | No permission to access this organization |
BadRequest | 400 | Invalid request parameters (e.g., organization_id / userId is not a valid UUID) |
InternalError | 500 | Internal server error |