Skip to content
Indiana
Dashboard
Docs
Browse docs / Read balance deduction analytics

Read balance deduction analytics

POST/api/v1/credits/analytics

Aggregate consumption, refunds and reservations by balance source and allocation. Use readUsageAnalytics for raw calls and zero-cost events.

SDK 0.0.1Updated

Make the request

Aggregate consumption, refunds and reservations by balance source and allocation. Use readUsageAnalytics for raw calls and zero-cost 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/credits/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": "absolute",      "from": "2026-10-01T00:00:00.000Z",      "to": "2026-10-03T12:00:00.000Z"    },    "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.

resourceIduuidRequired

The resourceId 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.

resourceIduuidRequired

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

consumedUnitsstringRequired

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

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

refundedUnitsstringRequired

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

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

reservedUnitsstringRequired

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

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

chargedstringRequired

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

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

refundedstringRequired

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

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

reservedstringRequired

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

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

netUnitsstringRequired

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

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

netChargedstringRequired

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

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

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.

resourceIduuidRequired

The resourceId 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