Table of contents
Official Content
  • This documentation is valid for:

This API provides access to the data and metrics available in the Usage Dashboard,

Check the generic variables needed to use the API.

Endpoints

Method Path Description
GET /analytics/requests/total-cost Returns the total accumulated cost of all requests made.
GET /analytics/requests/total-tokens Returns the total number of tokens processed across all requests.
GET /analytics/requests/total-request-time Returns the total processing time for all requests (expressed in hours).
GET /analytics/requests/average-cost-per-request Returns the average cost per request, displayed in USD.
GET /analytics/requests/average-request-time Provides the average time taken to process a request.
GET /analytics/requests/total-requests-with-error Returns the total number of requests that resulted in errors.
GET /analytics/requests/overall-error-rate Calculates the percentage of requests that resulted in errors.
GET /analytics/requests/-per-day Provides a breakdown of total costs incurred per day.
GET /analytics/requests/total-requests-per-day Returns the number of requests made per day.
GET /analytics/requests/agent-usage-per-project Provides cost, request count, and token usage grouped by user, API Token, Project, Agent, and model.
GET /analytics/requests/agent-usage-per-organization-and-project Returns cost, request count, and token usage grouped by organization, user, project API Token, agent, and model.

Authentication

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: $PROJECT_ID (otherwise, this and OrganizationId:$ORGANIZATION_ID headers are optional) Some endpoints may require additional headers such as:

  • Content-Type: application/json

GET /analytics/requests/total-cost

Returns the total accumulated cost of all requests made within the selected period, expressed in USD, supporting analysis of overall platform usage expenses.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-cost
  • Body: Empty

Response

{
  "totalCost": number                                                    // the total cost for the requested period. Expressed in USD.
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-cost?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/total-tokens

Returns the total number of tokens processed across all requests, supporting overall usage and billing calculations.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-tokens
  • Body: Empty

Response

{
  "total": integer                                  // Total tokens in the period selected.
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-tokens?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/total-requests

Returns the total number of requests made, offering a high-level overview of activity and adoption.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-requests
  • Body: Empty

Response

{
  "totalRequests": integer                                // Total number of requests in the period.
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-requests?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/total-request-time

Returns the total processing time (expressed in hours) for all requests, providing insight into aggregate system workload and performance.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-request-time
  • Body: Empty

Response

{
  "time": number                                    // Total processing time in hours.
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-request-time?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/average-cost-per-request

Returns the average cost incurred per request during the selected period. Expressed in USD.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/average-cost-per-request
  • Body: Empty

Response

{
"averageCostPerRequest": number                               // Expressed in USD
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/average-cost-per-request?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/average-request-time

Provides the average processing time for each request, enabling performance monitoring and optimization analysis.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/average-request-time
  • Body: Empty

Response

{
  "averageRequestTime": number                                                        // average request time in milliseconds.
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/average-request-time?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/total-requests-with-error

Returns the total number of requests that resulted in errors, supporting error tracking and reliability assessment.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-requests-with-error
  • Body: Empty

Response

{
  "totalRequestsWithError": integer                             // number of requests with error in the period.
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-requests-with-error?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/overall-error-rate

Calculates the percentage of requests that failed, supporting analysis of overall error rate and system stability.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/overall-error-rate
  • Body: Empty

Response

{
  "overallErrorRate": number // error rate as expressed from 0 to 1

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/overall-error-rate?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/total-cost-per-day

Provides a breakdown of total costs incurred per day, allowing for daily cost monitoring and trend analysis.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-cost-per-day
  • Body: Empty

Response

{
  "totalCostPerDay": [
    {
      "date": "string",                                    // Date in YYYY-MM-DD.
      "totalCost": number                                // Total cost for the day (USD).
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-cost-per-day?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/total-requests-per-day

Returns the number of requests made per day.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)
agentName string Agent name (optional)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/total-requests-per-day
  • Body: Empty

Response

{
  "totalRequestsPerDay": [
    {
      "date": "string",                                             // Format YYYY-MM-DD (one response for each day of the requested period).
      "totalRequests": integer,                           // Total requests during the date specified above
      "totalRequestsWithError": integer              // Total requests with error during the date specified above.
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/total-requests-per-day?startDate=2024-01-01&endDate=2024-01-31&agentName=" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/agent-usage-per-project

Returns the cost, number of requests, and token usage grouped by project, Agent, API Token, user, and model, supporting project-level resource tracking.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/agent-usage-per-project
  • Body: Empty

Response

{
  "agentUsage": [
    {
      "agent": "string", // Agent name, If not found, returns N/D.
      "apiToken": "string",// API Token name.
      "inputTokens": integer,// Total number of Input Tokens.
      "model": "string", // Model name.
      "outputTokens": integer,           // Total number of Output Tokens.
      "project": "string",// Expressed in USD.
      "totalCost": number,// Expressed in USD.
      "totalRequests": integer,// Total requests for this Agent.
      "totalTokens": integer,// Total tokens consumed by this Agent.
      "user": "string"// Typically identified by email address.
    },
    {
      "agent": "string",
      "apiToken": "string",
      "inputTokens": integer,
      "model": "string",
      "outputTokens": integer,
      "project": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/agent-usage-per-project?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

GET /analytics/requests/agent-usage-per-organization-and-project

Returns the cost, number of requests, and token usage grouped by organization, project, Agent, user, API Token, and model, enabling multi-level usage analysis.

Parameters

Name Type Description
startDate string Start date for the query (YYYY-MM-DD)
endDate string End date for the query (YYYY-MM-DD)

Request

  • Method: GET
  • Path: $BASE_URL/v1/analytics/requests/agent-usage-per-organization-and-project
  • Body: Empty

Response

{
  "agentUsage": [
    {
      "agent": "string",                                       // Agent name, if not found, will return N/D.
      "apiToken": "string",                                    // API Token name.
      "inputTokens": integer,                               // Total number of in Input Tokens.
      "model": "string",                                     // Model used by Agent.
      "organization": "string",                              // Organization name. 
      "outputTokens": integer,                                // Total number of Output Tokens.
      "project": "string",                                   // Project name.
      "totalCost": number,                                   // Expressed in USD.
      "totalRequests": integer,                           // Total number of requests.
      "totalTokens": integer,                              // Total number of Tokens.
      "user": "string"                                      // User name.
    },
    {
      "agent": "string",
      "apiToken": "string",
      "inputTokens": integer,
      "model": "string",
      "organization": "string",
      "outputTokens": integer,
      "project": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/agent-usage-per-organization-and-project?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "organization-id: $GEAI_ORGANIZATIONID" \   
-H "project-id: $GEAI_PROJECTID"

Availability

Since version 2025-09.

Last update: December 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant