This article provides access to Analytics API endpoints with the data and metrics available in the Tokens tab in Dashboard.
Check the generic variables needed to use the API.
| Method |
Path |
Description |
| GET |
/analytics/requests/number-of-tokens |
Returns the total number of tokens consumed. |
| GET |
/analytics/requests/average-tokens-per-request |
Provides the average number of input, output, and total tokens per request. |
| GET |
/analytics/requests/number-of-tokens-per-agent |
Provides the number of input, output, and total tokens grouped by agent and model. |
| GET |
/analytics/requests/number-of-tokens-per-day |
Returns the number of input, output, and total tokens used each day. |
All endpoints require authentication using one of the following:
- Authorization: Bearer $GEAI_APITOKEN
- Authorization: Bearer $OAuth_accesstoken
For $OAuth_accesstoken, you must also include the header: ProjectId: $GEAI_PROJECTID (otherwise, this and OrganizationId:$GEAI_ORGANIZATIONID headers are optional)
Some endpoints may require additional headers such as:
- Content-Type: application/json
Returns the total number of input, output, and total API Tokens for all requests, supporting usage and billing analysis.
| Name |
Type |
Description |
| startDate |
string |
Start date for the query (YYYY-MM-DD) |
| endDate |
string |
End date for the query (YYYY-MM-DD) |
- Method: GET
- Path: $BASE_URL/v1/analytics/requests/number-of-tokens
- Body: Empty
{
"input": integer, // Total input tokens.
"output": integer, // Total output tokens.
"total": integer // Sum of input and output tokens.
}
curl -X GET "$BASE_URL/v1/analytics/requests/number-of-tokens?startDate=2024-01-01&endDate=2024-01-31" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "OrganizationId: $GEAI_ORGANIZATIONID" \
-H "ProjectId: $GEAI_PROJECTID"
Returns the average number of input, output, and total tokens per request, supporting analysis of typical request size and complexity.
| Name |
Type |
Description |
| startDate |
string |
Start date for the query (YYYY-MM-DD) |
| endDate |
string |
End date for the query (YYYY-MM-DD) |
- Method: GET
- Path: $BASE_URL/v1/analytics/requests/average-tokens-per-request
- Body: Empty
{
"input": number, // Average input tokens per request.
"output": number, // Average output tokens per request.
"total": number // Average total tokens per request.
}
curl -X GET "$BASE_URL/v1/analytics/requests/average-tokens-per-request?startDate=2024-01-01&endDate=2024-01-31" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "OrganizationId: $GEAI_ORGANIZATIONID" \
-H "ProjectId: $GEAI_PROJECTID"
Returns the number of input, output, and total tokens used each day, enabling daily token consumption tracking.
| Name |
Type |
Description |
| startDate |
string |
Start date for the query (YYYY-MM-DD) |
| endDate |
string |
End date for the query (YYYY-MM-DD) |
- Method: GET
- Path: $BASE_URL/v1/analytics/requests/number-of-tokens-per-day
- Body: Empty
{
"numberOfTokens": [
{
"date": "string", // Expressed in YYYY-MM-DD.
"input": integer, // Number of input tokens.
"output": integer, // Number of output tokens.
"total": integer // Total number of tokens.
},
{
"date": "string",
"input": integer,
"output": integer,
"total": integer
},
]
}
curl -X GET "$BASE_URL/v1/analytics/requests/number-of-tokens-per-day?startDate=2024-01-01&endDate=2024-01-31" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "OrganizationId: $GEAI_ORGANIZATIONID" \
-H "ProjectId: $GEAI_PROJECTID"
Returns the number of input, output, and total tokens grouped by Agent and model, supporting agent-level token usage analysis.
| Name |
Type |
Description |
| startDate |
string |
Start date for the query (YYYY-MM-DD) |
| endDate |
string |
End date for the query (YYYY-MM-DD) |
- Method: GET
- Path: $BASE_URL/v1/analytics/requests/number-of-tokens-per-agent
- Body: Empty
{
"numberOfTokens": [
{
"agent": "string", // If not available, returns N/D..
"input": integer, // Total number of input tokens.
"model": "string", // If not available, returns N/D.
"output": integer, // Total number of input tokens.
"total": integer // Total number of tokens.
},
{
"agent": "string",
"input": integer,
"model": "string",
"output": integer,
"total": integer
},
]
}
curl -X GET "$BASE_URL/v1/analytics/requests/number-of-tokens-per-agent?startDate=2024-01-01&endDate=2024-01-31" \
-H "Authorization: Bearer $GEAI_APITOKEN" \
-H "Content-Type: application/json" \
-H "OrganizationId: $GRAI_ORGANIZATIONID" \
-H "ProjectId: $GEAI_PROJECTID"
Since version 2025-09.