API v1
Version 1 (v1) of the Analytics API provides programmatic access to the AI usage data for your organization. Use it to retrieve metrics on AI adoption, activity, credits consumption, and other metrics that may be relevant across your teams and tools.
The following groups of endpoints are available:
AI adoption and usage: Number of users who have AI enabled and active, quota consumption over time, and data on users who have hit their usage limits.
AI activity and impact: Data related to shown and accepted code suggestions and AI invocations.
AI credits consumption: AI credits consumption data for users in the organization.
Code provenance: Lines of code and estimated time saved attributable to AI.
API reference
AI adoption and usage
Get AI adoption metrics by date
Get AI adoption and usage data for the specified date range, grouped by date. The returned data includes both metrics by day and total numbers for the date range. Filters for userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get quota consumption metrics by date
Get quota consumption data for the specified date range, grouped by date. The consumption information includes both built-in quota and top-up AI credits. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get limit hit metrics by date
Get data about the number of users who hit their AI credit limits in the specified date range, grouped by date. Filters for userIds and userEmails are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get limit hit metrics by date and user
Get a cursor-paginated list of limit hits for each date and user within a specified date range. When sortKey is date (default), sorting is done by date first, then by user ID. When sortKey is email or userName, sorting is done by user email or username first, then by date. Filters for userIds and userEmails are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get limit hit metrics by credits consumed
Get a cursor-paginated list of users who hit their AI credit limits, sorted by the amount of AI credits consumed. The cursor encodes the last seen (creditsUsed, userId) pair. Filters for userIds and userEmails are applied together (the API returns only records that match all criteria). Use this endpoint to identify the consumers who used the most AI credits within the specified date range.
Request parameters
Responses
Get limit hit metrics by principal and date
Get a cursor-paginated list of limit hits for each date and principal within a specified date range. When sortKey is date (default), sorting is done by date first, then by principal ID. When sortKey is name, sorting is done by principal name first, then by date. Filters for principalIds and principalType are applied together (the API returns only records that match all criteria).
Request parameters
Responses
AI activity and impact
Get total AI activity and impact metrics
Get total AI activity and impact metrics. The metrics include suggested and accepted lines of code, as well as the number of invocations of AI tools. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get AI activity and impact metrics by date
Get AI activity and impact metrics for the specified date range, grouped by date. The metrics include suggested and accepted lines of code, as well as the number of invocations of AI tools. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get AI activity and impact metrics by date and tool
Get a detailed breakdown of AI activity (suggestions, acceptances, and invocations) grouped by both date and specific AI feature such as AI Assistant or Code Completion. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get AI activity and impact metrics by user
Get per-user AI activity and impact metrics for the specified date range. Each result item represents one specific combination of: a user, a date, and an AI tool. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
AI credits consumption
Get AI credits consumption data by user
Get a paginated list of total AI credits consumption for each user within the specified date range. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get AI credits consumption data by tool
Get AI credits usage data grouped by tool for the specified date range. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get AI credits consumption data by user and tool
Get a paginated list of AI credits consumption data per user and tool. Returns a breakdown of AI credits per tool per user, whereas the /api/v1/credits-usage/group-by/user.paged endpoint returns a single total per user. Filters for tool, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Code provenance
Get code provenance metrics by date and feature
Get the number of lines generated by humans or AI tools, and time saved by AI within a specified date range, grouped by date and feature. Filters for feature, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).
Request parameters
Responses
Get total code provenance metrics
Get the total number of lines generated by humans or AI tools, and time saved within a specified date range, grouped by feature. Filters for feature, userIds, userEmails, and ide are applied together (the API returns only records that match all criteria).