Skip to main content
Preview FeatureThe Analytics API is currently in preview and is available exclusively to Enterprise customers.
Important: Timezone and Data AvailabilityAll dates in requests and responses are interpreted and returned in UTC timezone. The most recent queryable date is “yesterday” (UTC), and data for the previous day becomes available at approximately 02:00 UTC each day.
Data FreshnessAnalytics metrics endpoints (DAU, usage, activity) are updated once daily. Data for a given day becomes available the following day at approximately 02:00 UTC. Budget override endpoints (get-user-budget-overrides, set-user-budget-overrides) read and write configuration in real time.

GET /analytics/v0/dau-count

Returns daily active user counts over a date range.

Query Parameters

Date Range Behavior

Constraints

Example Request

Example Response

Response Fields


GET /analytics/v0/dau

Returns the list of active users for a specific date. Supports pagination.

Query Parameters

Date Behavior

Pagination

To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

Example Request (First Page)

Example Response

Example Request (Next Page)

Response Fields

Each user has either user_email or service_account_name, never both.

GET /analytics/v0/daily-usage

Returns daily usage metrics for your organization over a date range. Days with no activity are omitted from the response.

Query Parameters

Date Range Behavior

Constraints

Example Request

Example Response

Response Fields


GET /analytics/v0/user-activity

Returns aggregated usage metrics per user over a date range. Users with no activity are omitted. Supports pagination.

Query Parameters

Date Range Behavior

Pagination

To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

Example Request

Example Response

Response Fields

Each user has either user_email or service_account_name, never both.

GET /analytics/v0/daily-user-activity-by-editor-language

Returns user activity metrics broken down by language and editor for a specific date. Supports pagination.

Query Parameters

Date Behavior

Pagination

To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

Example Request (First Page)

Example Response

Example Request (Next Page)

Response Fields

Each record has either user_email or service_account_name, never both. A single user may have multiple records if they used different language/editor combinations on the queried date.

GET /analytics/v0/credit-usage-by-user

Returns credit usage per user over a date range. Supports optional breakdowns by date and/or model. Supports pagination.

Query Parameters

Date Range Behavior

Unlike most Analytics API endpoints, this endpoint allows querying up to and including today’s date. Credit usage data is updated approximately every 90 minutes and may be up to 90 minutes out of date.

Dimensions

Use by_date and by_model to control how results are grouped: When a dimension is not requested, the corresponding field (date or model_name) is omitted from the response records.

Pagination

To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

Example Request (No Dimensions)

Example Response

Example Request (First Page, With Dimensions)

Example Response

Example Request (Next Page)

Response Fields

Each record has either user_email or service_account_name, never both.

POST /analytics/v0/cost-analytics

Returns cost and token usage analytics for your organization over a date range, with configurable group-by dimensions and time granularity. Supports pagination. Unlike the metrics endpoints above, this endpoint accepts a JSON request body (POST). Dates are YYYY-MM-DD strings in both requests and responses, and enum values are sent and returned as their string names.

Request Body (JSON)

Only the fields listed above are accepted. Any other top-level field is rejected with a 400 (invalid query parameters: <field>).

Group-By Dimensions

group_by_keys controls how results are grouped. Each requested dimension populates the corresponding field in data_points[].group_by_values:
Requesting COST_ANALYTICS_GROUP_BY_USER returns per-user identifying information (email or service account name) in the response. Ensure your use of this dimension complies with your organization’s data-handling policies.

Date Range Behavior

Pagination

To paginate through results:
  1. Make initial request (optionally with page_size)
  2. If pagination.has_more is true, use pagination.next_cursor as the cursor parameter
  3. Repeat until has_more is false

Constraints

Example Request

Example Response

Example Data Point (grouped by USER and RESOURCE)

When group_by_keys includes multiple dimensions, each data point’s group_by_values is populated for every requested dimension:

Response Fields

Within user_info, at most one of user_email, service_account_name, or bot_name is set; it may be unset for deleted or unresolvable accounts.

POST /analytics/v0/get-user-budget-overrides

Returns per-user budget overrides configured for the organization. Budget overrides are custom limits for individual users or service accounts that differ from the organization’s default per-user budget. Overrides for users no longer in the organization are silently omitted.

Request Body (JSON)

Constraints

Example Request

Example Response

Response Fields


POST /analytics/v0/set-user-budget-overrides

Sets per-user budget overrides for the organization in a single batch. To clear an override, set config.limit to an empty string. Uses partial-failure semantics: valid overrides are applied even if some entries in the batch fail. Failed entries are returned in the failures array.

Request Body (JSON)

Constraints

Example Request

Example Response (All Succeeded)

Example Response (Partial Failure)

Valid overrides in the batch were still applied. Only entries in failures were not.

Response Fields


Rate Limiting

The Analytics API enforces rate limits to ensure fair usage and system stability. When you exceed the rate limit, the API returns HTTP status code 429 Too Many Requests. Subsequent requests are blocked for approximately 10 seconds before new requests are accepted.

Best Practices

  1. Batch your requests: Instead of making many small requests, use larger date ranges (up to 90 days) to retrieve more data per request.
  2. Implement exponential backoff: If you receive a 429 response, wait before retrying. Start with a short delay and increase it with each consecutive failure.
  3. Cache responses: Most Analytics endpoints update only once daily, so cache responses and avoid re-fetching the same data within a 24-hour period. For /analytics/v0/credit-usage-by-user, which refreshes approximately every 90 minutes, use a shorter cache window of around 90 minutes. Budget override responses reflect real-time configuration and should not be cached long-term.
  4. Use pagination efficiently: When paginating through large result sets, process each page before requesting the next one rather than fetching all pages as fast as possible.
  5. Spread requests over time: If you need to make multiple API calls, distribute them evenly rather than sending them all at once.

Error Responses

The API returns standard HTTP status codes:

Example Error Response