Skip to main content
GET
/
user
/
usage
/
by-day
Get user usage aggregated by day
curl --request GET \
  --url https://api.datalinks.com/api/v1/user/usage/by-day \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "date": "2021-01-21T00:00:00.000Z",
      "tokensUsed": 125000,
      "costUSD": 12.5
    }
  ],
  "meta": {
    "timeZoneForAggregation": "America/New_York"
  }
}

Authorizations

Authorization
string
header
required

Use a Bearer token for authentication. Submit the token using the Authorization header: Authorization: Bearer <token>.

Query Parameters

onOrAfter
string<date-time>

Return records on or after this timestamp.

Example:

"2021-01-01T00:00:00.000Z"

before
string<date-time>

Return records before this timestamp.

Example:

"2021-12-31T23:59:59.999Z"

timeZoneForAggregation
string
default:UTC

Timezone for date aggregation (e.g., "America/New_York", "Europe/London"). Defaults to UTC.

Example:

"America/New_York"

Response

Returns usage aggregated by day.

data
object[]
required
meta
object
required