Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.qoder.com/llms.txt

Use this file to discover all available pages before exploring further.

About this document

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

  • Valid API key (Authorization: Bearer <api_key>) for the organization.

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):
ParameterTypeDescription
start_datestringStart time; supports RFC 3339 format or Unix millisecond timestamp
end_datestringEnd time; supports RFC 3339 format or Unix millisecond timestamp
repo_namestringFilter by repository name
primary_branch_onlystringSet to true to count primary branch only
user_idstringFilter by user ID
file_extensionsstringFilter 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; specifically:
ParameterRequiredDescription
start_dateYesStart time
end_dateYesEnd time
Both start_date and end_date are required; the time range must not exceed 90 days.

Success response (200 OK)

{
  "committedTotalLinesEdit": 50000,
  "committedAiLinesEdit": 15000,
  "acceptedLinesEdit": 18000,
  "aiShareRate": 30.0,
  "agentEditCount": 1200,
  "tabCompletionCount": 5600,
  "messageCount": 3400
}

Response fields

FieldTypeDescription
committedTotalLinesEditint64Total committed lines edited (added + deleted)
committedAiLinesEditint64AI-edited lines in committed code (added + deleted)
acceptedLinesEditint64Accepted AI-edited lines (added + deleted)
aiShareRatefloat64AI code share (percentage)
agentEditCountint64Agent edit count
tabCompletionCountint64Tab completion count
messageCountint64Chat 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; specifically:
ParameterRequiredDescription
start_dateYesStart time
end_dateYesEnd time
Both start_date and end_date are required; the time range must not exceed 90 days.

Success response (200 OK)

{
  "items": [
    {
      "date": "2025-06-01T00:00:00Z",
      "aiLinesAdded": 500,
      "otherLinesAdded": 1500,
      "aiShareRate": 25.0,
      "commitCount": 30
    }
  ],
  "extItems": [
    {
      "date": "2025-06-01T00:00:00Z",
      "fileExtension": ".go",
      "totalLinesAdded": 800,
      "aiLinesAdded": 300
    }
  ],
  "nextItems": [
    {
      "date": "2025-06-01T00:00:00Z",
      "nextSuggestedCount": 200,
      "nextAcceptedCount": 120,
      "nextAcceptRate": 60.0
    }
  ]
}

Response fields

items[] — AI code share trend (Chart 1)
FieldTypeDescription
datestringDate (ISO 8601)
aiLinesAddedint64AI lines added
otherLinesAddedint64Non-AI lines added
aiShareRatefloat64AI code share (percentage)
commitCountint64Commit count
extItems[] — Agent code by language trend (Chart 2)
FieldTypeDescription
datestringDate (ISO 8601)
fileExtensionstringFile extension
totalLinesAddedint64Total lines added
aiLinesAddedint64AI lines added
nextItems[] — Tab completion acceptance rate trend (Chart 3)
FieldTypeDescription
datestringDate (ISO 8601)
nextSuggestedCountint64Suggestion count
nextAcceptedCountint64Acceptance count
nextAcceptRatefloat64Acceptance 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; specifically:
ParameterRequiredDescription
start_dateYesStart time
end_dateYesEnd time
Both start_date and end_date are required; the time range must not exceed 90 days.
Additionally supported:
ParameterTypeRequiredDefaultDescription
limitintegerNo10Maximum number of members to return

Success response (200 OK)

{
  "items": [
    {
      "userId": "user_abc123",
      "email": "alice@example.com",
      "displayName": "Alice",
      "totalLinesAdded": 5000,
      "aiLinesAdded": 2000,
      "aiShareRate": 40.0,
      "commitCount": 50
    }
  ]
}

Response fields

FieldTypeDescription
itemsarrayMember ranking list
items[].userIdstringUser ID
items[].emailstringMember email (may be empty)
items[].displayNamestringDisplay name (may be empty)
items[].totalLinesAddedint64Total lines added
items[].aiLinesAddedint64AI lines added
items[].aiShareRatefloat64AI code share (percentage)
items[].commitCountint64Commit count

4. List repositories

GET /v1/organizations/{organization_id}/ai-code/repos List repositories in the organization with AI code activity.

Path parameters

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

ParameterTypeRequiredDefaultDescription
start_datestringNoStart time
end_datestringNoEnd time
querystringNoSearch by repository name
pageintegerNo1Page number (starting from 1)
per_pageintegerNo30Items per page, max 100

Success response (200 OK)

{
  "repos": [
    {
      "repoName": "my-project",
      "commitCount": 120,
      "totalLinesAdded": 8000
    }
  ],
  "totalCount": 42,
  "page": 1,
  "perPage": 30
}

Response fields

FieldTypeDescription
reposarrayRepository list
repos[].repoNamestringRepository name
repos[].commitCountint64Commit count
repos[].totalLinesAddedint64Total lines added
totalCountint32Total repository count
pageint32Current page number
perPageint32Items 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

ParameterTypeRequiredDescription
start_datestringNoStart time
end_datestringNoEnd time

Success response (200 OK)

{
  "fileExtensions": [
    {
      "extension": ".go",
      "changeCount": 500,
      "totalLinesAdded": 12000,
      "aiShareRate": 35.5
    }
  ]
}

Response fields

FieldTypeDescription
fileExtensionsarrayFile extension list
fileExtensions[].extensionstringFile extension
fileExtensions[].changeCountint64Change count
fileExtensions[].totalLinesAddedint64Total lines added
fileExtensions[].aiShareRatefloat64AI 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Request body (JSON)

FieldTypeRequiredDescription
commitHashesstring[]YesList of commit hashes (max 50)
branchstringNoBranch name (to scope the query)

Request example

{
  "commitHashes": ["abc123def456", "789ghi012jkl"],
  "branch": "main"
}

Success response (200 OK)

{
  "success": true,
  "data": {
    "commits": [
      {
        "commitHash": "abc123def456",
        "rangeAnnotations": [
          {
            "filePath": "src/main.go",
            "groups": [
              {
                "conversationId": "session-001",
                "source": "AGENT",
                "productType": "ide",
                "type": "added",
                "ranges": [
                  { "start": 47, "end": 48 },
                  { "start": 55, "end": 60 }
                ]
              }
            ]
          }
        ]
      },
      {
        "commitHash": "789ghi012jkl",

        "rangeAnnotations": [ ]

      }
    ]
  }
}

Response fields

FieldTypeDescription
successbooleanWhether the request succeeded
data.commitsarrayCommit details list (preserves request order)
data.commits[].commitHashstringCommit hash
data.commits[].rangeAnnotationsarrayFile-level AI attribution annotations
data.commits[].rangeAnnotations[].filePathstringFile path
data.commits[].rangeAnnotations[].groupsarrayAI session contribution groups
data.commits[].rangeAnnotations[].groups[].conversationIdstringAI session ID
data.commits[].rangeAnnotations[].groups[].sourcestringSource: AGENT, NEXT, QUEST, INLINECHAT
data.commits[].rangeAnnotations[].groups[].productTypestringProduct type (lowercase, e.g., ide)
data.commits[].rangeAnnotations[].groups[].typestringType: added (added), deleted (deleted)
data.commits[].rangeAnnotations[].groups[].rangesarrayLine range list
data.commits[].rangeAnnotations[].groups[].ranges[].startint32Start line number
data.commits[].rangeAnnotations[].groups[].ranges[].endint32End line number

Usage examples

Get stats overview

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code/stats/overview?start_date=2025-06-01T00:00:00Z&end_date=2025-06-30T23:59:59Z" \
  -H "Authorization: Bearer <api_key>"

Get daily trend (specific repo, primary branch)

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code/stats/daily-trend?start_date=2025-06-01T00:00:00Z&end_date=2025-06-30T23:59:59Z&repo_name=my-project&primary_branch_only=true" \
  -H "Authorization: Bearer <api_key>"

Get member ranking (top 20)

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code/stats/member-ranking?start_date=2025-06-01T00:00:00Z&end_date=2025-06-30T23:59:59Z&limit=20" \
  -H "Authorization: Bearer <api_key>"

Search repositories

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code/repos?query=my-project" \
  -H "Authorization: Bearer <api_key>"

Get file extension statistics

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code/file-extensions?start_date=2025-06-01T00:00:00Z" \
  -H "Authorization: Bearer <api_key>"

Get commit AI attribution details

curl -X POST "https://api.qoder.com/v1/organizations/org_xxx/ai-code-tracking/commits/detail" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"commitHashes": ["abc123def456", "789ghi012jkl"], "branch": "main"}'

Error codes

Error codeHTTP statusDescription
BadRequest400Invalid request parameters (e.g., missing start_date / end_date, time range exceeds 90 days, commitHashes empty or exceeds 50)
Unauthorized401API key missing or invalid
Forbidden403No permission to access this organization
InternalError500Internal server error
Error response shape: see Error responses in Conventions.

AI Code Tracking API

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

LayerMeaningSourceAvailable filter dimensions
CommitGit commitCode repository (pushed to remote)Time, user, repository
ChangeAI code edit event in IDEReported from IDE client (not yet a Git commit)Time, user, source
Changes are IDE events not yet committed to Git, so they do not have repoName / branchName dimensions.

Product × scenario breakdown (commit level)

Each commit record contains 12 pairs of linesAdded / linesDeleted columns, broken down by “product × scenario”:
Field prefixProductScenario
ideNextIDE (VS Code)Tab completion (next)
pluginNextJetBrains PluginTab completion (next)
ideAgentIDE (VS Code)Agent
pluginAgentJetBrains PluginAgent
cliAgentCLIAgent
ideQuestIDE (VS Code)Quest
ideInlineChatIDE (VS Code)Inline Chat
jbInlineChatJetBrains PluginInline Chat
nonAiNon-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 userEmail where available
  • Filter by email: Supports userEmail query 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:
ParameterTypeRequiredDefaultDescription
startDatestringNoStart 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
endDatestringNoCurrent timeEnd time; supports RFC 3339 format or Unix millisecond timestamp
userIdstringNoFilter by user UUID
userEmailstringNoFilter by user email (server resolves to the corresponding user identifier)
pageintegerNo1Page number (starting from 1)
pageSizeintegerNo100Items per page, max 200
When both userId and userEmail are provided, userId takes 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; additionally:
ParameterTypeRequiredDescription
repoNamestringNoFilter by repository name

Success response (200 OK)

{
  "success": true,
  "data": {
    "items": [
      {
        "commitHash": "a1b2c3d4e5f6",
        "userId": "550e8400-e29b-41d4-a716-446655440000",
        "userEmail": "alice@example.com",
        "repoName": "my-project",
        "branchName": "main",
        "isPrimaryBranch": true,
        "totalLinesAdded": 120,
        "totalLinesDeleted": 30,
        "ideNextLinesAdded": 40,
        "ideNextLinesDeleted": 10,
        "pluginNextLinesAdded": 0,
        "pluginNextLinesDeleted": 0,
        "ideAgentLinesAdded": 50,
        "ideAgentLinesDeleted": 15,
        "pluginAgentLinesAdded": 0,
        "pluginAgentLinesDeleted": 0,
        "cliAgentLinesAdded": 0,
        "cliAgentLinesDeleted": 0,
        "ideQuestLinesAdded": 10,
        "ideQuestLinesDeleted": 0,
        "ideInlineChatLinesAdded": 5,
        "ideInlineChatLinesDeleted": 2,
        "jbInlineChatLinesAdded": 0,
        "jbInlineChatLinesDeleted": 0,
        "nonAiLinesAdded": 15,
        "nonAiLinesDeleted": 3,
        "message": "feat: add user login",
        "commitTs": "2025-06-15T10:30:00Z",
        "createdAt": "2025-06-15T10:35:00Z"
      }
    ],
    "pagination": {
      "currentPage": 1,
      "pageSize": 100,
      "totalItems": 256,
      "totalPages": 3
    }
  }
}

Response fields

successtrue indicates the request succeeded data.items[] — Commit detail list
FieldTypeDescription
commitHashstringGit commit SHA
userIdstringUser UUID
userEmailstringUser email (may be empty)
repoNamestringRepository name
branchNamestringBranch name
isPrimaryBranchbooleanWhether it is the primary branch
totalLinesAddedintegerTotal lines added
totalLinesDeletedintegerTotal lines deleted
ideNextLinesAddedintegerIDE Tab completion lines added
ideNextLinesDeletedintegerIDE Tab completion lines deleted
pluginNextLinesAddedintegerJetBrains Plugin Tab completion lines added
pluginNextLinesDeletedintegerJetBrains Plugin Tab completion lines deleted
ideAgentLinesAddedintegerIDE Agent lines added
ideAgentLinesDeletedintegerIDE Agent lines deleted
pluginAgentLinesAddedintegerJetBrains Plugin Agent lines added
pluginAgentLinesDeletedintegerJetBrains Plugin Agent lines deleted
cliAgentLinesAddedintegerCLI Agent lines added
cliAgentLinesDeletedintegerCLI Agent lines deleted
ideQuestLinesAddedintegerIDE Quest lines added
ideQuestLinesDeletedintegerIDE Quest lines deleted
ideInlineChatLinesAddedintegerIDE Inline Chat lines added
ideInlineChatLinesDeletedintegerIDE Inline Chat lines deleted
jbInlineChatLinesAddedintegerJetBrains Inline Chat lines added
jbInlineChatLinesDeletedintegerJetBrains Inline Chat lines deleted
nonAiLinesAddedintegerNon-AI lines added
nonAiLinesDeletedintegerNon-AI lines deleted
messagestringCommit message (may be empty)
commitTsstringCommit time (ISO 8601)
createdAtstringRecord creation time (ISO 8601)
data.pagination — Pagination info
FieldTypeDescription
currentPageintegerCurrent page number
pageSizeintegerItems per page
totalItemsintegerTotal record count
totalPagesintegerTotal 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; additionally:
ParameterTypeRequiredDescription
repoNamestringNoFilter by repository name

Success response (200 OK)

  • Content-Type: text/csv; charset=utf-8
  • Content-Disposition: attachment; filename="ai-code-commits.csv"
CSV column headers (note: CSV retains userName; JSON responses have removed it):
commitHash,userId,userEmail,userName,repoName,branchName,isPrimaryBranch,
totalLinesAdded,totalLinesDeleted,
ideNextLinesAdded,ideNextLinesDeleted,pluginNextLinesAdded,pluginNextLinesDeleted,
ideAgentLinesAdded,ideAgentLinesDeleted,pluginAgentLinesAdded,pluginAgentLinesDeleted,
cliAgentLinesAdded,cliAgentLinesDeleted,ideQuestLinesAdded,ideQuestLinesDeleted,
ideInlineChatLinesAdded,ideInlineChatLinesDeleted,jbInlineChatLinesAdded,jbInlineChatLinesDeleted,
nonAiLinesAdded,nonAiLinesDeleted,message,commitTs,createdAt

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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; additionally:
ParameterTypeRequiredDescription
sourcestringNoFilter by usage scenario. Values: AGENT, NEXT, QUEST, INLINECHAT

Success response (200 OK)

{
  "success": true,
  "data": {
    "items": [
      {
        "changeId": "chg_abc123",
        "userId": "550e8400-e29b-41d4-a716-446655440000",
        "userEmail": "alice@example.com",
        "source": "AGENT",
        "model": "efficient",
        "totalLinesAdded": 45,
        "totalLinesDeleted": 12,
        "metadata": [
          {
            "fileName": "main.go",
            "fileExtension": ".go",
            "linesAdded": 30,
            "linesDeleted": 8
          },
          {
            "fileName": "utils.go",
            "fileExtension": ".go",
            "linesAdded": 15,
            "linesDeleted": 4
          }
        ],
        "createdAt": "2025-06-15T10:28:00Z"
      }
    ],
    "pagination": {
      "currentPage": 1,
      "pageSize": 100,
      "totalItems": 1024,
      "totalPages": 11
    }
  }
}

Response fields

successtrue indicates the request succeeded data.items[] — Change detail list
FieldTypeDescription
changeIdstringUnique change event identifier
userIdstringUser UUID
userEmailstringUser email (may be empty)
sourcestringUsage scenario (uppercase): NEXT, AGENT, QUEST, INLINECHAT
modelstringModel tier: lite, efficient, auto (may be empty)
totalLinesAddedintegerTotal lines added
totalLinesDeletedintegerTotal lines deleted
metadataarrayFile-level change details (may be empty)
metadata[].fileNamestringFile name
metadata[].fileExtensionstringFile extension
metadata[].linesAddedintegerFile lines added
metadata[].linesDeletedintegerFile lines deleted
createdAtstringEvent time (ISO 8601)
data.pagination — Pagination info
FieldTypeDescription
currentPageintegerCurrent page number
pageSizeintegerItems per page
totalItemsintegerTotal record count
totalPagesintegerTotal 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

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

See “Common query parameters”; additionally:
ParameterTypeRequiredDescription
sourcestringNoFilter 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"
CSV column headers:
changeId,userId,userEmail,source,model,totalLinesAdded,totalLinesDeleted,createdAt

Usage examples

Query commit details (filter by repo)

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code-tracking/commits?startDate=2025-06-01T00:00:00Z&endDate=2025-06-30T23:59:59Z&repoName=my-project&pageSize=50" \
  -H "Authorization: Bearer <api_key>"

Query user commits by email

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code-tracking/commits?startDate=2025-06-01T00:00:00Z&userEmail=alice@example.com" \
  -H "Authorization: Bearer <api_key>"

Export commit CSV

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code-tracking/commits/export?startDate=2025-06-01T00:00:00Z" \
  -H "Authorization: Bearer <api_key>" \
  -o ai-code-commits.csv

Query change details (filter by source)

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code-tracking/changes?startDate=2025-06-01T00:00:00Z&source=QUEST&pageSize=50" \
  -H "Authorization: Bearer <api_key>"

Export change CSV

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/ai-code-tracking/changes/export?startDate=2025-06-01T00:00:00Z" \
  -H "Authorization: Bearer <api_key>" \
  -o ai-code-changes.csv

Error codes

Error codeHTTP statusDescription
Unauthorized401API key missing or invalid
Forbidden403No permission to access this organization
BadRequest400Invalid request parameters (e.g., organization_id / userId is not a valid UUID)
InternalError500Internal server error
Error response shape: see Error responses in Conventions.