Skip to main content

usage_reports

Creates, updates, deletes, gets or lists a usage_reports resource.

Overview

Nameusage_reports
TypeResource
Idanthropic_admin.usage.usage_reports

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
ending_atstringEnd of the time bucket (exclusive) in RFC 3339 format.
resultsarrayList of usage items for this time bucket; multiple items when one or more `group_by[]` parameters are specified. Each item carries uncached_input_tokens, cache_creation, cache_read_input_tokens, output_tokens, server_tool_use, and the grouping dimensions (account_id, api_key_id, workspace_id, model, service_tier, service_account_id, context_window, inference_geo) which are null unless grouped by.
starting_atstringStart of the time bucket (inclusive) in RFC 3339 format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectstarting_atending_at, bucket_width, group_by[], account_ids[], api_key_ids[], workspace_ids[], models[], service_tiers[], service_account_ids[], context_window[], inference_geos[], speeds[]Get a Messages API usage report bucketed by time, optionally grouped and filtered. Each row is a time bucket carrying a results array with one item per group combination.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
starting_atstringTime buckets that start on or after this RFC 3339 timestamp will be returned. Snapped to the start of the minute/hour/day in UTC.
account_ids[]arrayRestrict usage returned to the specified user account ID(s).
api_key_ids[]arrayRestrict usage returned to the specified API key ID(s).
bucket_widthstringTime granularity of the response data.
context_window[]arrayRestrict usage returned to the specified context window(s) - 0-200k or 200k-1M.
ending_atstringTime buckets that end before this RFC 3339 timestamp will be returned.
group_by[]arrayGroup by any subset of account_id, api_key_id, context_window, inference_geo, model, service_account_id, service_tier, speed, workspace_id. Grouping by speed requires the fast-mode-2026-02-01 beta header.
inference_geos[]arrayRestrict usage returned to the specified inference geo(s) - global, us, or not_available.
models[]arrayRestrict usage returned to the specified model(s).
service_account_ids[]arrayRestrict usage returned to the specified service account ID(s).
service_tiers[]arrayRestrict usage returned to the specified service tier(s) - batch, flex, flex_discount, priority, priority_on_demand, standard.
speeds[]arrayRestrict usage returned to the specified speed(s), fast or standard (Claude Code research preview). Requires the fast-mode-2026-02-01 beta header.
workspace_ids[]arrayRestrict usage returned to the specified workspace ID(s).

SELECT examples

Get a Messages API usage report bucketed by time, optionally grouped and filtered. Each row is a time bucket carrying a results array with one item per group combination.

SELECT
ending_at,
results,
starting_at
FROM anthropic_admin.usage.usage_reports
WHERE starting_at = '{{ starting_at }}' -- required
AND ending_at = '{{ ending_at }}'
AND bucket_width = '{{ bucket_width }}'
AND "group_by[]" = '{{ group_by[] }}'
AND "account_ids[]" = '{{ account_ids[] }}'
AND "api_key_ids[]" = '{{ api_key_ids[] }}'
AND "workspace_ids[]" = '{{ workspace_ids[] }}'
AND "models[]" = '{{ models[] }}'
AND "service_tiers[]" = '{{ service_tiers[] }}'
AND "service_account_ids[]" = '{{ service_account_ids[] }}'
AND "context_window[]" = '{{ context_window[] }}'
AND "inference_geos[]" = '{{ inference_geos[] }}'
AND "speeds[]" = '{{ speeds[] }}'
;