Claude Platform Docs

Obtenir l'utilisation des tokens par dimension

UsageListPage beta().organization().analytics().usage().list(params, requestOptions = RequestOptions.none())
GET/v1/organizations/analytics/usage
Requires anthropic-beta: analytics-usage-cost-2026-08-24. Learn how to send beta headers.

Obtient l'utilisation des tokens sur une plage de dates, ventilée par dimension.

Renvoie une ligne par combinaison des dimensions group_by[] demandées (et par intervalle de temps, lorsque time_bucket_width est défini) présentant une utilisation sur la plage, classée selon la métrique order_by ou triée par intervalle de temps ; toutes les combinaisons sont renvoyées sur plusieurs pages. Sans group_by[] ni time_bucket_width, une seule ligne agrège toute la plage. Inclut toute l'utilisation, qu'elle soit ou non attribuable à un utilisateur disposant d'un siège. Nécessite une clé API avec la portée read:analytics, ou une clé API Admin. Ce point de terminaison est en bêta et n'est pas disponible pour les organisations dont la préparation HIPAA est activée : leurs requêtes API renvoient une erreur 400. Le rapport d'une organisation parente portant sur ses organisations enfants exclut les organisations enfants dont la préparation HIPAA est activée. Si l'organisation parente a des organisations enfants et que la préparation HIPAA est activée pour toutes, la requête renvoie une erreur 400.

Parameters
UsageListParams params
OffsetDateTime startingAt⁠Query parameter

Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days and no earlier than 2026-01-01T00:00:00Z.

formatdate-time
Optional<List<String>> actorIds⁠Query parameter

Filter to usage attributed to specific identities, by tagged ID: a user_..., svac_... (service account), or apikey_... ID. An apikey_ entry matches only usage attributed to the key itself, not usage on that key attributed to a user or service account (use api_key_ids[] for every request a key authenticated). Federated identities have no tagged ID; select them with actor_types[]. Use group_by[]=actor to break out per-identity values.

maxItems100
Optional<List<BetaAnalyticsActorType>> actorTypes⁠Query parameter

Filter to usage attributed to specific kinds of identity. Use group_by[]=actor_type to break out per-kind values.

maxItems100
API_ACTOR("api_actor")
FEDERATED_ACTOR("federated_actor")
SERVICE_ACCOUNT_ACTOR("service_account_actor")
USER_ACTOR("user_actor")
Optional<List<String>> agentIds⁠Query parameter

Filter to usage incurred by sessions of specific Claude Managed Agents agents. Use group_by[]=agent_id to break out per-agent values.

maxItems100
Optional<List<String>> apiKeyIds⁠Query parameter

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. Use group_by[]=api_key_id to break out per-key values; usage without a key has a null api_key_id.

maxItems100
Optional<List<BetaAnalyticsClaudeTagCategory>> claudeTagCategories⁠Query parameter

Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage with no category never matches. Use group_by[]=claude_tag_category to break out per-category values.

maxItems100
DM("dm")
ENGAGED("engaged")
MONITORING("monitoring")
PROACTIVE("proactive")
SCHEDULED("scheduled")
Optional<List<String>> claudeTagUserIds⁠Query parameter

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. Use group_by[]=claude_tag_user_id to break out per-user values.

maxItems100
Optional<List<BetaAnalyticsContextWindow>> contextWindows⁠Query parameter

Filter to specific context-window pricing tiers. Use group_by[]=context_window to break out per-tier values.

maxItems100
FROM_0_TO_200K("0-200k")
FROM_200K_TO_1_M("200k-1M")
Optional<List<String>> deploymentIds⁠Query parameter

Filter to usage incurred by Claude Managed Agents sessions that specific deployments started. Use group_by[]=deployment_id to break out per-deployment values.

maxItems100
Optional<OffsetDateTime> endingAt⁠Query parameter

End of range, exclusive. Required when time_bucket_width is set. Without time_bucket_width, defaults to the earlier of now and starting_at + 31 days. The range may span at most 31 days.

formatdate-time
Optional<List<String>> environmentIds⁠Query parameter

Filter to usage incurred by Claude Managed Agents sessions that ran in specific environments. Use group_by[]=environment_id to break out per-environment values.

maxItems100
Optional<Boolean> excludeDeletedUsers⁠Query parameter

If true, omit rows whose actor is a user_actor with deleted: true. Requires group_by[]=actor. Rows for other actor types, and rows whose actor is null, are always kept. A page may contain fewer than limit rows; use has_more and next_page to paginate as usual.

Optional<List<BetaAnalyticsUsageGroupBy>> groupBy⁠Query parameter

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_width is set), every combination returned across pages rather than a capped top set. When omitted, a single row aggregates the whole range.

maxItems100
ACTOR("actor")
ACTOR_TYPE("actor_type")
AGENT_ID("agent_id")
API_KEY_ID("api_key_id")
CLAUDE_TAG_CATEGORY("claude_tag_category")
CLAUDE_TAG_USER_ID("claude_tag_user_id")
CONTEXT_WINDOW("context_window")
DEPLOYMENT_ID("deployment_id")
ENVIRONMENT_ID("environment_id")
INFERENCE_GEO("inference_geo")
MODEL("model")
ORGANIZATION_ID("organization_id")
PRODUCT("product")
RBAC_GROUP_ID("rbac_group_id")
SERVICE_TIER("service_tier")
SESSION_ID("session_id")
SLACK_CHANNEL_ID("slack_channel_id")
SPEED("speed")
USER_PROFILE_ID("user_profile_id")
WORKSPACE_ID("workspace_id")
Optional<List<BetaAnalyticsInferenceGeoFilter>> inferenceGeos⁠Query parameter

Filter to specific inference regions. not_available matches rows where the region is unset. Use group_by[]=inference_geo to break out per-region values.

maxItems100
GLOBAL("global")
NOT_AVAILABLE("not_available")
US("us")
Optional<Long> limit⁠Query parameter

Number of rows per page (1-1000, default 20). cost_type/token_type fan-out rows (cost endpoint only) do not count toward this limit, so data can exceed it.

minimum1
maximum1000
Optional<List<String>> models⁠Query parameter

Models to include. Defaults to all models. Use group_by[]=model to break out per-model values.

maxItems100
Optional<BetaAnalyticsUsageCostSortOrder> order⁠Query parameter

Sort direction of the order_by metric, or of the time buckets when order_by is time and time_bucket_width is set. Defaults to desc.

Optional<BetaAnalyticsUsageOrderBy> orderBy⁠Query parameter

Row order. A metric ranks rows by that metric in the order direction. time orders rows by time bucket in the order direction (newest first by default) and, within a bucket, by total_tokens, highest first. time takes effect only with time_bucket_width; without it, time is the same as total_tokens. Defaults to total_tokens.

Optional<List<String>> organizationIds⁠Query parameter

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. The report leaves out child organizations with HIPAA readiness enabled, and naming one returns a 400 error. Requires an API key created at the parent organization level. Use group_by[]=organization_id to break out per-organization values.

maxItems100
Optional<String> page⁠Query parameter

Opaque cursor from a previous response's next_page field.

Optional<List<BetaAnalyticsUsageCostProductFilter>> products⁠Query parameter

Product surfaces to include. Defaults to all products.

maxItems100
CHAT("chat")
CHAT_COWORK_UNIFIED("chat_cowork_unified")
CLAUDE_CODE("claude_code")
CLAUDE_CONSOLE("claude_console")
CLAUDE_DESIGN("claude_design")
CLAUDE_IN_CHROME("claude_in_chrome")
CLAUDE_TAG("claude_tag")
COWORK("cowork")
MANAGED_AGENTS_API("managed_agents_api")
MESSAGE_BATCHES_API("message_batches_api")
MESSAGES_API("messages_api")
OFFICE_AGENT("office_agent")
Optional<List<String>> rbacGroupIds⁠Query parameter

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.

maxItems100
Optional<List<BetaAnalyticsServiceTier>> serviceTiers⁠Query parameter

Filter to specific service tiers. Use group_by[]=service_tier to break out per-tier values.

maxItems100
BATCH("batch")
FLEX("flex")
FLEX_DISCOUNT("flex_discount")
PRIORITY("priority")
PRIORITY_ON_DEMAND("priority_on_demand")
STANDARD("standard")
Optional<List<String>> sessionIds⁠Query parameter

Filter to usage incurred by specific Claude Managed Agents sessions, by tagged session ID (sesn_...). Use group_by[]=session_id to break out per-session values.

maxItems100
Optional<List<String>> slackChannelIds⁠Query parameter

Filter to usage originating from specific Slack channels. Use group_by[]=slack_channel_id to break out per-channel values.

maxItems100
Optional<List<BetaAnalyticsSpeed>> speeds⁠Query parameter

Filter to fast or standard inference mode. Use group_by[]=speed to break out per-mode values.

maxItems100
FAST("fast")
STANDARD("standard")
Optional<BetaAnalyticsTimeBucketWidth> timeBucketWidth⁠Query parameter

Time-bucket granularity. When set, rows are returned per time bucket (one per bucket and dimension combination with usage) and each row's starting_at and ending_at are that bucket's bounds; the time bucket counts toward limit. ending_at is required when time_bucket_width is set, and with time_bucket_width="1m" the range may span at most 24 hours. When omitted, each row aggregates the requested range with starting_at and ending_at each rounded down to the hour.

Optional<List<String>> userProfileIds⁠Query parameter

Filter to usage attributed to specific user profiles, by tagged user profile ID (uprof_...). Use group_by[]=user_profile_id to break out per-profile values.

maxItems100
Optional<List<String>> workspaceIds⁠Query parameter

Filter to usage in specific workspaces, by tagged workspace ID (wrkspc_...). Use group_by[]=workspace_id to break out per-workspace values.

maxItems100
Optional<List<AnthropicBeta>> betas⁠Header parameter

This endpoint is in beta: requests must send analytics-usage-cost-2026-08-24 in this header.

COMPUTER_USE_2024_10_22("computer-use-2024-10-22")
COMPUTER_USE_2025_01_24("computer-use-2025-01-24")
OUTPUT_128K_2025_02_19("output-128k-2025-02-19")
MCP_CLIENT_2025_04_04("mcp-client-2025-04-04")
MCP_CLIENT_2025_11_20("mcp-client-2025-11-20")
DEV_FULL_THINKING_2025_05_14("dev-full-thinking-2025-05-14")
INTERLEAVED_THINKING_2025_05_14("interleaved-thinking-2025-05-14")
CODE_EXECUTION_2025_05_22("code-execution-2025-05-22")
CONTEXT_1M_2025_08_07("context-1m-2025-08-07")
CONTEXT_MANAGEMENT_2025_06_27("context-management-2025-06-27")
MODEL_CONTEXT_WINDOW_EXCEEDED_2025_08_26("model-context-window-exceeded-2025-08-26")
FAST_MODE_2026_02_01("fast-mode-2026-02-01")
OUTPUT_300K_2026_03_24("output-300k-2026-03-24")
USER_PROFILES_2026_03_24("user-profiles-2026-03-24")
USER_PROFILES_2026_08_18("user-profiles-2026-08-18")
USER_PROFILES_2026_09_04("user-profiles-2026-09-04")
ADVISOR_TOOL_2026_03_01("advisor-tool-2026-03-01")
MANAGED_AGENTS_2026_04_01("managed-agents-2026-04-01")
DREAMING_2026_04_21("dreaming-2026-04-21")
THINKING_TOKEN_COUNT_2026_05_13("thinking-token-count-2026-05-13")
SERVER_SIDE_FALLBACK_2026_06_01("server-side-fallback-2026-06-01")
SERVER_SIDE_FALLBACK_2026_07_01("server-side-fallback-2026-07-01")
FALLBACK_CREDIT_2026_06_01("fallback-credit-2026-06-01")
FALLBACK_CREDIT_2026_07_01("fallback-credit-2026-07-01")
AGENT_MEMORY_2026_07_22("agent-memory-2026-07-22")
MID_CONVERSATION_TOOL_CHANGES_2026_07_01("mid-conversation-tool-changes-2026-07-01")
COMPACT_2026_01_12("compact-2026-01-12")
COMPUTER_USE_2025_11_24("computer-use-2025-11-24")
MCP_TUNNELS_2026_06_22("mcp-tunnels-2026-06-22")
STRUCTURED_OUTPUTS_2025_11_13("structured-outputs-2025-11-13")
TASK_BUDGETS_2026_03_13("task-budgets-2026-03-13")
THINKING_DISPLAY_UPDATES_2026_08_18("thinking-display-updates-2026-08-18")
MID_CONVERSATION_OUTPUT_CONFIG_2026_07_01("mid-conversation-output-config-2026-07-01")
THINKING_BINDING_CONTROLS_2026_08_01("thinking-binding-controls-2026-08-01")
MID_CONVERSATION_SYSTEM_CLEAR_AT_2026_08_21("mid-conversation-system-clear-at-2026-08-21")
COMPACT_2026_09_04("compact-2026-09-04")
INLINE_TOOLS_2026_09_15("inline-tools-2026-09-15")
MCP_CLIENT_2026_09_15("mcp-client-2026-09-15")
CE_PLUGINS_2026_09_01("ce-plugins-2026-09-01")
SPEND_LIMIT_READS_2026_09_26("spend-limit-reads-2026-09-26")
TELEMETRY_DESTINATIONS_2026_08_11("telemetry-destinations-2026-08-11")
WEBHOOKS_2026_10_07("webhooks-2026-10-07")
ADMIN_USER_SIGN_OUT_2026_10_08("admin-user-sign-out-2026-10-08")
MESSAGE_THREADS_2026_08_12("message-threads-2026-08-12")
ANALYTICS_USAGE_COST_2026_08_24("analytics-usage-cost-2026-08-24")
EXPERIMENTAL_CLAUDE_TAG_2026_10_21("experimental-claude-tag-2026-10-21")
CE_CLAUDE_CODE_MANAGED_SETTINGS_2026_10_06("ce-claude-code-managed-settings-2026-10-06")
EFS_2026_10_01("efs-2026-10-01")
GOOGLE_MANAGED_DATA_CONTROLS_2026_09_01("google-managed-data-controls-2026-09-01")
USER_PROFILES_BILLING_2026_10_01("user-profiles-billing-2026-10-01")
MESSAGE_BATCHES_2024_09_24("message-batches-2024-09-24")⁠Deprecated
This value is no longer needed. Remove it from your requests.
PROMPT_CACHING_2024_07_31("prompt-caching-2024-07-31")⁠Deprecated
This value is no longer needed. Remove it from your requests.
PDFS_2024_09_25("pdfs-2024-09-25")⁠Deprecated
This value is no longer needed. Remove it from your requests.
TOKEN_COUNTING_2024_11_01("token-counting-2024-11-01")⁠Deprecated
This value is no longer needed. Remove it from your requests.
TOKEN_EFFICIENT_TOOLS_2025_02_19("token-efficient-tools-2025-02-19")⁠Deprecated
This value is no longer needed. Remove it from your requests.
FILES_API_2025_04_14("files-api-2025-04-14")⁠Deprecated
Sending this value selects the beta response shapes. Removing it moves you to the current shapes, so follow the migration steps: https://platform.claude.com/docs/en/build-with-claude/files#migrate-from-files-api-2025-04-14
EXTENDED_CACHE_TTL_2025_04_11("extended-cache-ttl-2025-04-11")⁠Deprecated
This value is no longer needed. Remove it from your requests.
SKILLS_2025_10_02("skills-2025-10-02")⁠Deprecated
Sending this value selects the beta response shapes. Removing it moves you to the current shapes, so follow the migration steps: https://platform.claude.com/docs/en/build-with-claude/skills-guide#migrate-from-skills-2025-10-02
CACHE_DIAGNOSIS_2026_04_07("cache-diagnosis-2026-04-07")⁠Deprecated
This value is no longer needed. Remove it from your requests.
CE_USER_MANAGEMENT_2026_07_13("ce-user-management-2026-07-13")⁠Deprecated
This value is no longer needed. Remove it from your requests.
Returns
class BetaAnalyticsUsageItem { endingAt; group; startingAt; usage; }
Obtenir l'utilisation des tokens par dimension
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.organization.analytics.usage.UsageListPage;
import com.anthropic.models.beta.organization.analytics.usage.UsageListParams;
import java.time.OffsetDateTime;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        UsageListParams params = UsageListParams.builder()
            .startingAt(OffsetDateTime.parse("2026-09-01T00:00:00Z"))
            .build();
        UsageListPage page = client.beta().organization().analytics().usage().list(params);
    }
}
Returns Examples
Response 200
{
  "data": [
    {
      "ending_at": "2026-10-01T00:00:00Z",
      "group": {
        "actor": {
          "deleted": false,
          "email_address": "user@emaildomain.com",
          "name": "Jane Doe",
          "type": "user_actor",
          "user_id": "user_01WxYzAbCdEfGhJkMnPqRsTu"
        },
        "actor_type": "user_actor",
        "agent_id": "agent_01VHd3EAGJ6PLkP9LM7DDu3f",
        "api_key_id": "apikey_01BcDeFgHjKmNpQrStUvWxYz",
        "claude_tag_category": "dm",
        "claude_tag_user_id": "U0123ABCDEF",
        "context_window": "0-200k",
        "deployment_id": "depl_01JFC6ihzZHtAuyHsaENdJhY",
        "environment_id": "env_017oTjuGedHtjhJauVC5xGJD",
        "inference_geo": "global",
        "model": "claude-opus-5-5",
        "organization_id": "12345678-1234-5678-1234-567812345678",
        "product": "chat",
        "rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",
        "service_tier": "standard",
        "session_id": "sesn_0187kPDyNCwibNNvfaPEApCJ",
        "slack_channel_id": "C0123ABCDEF",
        "speed": "fast",
        "user_profile_id": "uprof_01M33NeYUQK2WV9PpYcsPHLi",
        "workspace_id": "wrkspc_01AbCdEfGhJkLmNpQrStUvWx"
      },
      "starting_at": "2026-09-01T00:00:00Z",
      "usage": {
        "cache_creation": {
          "ephemeral_1h_input_tokens": 0,
          "ephemeral_5m_input_tokens": 0
        },
        "cache_read_input_tokens": 3200000,
        "output_tokens": 891000,
        "requests": 128,
        "server_tool_use": {
          "web_search_requests": 10
        },
        "total_tokens": 5375500,
        "uncached_input_tokens": 1284500
      }
    }
  ],
  "data_refreshed_at": "2026-10-01T04:02:11Z",
  "has_more": true,
  "next_page": "next_page"
}