Ledger

Tenant usage analytics

Exact database rollups over captured BURN debits. Accepts either the legacy days=7|30|90 form or an explicit half-open from/to window, optionally bucketed and narrowed to one spender and/or one provider. The prior comparison covers the same elapsed span as the current period, including today's partial UTC day, and is narrowed by the same filter so deltas stay like-for-like; top-ups, allocations, refunds, and open reservations are excluded. usageDrift is null when the optional detector read is temporarily unavailable.

get/credits/analytics

Request

  • Base URL
    https://api.paywithlocus.com/api
  • URL
    https://api.paywithlocus.com/api/credits/analytics
  • Auth
    • HTTP bearer
    • or HTTP bearer

Query parameters

days7 | 30 | 90

Legacy form: N whole UTC days ending with today so far. Cannot be combined with from/to. Any value outside the enum — including a repeated parameter — is a 400 rather than a silent fall back to the default.

fromstring date-time

Window start, inclusive. Strict ISO-8601 (must round-trip). Requires to. Must be on or after 2000-01-01T00:00:00.000Z.

tostring date-time

Window end, EXCLUSIVE. Strict ISO-8601. Requires from, must be later than it, and may not be more than 24 hours ahead of the server clock. A window ending in the future gap-fills its trailing buckets with zeros.

bucket'hour' | 'day' | 'week' | 'month'

Series granularity, aligned to UTC calendar boundaries (weeks start Monday). A window yielding more than 400 buckets is rejected.

initiatorstring

Spender reference <type>:<id>, where type is one of oauth_member, end_user, agent_connection, customer, credential, unattributed. The id is the identity analytics ranks by (external user id, Cognito sub, agent-connection id, API key id, or for a customer <URL-encoded attribution.source>/<customerId>, where an id without a slash means no source); unattributed takes no id.

providerstring

Provider label as analytics reports it, including the literal 'Unknown service' for burns whose provider was never captured.

endpointstring

Endpoint name. Requires provider.

limitinteger

Row cap applied to services, providers, users, and initiators.

Response

Usage, cost, margin, service, and account rollups

successunknown required

Changes

No recorded changes to this operation across all 1 revision of this API.