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

This article provides access to Analytics API endpoints with the data and metrics available in the Project tab in 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/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 Returns the total number of requests made.
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/total-cost-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/activity-per-agent Returns the cost, number of requests and number of tokens, grouped by 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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

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 "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

GET /analytics/requests/activity-per-agent

Returns the cost and number of requests and API Tokens grouped by Agent and model, supporting Agent-level usage and cost 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/activity-per-agent
  • Body: Empty

Response

{
  "activity": [
    {
      "agentName": "string", // Agent name.
      "model": "string",     // Model name.
      "totalCost": number,  // Total cost for the Agent/model
      "totalRequests": integer // Number of requests for the Agent/model.
"totalTokens": integer    // Number of tokens consumed by the Agent.
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/activity-per-agent?startDate=2024-01-01&endDate=2024-01-31" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "OrganizationId: $ORGANIZATION_ID" \
  -H "ProjectId: $PROJECT_ID"

Availability

Since version 2025-09.

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