Analytics API
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 API comes in two different versions:
API v2 (version 2). The latest version of the API with the most up-to-date endpoints and functionalities.
API v1 (version 1). The original version of the Analytics API, available for compatibility. Note that this API version will be officially deprecated in the future.
API URL
Base URL
The base URL for all Analytics API requests is:
Endpoints
All API requests are made to Analytics API endpoints, such as:
The endpoint structure consists of the following elements:
Element | Value | Description |
|---|---|---|
Base URL |
| The base URL for all Analytics API requests. |
API version |
| The current API version prefix for all endpoints. |
Endpoint path |
| The specific resource within the Analytics API. |
Authentication
Requests to the Analytics API require an access token passed as a bearer token within the Authorization header. To get an access token, make sure to complete the following steps:
Create a service account to use for the Analytics API. Service accounts let application and service integrations and automations use account credentials that are not tied to a specific user but are specifically created for integration with an application or service. Each service account includes a client ID and client secret.
Follow the instructions on how client ID and client secret are exchanged for an access token. An access token is valid for 60 minutes, so this process needs to be repeated when the token expires.