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 User tab in Dashboard.

Check the generic variables needed to use the API.

Endpoints

Method Path Description
GET /analytics/requests/total-active-users Returns the total number of users who have made a request and, thus, been active within the selected period.
GET /analytics/requests/average-cost-per-user Returns the average cost attributed to each user.
GET /analytics/requests/average-requests-per-user Returns the average number of requests made per user.
GET /analytics/requests/top-10-users-by-cost Lists the top 10 users ranked by total cost incurred.
GET /analytics/requests/top-10-users-by-requests Lists the top 10 users who made the most requests, ranked by number.
GET /analytics/requests/average-cost-per-user-per-date Provides the average cost per user for each date.
GET /analytics/requests/average-requests-per-user-per-date Returns the average number of requests per user for each day.
GET analytics/requests/activity-per-user Returns the cost, number of requests and number of tokens grouped by user, 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: $GEAI_PROJECTID (otherwise, this and OrganizationId:$GEAI_ORGANIZATIONID headers are optional) Some endpoints may require additional headers such as:

  • Content-Type: application/json

GET /analytics/requests/total-active-users

Returns the total number of users who have been active within the selected period, supporting user engagement 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)
agentName string Agent name (optional)

Request

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

Response

json
{
  "totalActiveUsers": integer                                               // Number of total active users.
}

cURL Sample

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

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

Returns the average cost attributed to each user, supporting identification of high-cost users and optimization of user-level resource allocation.

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-user
  • Body: Empty

Response

{
  "averageCost": number                                                               // average cost per user (USD).
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/average-cost-per-user?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-requests-per-user

Returns the average number of requests made per user, supporting user engagement and adoption 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-requests-per-user
  • Body: Empty

Response

{
  "averageRequests": number                                                         // average number of requests per user.
}

GET /analytics/requests/top-10-users-by-cost

Lists the top 10 users ranked by total cost incurred, enabling identification of the most resource-intensive users.

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/top-10-users-by-cost
  • Body: Empty

Response

{
  "top10Users": [
    {
      "totalCost": number,                                // Expressed in USD.
      "user": "string"                                           // User’s email.
    },
     ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/top-10-users-by-cost?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"

GET /analytics/requests/top-10-users-by-requests

Lists the top 10 users ranked by the number of requests made, supporting identification of the most engaged users.

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/top-10-users-by-requests
  • Body: Empty

Response

{
  "top10Users": [
    {
      "totalRequests": integer,                          // Number of requests for this specific Top 10 users.
      "user": "string"                                          // Typically email address.
    },
    {
      "totalRequests": integer,
      "user": "string"
    },
    {
      "totalRequests": integer,
      "user": "string"
    },
    {
      "totalRequests": integer,
      "user": "string"
    },
    {
      "totalRequests": integer,
      "user": "string"
    },
    {
      "totalRequests": integer,
      "user": "string"
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/top-10-users-by-requests?startDate=2024-01-01&endDate=2024-01-31&agentName=" \
  -H "Authorization: Bearer $GEAI_APITOKEN" \
  -H "Content-Type: application/json" \
  -H "OrganizationId: $GEAI_ORGANIZATIONID" \
  -H "ProjectId: $GEAI_PROJECTID"

GET /analytics/requests/average-cost-per-user-per-date

Provides the average cost per user for each date, supporting temporal analysis of user spending patterns.

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-user-per-date
  • Body: Empty

Response

{
  "averageCostPerUser": [
    {
      "averageCost": number,                                        // Expressed in USD.
      "date": "string"                                                       // Date requested in format YYYY-MM-DD.
    },
    {
      "averageCost": number,
      "date": "string"
    },
    {
      "averageCost": number,
      "date": "string"
    },
    {
      "averageCost": number,
      "date": "string"
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/average-cost-per-user-per-date?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"

GET /analytics/requests/average-requests-per-user-per-date

Returns the average number of requests per user for each day, supporting analysis of user activity trends over time.

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-requests-per-user-per-date
  • Body: Empty

Response

{
  "averageRequestsPerUser": [
    {
      "averageRequests": number,                                        // Number of average requests.
      "date": "string"                                                              // Date expressed in YYYY-MM-DD format.
    },
    {
      "averageRequests": integer,
      "date": "string"
    },
    {
      "averageRequests": integer,
      "date": "string"
    },
    {
      "averageRequests": integer,
      "date": "string"
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/average-requests-per-user-per-date?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"

GET /analytics/requests/activity-per-user

Returns the cost, number of requests, and API Tokens grouped by user, Agent, and model, enabling detailed user activity and resource 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/activity-per-user
  • Body: Empty

Response

{
  "activity": [
    {
      "agentName": "string",                                                 // Name (if not available, returns N/D).
      "modelName": "string",                                               // If not available, returns N/D.
      "totalCost": number,                                                 // Expressed in USD.
      "totalRequests": integer,                                          // Total number of requests for this user.
      "totalTokens": integer,                                               // Tokens consumed by the user.
      "user": "string"                                                          // Typically user email.
    },
    {
      "agentName": "string",
      "modelName": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
    {
      "agentName": "string",
      "modelName": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
    {
      "agentName": "string",
      "modelName": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
    {
      "agentName": "string",
      "modelName": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
    {
      "agentName": "string",
      "modelName": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    },
    {
      "agentName": "string",
      "modelName": "string",
      "totalCost": number,
      "totalRequests": integer,
      "totalTokens": integer,
      "user": "string"
    }
  ]
}

cURL Sample

curl -X GET "$BASE_URL/v1/analytics/requests/activity-per-user?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"

Availability

Since version 2025-09.

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