Class UsageListParams
-
- All Implemented Interfaces:
-
com.anthropic.core.Params
public final class UsageListParams implements Params
Get token usage across a date range, broken out by dimension.
Returns one row per combination of the requested
group_by[]dimensions (and time bucket, whentime_bucket_widthis set) that has usage in the range, ranked by theorder_bymetric or ordered by time bucket; every combination is returned across pages. With nogroup_by[]and notime_bucket_width, a single row aggregates the whole range. Includes all usage, whether or not it is attributable to a seat user. Requires an API key with theread:analyticsscope, or an Admin API key.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classUsageListParams.BuilderA builder for UsageListParams.
-
Method Summary
Modifier and Type Method Description final OffsetDateTimestartingAt()Start of range, inclusive. final Optional<List<String>>actorIds()Filter to usage attributed to specific identities, by tagged ID: a user_...,svac_...(service account), orapikey_...ID.final Optional<List<BetaAnalyticsActorType>>actorTypes()Filter to usage attributed to specific kinds of identity. final Optional<List<String>>agentIds()Filter to usage incurred by sessions of specific Claude Managed Agents agents. final Optional<List<String>>apiKeyIds()Filter to usage authenticated by specific API keys, by tagged API key ID ( apikey_...), whichever identity the usage is attributed to.final Optional<List<BetaAnalyticsClaudeTagCategory>>claudeTagCategories()Filter to Claude Tag (Claude in Slack) usage in specific spend categories. final Optional<List<String>>claudeTagUserIds()Filter to Claude Tag (Claude in Slack) usage attributed to specific Slack users, by Slack user ID (for example U0123ABCDEF), not claude.ai user ID.final Optional<List<BetaAnalyticsContextWindow>>contextWindows()Filter to specific context-window pricing tiers. final Optional<List<String>>deploymentIds()Filter to usage incurred by Claude Managed Agents sessions that specific deployments started. final Optional<OffsetDateTime>endingAt()End of range, exclusive. final Optional<List<String>>environmentIds()Filter to usage incurred by Claude Managed Agents sessions that ran in specific environments. final Optional<Boolean>excludeDeletedUsers()If true, omit rows whose actoris auser_actorwithdeleted: true.final Optional<List<BetaAnalyticsUsageGroupBy>>groupBy()Dimensions to break usage out by (at most 5): one row per combination of their values with usage in the range (and per time bucket, when time_bucket_widthis set), every combination returned across pages rather than a capped top set.final Optional<List<BetaAnalyticsInferenceGeoFilter>>inferenceGeos()Filter to specific inference regions. final Optional<Long>limit()Number of rows per page (1-1000, default 20). final Optional<List<String>>models()Models to include. final Optional<BetaAnalyticsUsageCostSortOrder>order()Sort direction of the order_bymetric, or of the time buckets whenorder_byistimeandtime_bucket_widthis set.final Optional<BetaAnalyticsUsageOrderBy>orderBy()Row order. final Optional<List<String>>organizationIds()Filter a parent organization's report to specific child organizations, by organization UUID or org_ID; an ID that is not one of its child organizations matches nothing.final Optional<String>page()Opaque cursor from a previous response's next_pagefield.final Optional<List<BetaAnalyticsUsageCostProductFilter>>products()Product surfaces to include. final Optional<List<String>>rbacGroupIds()Filter to usage attributed to specific RBAC groups. final Optional<List<BetaAnalyticsServiceTier>>serviceTiers()Filter to specific service tiers. final Optional<List<String>>sessionIds()Filter to usage incurred by specific Claude Managed Agents sessions, by tagged session ID ( sesn_...).final Optional<List<String>>slackChannelIds()Filter to usage originating from specific Slack channels. final Optional<List<BetaAnalyticsSpeed>>speeds()Filter to fast or standard inference mode. final Optional<BetaAnalyticsTimeBucketWidth>timeBucketWidth()Time-bucket granularity. final Optional<List<String>>userProfileIds()Filter to usage attributed to specific user profiles, by tagged user profile ID ( uprof_...).final Optional<List<String>>workspaceIds()Filter to usage in specific workspaces, by tagged workspace ID ( wrkspc_...).final Optional<List<AnthropicBeta>>betas()This endpoint is in beta: requests must send analytics-usage-cost-2026-08-24in this header.final Headers_additionalHeaders()Additional headers to send with the request. final QueryParams_additionalQueryParams()Additional query param to send with the request. final UsageListParams.BuildertoBuilder()Headers_headers()The full set of headers in the parameters, including both fixed and additional headers. QueryParams_queryParams()The full set of query params in the parameters, including both fixed and additional query params. SpanData_spanData()The data for the OpenTelemetry span of a call to the method with these parameters. Booleanequals(Object other)IntegerhashCode()StringtoString()final static UsageListParams.Builderbuilder()Returns a mutable builder for constructing an instance of UsageListParams. -
-
Method Detail
-
startingAt
final OffsetDateTime startingAt()
Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days and no earlier than 2026-01-01T00:00:00Z.
-
actorIds
final Optional<List<String>> actorIds()
Filter to usage attributed to specific identities, by tagged ID: a
user_...,svac_...(service account), orapikey_...ID. Anapikey_entry matches only usage attributed to the key itself, not usage on that key attributed to a user or service account (useapi_key_ids[]for every request a key authenticated). Federated identities have no tagged ID; select them withactor_types[]. Usegroup_by[]=actorto break out per-identity values.
-
actorTypes
final Optional<List<BetaAnalyticsActorType>> actorTypes()
Filter to usage attributed to specific kinds of identity. Use
group_by[]=actor_typeto break out per-kind values.
-
agentIds
final Optional<List<String>> agentIds()
Filter to usage incurred by sessions of specific Claude Managed Agents agents. Use
group_by[]=agent_idto break out per-agent values. Claude Platform organizations only.
-
apiKeyIds
final Optional<List<String>> apiKeyIds()
Filter to usage authenticated by specific API keys, by tagged API key ID (
apikey_...), whichever identity the usage is attributed to. Include an empty entry (api_key_ids[]=) to also match usage that no API key authenticated. Usegroup_by[]=api_key_idto break out per-key values; usage without a key has a nullapi_key_id. Claude Platform organizations only.
-
claudeTagCategories
final Optional<List<BetaAnalyticsClaudeTagCategory>> claudeTagCategories()
Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage with no category never matches. Use
group_by[]=claude_tag_categoryto break out per-category values.
-
claudeTagUserIds
final Optional<List<String>> claudeTagUserIds()
Filter to Claude Tag (Claude in Slack) usage attributed to specific Slack users, by Slack user ID (for example
U0123ABCDEF), not claude.ai user ID. Usage that is not Claude Tag, and Claude Tag usage not attributed to a single user, never matches. Usegroup_by[]=claude_tag_user_idto break out per-user values.
-
contextWindows
final Optional<List<BetaAnalyticsContextWindow>> contextWindows()
Filter to specific context-window pricing tiers. Use
group_by[]=context_windowto break out per-tier values.
-
deploymentIds
final Optional<List<String>> deploymentIds()
Filter to usage incurred by Claude Managed Agents sessions that specific deployments started. Use
group_by[]=deployment_idto break out per-deployment values. Claude Platform organizations only.
-
endingAt
final Optional<OffsetDateTime> endingAt()
End of range, exclusive. Required when
time_bucket_widthis set. Withouttime_bucket_width, defaults to the earlier of now andstarting_at+ 31 days. The range may span at most 31 days.
-
environmentIds
final Optional<List<String>> environmentIds()
Filter to usage incurred by Claude Managed Agents sessions that ran in specific environments. Use
group_by[]=environment_idto break out per-environment values. Claude Platform organizations only.
-
excludeDeletedUsers
final Optional<Boolean> excludeDeletedUsers()
If true, omit rows whose
actoris auser_actorwithdeleted: true. Requiresgroup_by[]=actor. Rows for other actor types, and rows whoseactoris null, are always kept. A page may contain fewer thanlimitrows; usehas_moreandnext_pageto paginate as usual.
-
groupBy
final Optional<List<BetaAnalyticsUsageGroupBy>> groupBy()
Dimensions to break usage out by (at most 5): one row per combination of their values with usage in the range (and per time bucket, when
time_bucket_widthis set), every combination returned across pages rather than a capped top set. When omitted, a single row aggregates the whole range.
-
inferenceGeos
final Optional<List<BetaAnalyticsInferenceGeoFilter>> inferenceGeos()
Filter to specific inference regions.
not_availablematches rows where the region is unset. Usegroup_by[]=inference_geoto break out per-region values.
-
limit
final Optional<Long> limit()
Number of rows per page (1-1000, default 20).
cost_type/token_typefan-out rows (cost endpoint only) do not count toward this limit, sodatacan exceed it.
-
models
final Optional<List<String>> models()
Models to include. Defaults to all models. Use
group_by[]=modelto break out per-model values.
-
order
final Optional<BetaAnalyticsUsageCostSortOrder> order()
Sort direction of the
order_bymetric, or of the time buckets whenorder_byistimeandtime_bucket_widthis set. Defaults todesc.
-
orderBy
final Optional<BetaAnalyticsUsageOrderBy> orderBy()
Row order. A metric ranks rows by that metric in the
orderdirection.timeorders rows by time bucket in theorderdirection (newest first by default) and, within a bucket, bytotal_tokens, highest first.timetakes effect only withtime_bucket_width; without it,timeis the same astotal_tokens. Defaults tototal_tokens.
-
organizationIds
final Optional<List<String>> organizationIds()
Filter a parent organization's report to specific child organizations, by organization UUID or
org_ID; an ID that is not one of its child organizations matches nothing. Requires an API key created at the parent organization level. Usegroup_by[]=organization_idto break out per-organization values.
-
products
final Optional<List<BetaAnalyticsUsageCostProductFilter>> products()
Product surfaces to include. Defaults to all products.
-
rbacGroupIds
final Optional<List<String>> rbacGroupIds()
Filter to usage attributed to specific RBAC groups. Accepts tagged RBAC group IDs (
rbac_group_...) or bare group UUIDs. A row matches when the user belonged to any of the listed groups on the (UTC) day the usage occurred; usage with no group attribution never matches.
-
serviceTiers
final Optional<List<BetaAnalyticsServiceTier>> serviceTiers()
Filter to specific service tiers. Use
group_by[]=service_tierto break out per-tier values. Claude Platform organizations only; matches nothing for a Claude Enterprise organization.
-
sessionIds
final Optional<List<String>> sessionIds()
Filter to usage incurred by specific Claude Managed Agents sessions, by tagged session ID (
sesn_...). Usegroup_by[]=session_idto break out per-session values. Claude Platform organizations only.
-
slackChannelIds
final Optional<List<String>> slackChannelIds()
Filter to usage originating from specific Slack channels. Use
group_by[]=slack_channel_idto break out per-channel values.
-
speeds
final Optional<List<BetaAnalyticsSpeed>> speeds()
Filter to fast or standard inference mode. Use
group_by[]=speedto break out per-mode values.
-
timeBucketWidth
final Optional<BetaAnalyticsTimeBucketWidth> timeBucketWidth()
Time-bucket granularity. When set, rows are returned per time bucket (one per bucket and dimension combination with usage) and each row's
starting_atandending_atare that bucket's bounds; the time bucket counts towardlimit.ending_atis required whentime_bucket_widthis set, and withtime_bucket_width="1m"the range may span at most 24 hours. When omitted, each row aggregates the requested range withstarting_atandending_ateach rounded down to the hour.
-
userProfileIds
final Optional<List<String>> userProfileIds()
Filter to usage attributed to specific user profiles, by tagged user profile ID (
uprof_...). Usegroup_by[]=user_profile_idto break out per-profile values. Claude Platform organizations only.
-
workspaceIds
final Optional<List<String>> workspaceIds()
Filter to usage in specific workspaces, by tagged workspace ID (
wrkspc_...). Usegroup_by[]=workspace_idto break out per-workspace values. Claude Platform organizations only; matches nothing for a Claude Enterprise organization.
-
betas
final Optional<List<AnthropicBeta>> betas()
This endpoint is in beta: requests must send
analytics-usage-cost-2026-08-24in this header.
-
_additionalHeaders
final Headers _additionalHeaders()
Additional headers to send with the request.
-
_additionalQueryParams
final QueryParams _additionalQueryParams()
Additional query param to send with the request.
-
toBuilder
final UsageListParams.Builder toBuilder()
-
_headers
Headers _headers()
The full set of headers in the parameters, including both fixed and additional headers.
-
_queryParams
QueryParams _queryParams()
The full set of query params in the parameters, including both fixed and additional query params.
-
_spanData
SpanData _spanData()
The data for the OpenTelemetry span of a call to the method with these parameters.
-
builder
final static UsageListParams.Builder builder()
Returns a mutable builder for constructing an instance of UsageListParams.
The following fields are required:
.startingAt()
-
-
-
-