Skip to content
Indiana
Dashboard
Docs
Browse docs / Read usage event and AI aggregates

Read usage event and AI aggregates

POST/api/v1/usage/analytics

Count accepted consume/confirm events including zero-cost calls. Aggregate valid reported tokens and provider costs, identifying missing or invalid reports. Reservations and refunds do not add usage events.

SDK 0.0.1Updated

Make the request

Count accepted consume/confirm events including zero-cost calls. Aggregate valid reported tokens and provider costs, identifying missing or invalid reports. Reservations and refunds do not add usage events.

Credential
Server API key only. Call from your trusted backend.
Permission
credits:read
Set the base URL and App ID from SDK setup. These examples use placeholders and do not execute requests. Never put a server key in browser code.
request.shShell
curl -X POST "$GROOVE_BASE_URL/api/v1/usage/analytics" \  -H "Authorization: Bearer $GROOVE_SECRET_KEY" \  -H "X-Groove-Project: $GROOVE_PROJECT_ID" \  -H "X-Groove-Environment: sandbox" \  -H "Content-Type: application/json" \  -d '{  "customerId": null,  "query": {    "range": {      "kind": "last_days",      "days": 7    },    "timezone": "UTC",    "filterBy": [],    "interval": "day",    "entitlementId": null,    "groupBy": "customer",    "entityId": null,    "topN": null,    "after": null,    "limit": 50  }}'

The response tab lists field types, not an example payload. Actual values depend on customer state.

Request parameters

JSON body

customerIduuid | nullRequired

Indiana customer ID mapped from a verified identity on the server. Omit for customer-token calls, which use the token-bound customer.

queryobjectRequired

The query value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
rangeobject | object | objectRequired

The range value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
kind"absolute" | "last_days" | "billing_cycles"Required

The kind value for this operation. Its accepted type and constraints are listed above and below.

fromdate-timeOptional

The from value for this operation. Its accepted type and constraints are listed above and below.

todate-timeOptional

The to value for this operation. Its accepted type and constraints are listed above and below.

days1 | 7 | 30 | 90Optional

The days value for this operation. Its accepted type and constraints are listed above and below.

membershipIduuidOptional

The membershipId value for this operation. Its accepted type and constraints are listed above and below.

countintegerOptional

The count value for this operation. Its accepted type and constraints are listed above and below.

min: 1 · max: 12

includeCurrentbooleanOptional

The includeCurrent value for this operation. Its accepted type and constraints are listed above and below.

timezonestringRequired

The timezone value for this operation. Its accepted type and constraints are listed above and below.

maxLength: 100

filterByarrayRequired

The filterBy value for this operation. Its accepted type and constraints are listed above and below.

maxItems: 5

Show child fields
keystringRequired

The key value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^[a-z][a-z0-9_]{0,63}$

valuesarrayRequired

The values value for this operation. Its accepted type and constraints are listed above and below.

minItems: 1 · maxItems: 20

intervalenumRequired

The interval value for this operation. Its accepted type and constraints are listed above and below.

Show allowed values

"hour""day""week""month"

entitlementIduuid | nullRequired

The entitlementId value for this operation. Its accepted type and constraints are listed above and below.

entityIduuid | nullRequired

Entity ID within the current customer scope, for configured entity and license features.

topNinteger | nullRequired

The topN value for this operation. Its accepted type and constraints are listed above and below.

groupByenum | stringRequired

The groupBy value for this operation. Its accepted type and constraints are listed above and below.

afterobject | nullRequired

The after value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
bucketdate-timeRequired

The bucket value for this operation. Its accepted type and constraints are listed above and below.

groupstringRequired

The group value for this operation. Its accepted type and constraints are listed above and below.

maxLength: 240

isOtherbooleanRequired

The isOther value for this operation. Its accepted type and constraints are listed above and below.

entitlementIduuidRequired

The entitlementId value for this operation. Its accepted type and constraints are listed above and below.

limitintegerRequired

Maximum records per page, subject to the contract limit.

min: 1 · max: 100

Response fields

Successful responses include requestId and scope. Use the actual business status or accepted field to determine the result. Optional fields are omitted when unavailable.

HTTP 200 · application/json

requestIduuidRequired

Server-generated HTTP request UUID. Include it when reporting a failed request.

scopeobjectRequired

The App and environment of this response. Headers only verify scope; they cannot switch key scope.

Show child fields
projectIdstringRequired

App ID bound to the credential.

minLength: 1

environmentenumRequired

Separate data scope: sandbox or live.

Show allowed values

"sandbox""live"

analyticsobjectRequired

The analytics value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
fromdate-timeRequired

The from value for this operation. Its accepted type and constraints are listed above and below.

todate-timeRequired

The to value for this operation. Its accepted type and constraints are listed above and below.

intervalenumRequired

The interval value for this operation. Its accepted type and constraints are listed above and below.

Show allowed values

"hour""day""week""month"

timezonestringRequired

The timezone value for this operation. Its accepted type and constraints are listed above and below.

maxLength: 100

rowsarrayRequired

The rows value for this operation. Its accepted type and constraints are listed above and below.

maxItems: 100

Show child fields
bucketdate-timeRequired

The bucket value for this operation. Its accepted type and constraints are listed above and below.

groupstringRequired

The group value for this operation. Its accepted type and constraints are listed above and below.

maxLength: 240

isOtherbooleanRequired

The isOther value for this operation. Its accepted type and constraints are listed above and below.

entitlementIduuidRequired

The entitlementId value for this operation. Its accepted type and constraints are listed above and below.

eventCountstringRequired

The eventCount value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

unitsstringRequired

The units value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})(\.\d{1,18})?$

tokenEventCountstringRequired

The tokenEventCount value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

tokensobjectRequired

The tokens value for this operation. Its accepted type and constraints are listed above and below.

Show child fields
inputstringRequired

The input value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

outputstringRequired

The output value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

cache_readstringRequired

The cache_read value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

cache_writestringRequired

The cache_write value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

reasoningstringRequired

The reasoning value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

input_audiostringRequired

The input_audio value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

output_audiostringRequired

The output_audio value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

totalTokensstringRequired

The totalTokens value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

providerCostEventCountstringRequired

The providerCostEventCount value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

providerCostUsdstringRequired

The providerCostUsd value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})(\.\d{1,18})?$

invalidTelemetryEventCountstringRequired

The invalidTelemetryEventCount value for this operation. Its accepted type and constraints are listed above and below.

pattern: ^(0|[1-9]\d{0,29})$

nextCursorobject | nullRequired

Next-page cursor; null means end. Pass unchanged and clear when filters change.

Show child fields
bucketdate-timeRequired

The bucket value for this operation. Its accepted type and constraints are listed above and below.

groupstringRequired

The group value for this operation. Its accepted type and constraints are listed above and below.

maxLength: 240

isOtherbooleanRequired

The isOther value for this operation. Its accepted type and constraints are listed above and below.

entitlementIduuidRequired

The entitlementId value for this operation. Its accepted type and constraints are listed above and below.

Handle errors

Common failures
CodeRecovery
UNAUTHENTICATEDVerify the key or refresh the expired customer token once.
FORBIDDENCheck current key permissions and customer access.
INVALID_REQUESTCheck field types, UUIDs, decimal strings and mutually exclusive fields.
SCOPE_MISMATCHUse the App and environment bound to the credential.

Common failures

  • UNAUTHENTICATED

    Recovery
    Verify the key or refresh the expired customer token once.
  • FORBIDDEN

    Recovery
    Check current key permissions and customer access.
  • INVALID_REQUEST

    Recovery
    Check field types, UUIDs, decimal strings and mutually exclusive fields.
  • SCOPE_MISMATCH

    Recovery
    Use the App and environment bound to the credential.

Related:All request and error conventions·Back to endpoint index