operations

get_usage

Aggregate job units for a billing period. Cost class: fast.

credits is what the period bills; units are measured work, including failed and cancelled jobs that are not billed. The admission allowance also counts failed and cancelled work and in-flight reservations, so a quota_exceeded credits_used can exceed credits_total.

pages and bytes_ingested aggregate the per-job processing volume the workers record at completion time. credits sums only jobs whose usage is final; unfinalized_jobs counts the ones still open.

Args: session: Database session. caller: The authenticated tenant. period_start: Start of the billing window (inclusive). period_end: End of the billing window (inclusive). workspace_id: When set, restrict aggregation to one workspace. group_by: Aggregation key: day (default), kind, workspace, or tenant (a partner's roll-up over its child tenants, keyed by external_ref).

Returns: A usage report with per-bucket breakdowns and a total unit count.

Raises: PlatformError: invalid_request when period_end < period_start, or when group_by=tenant comes from anything but a partner key acting as itself or names a workspace; tenant_required when a partner key without X-NDI-Tenant asks for any other grouping.

get/v1/usage

Request

Query parameters

period_startstring date required

Start of the billing window, inclusive.

period_endstring date required

End of the billing window, inclusive.

workspace_idstring uuid nullable

Restrict to one workspace. Omit to aggregate all jobs for this API key.

group_by'day' | 'kind' | 'workspace' | 'tenant'

Aggregation key: calendar day, job kind, or workspace. tenant is for a partner key sent without X-NDI-Tenant: one bucket per child tenant, keyed by its external_ref.

Response

Successful Response

period_startstring date required
period_endstring date required
group_bystring required
units_totalinteger required
credits_totalinteger required

Sum of credits across all buckets: final credits for the period.

Changes

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