SPB Git

Repository Public

usage.md 42.5 KB 1,088 lines markdown

1---2title: Usage3url: https://platform.claude.com/docs/en/api/beta/organization/analytics/usage4---56# Usage78## Get Token Usage Over Time910**GET** `/v1/organizations/analytics/usage_report`1112Get token usage over time across a date range.1314Returns token usage bucketed by minute, hour, or day, optionally broken15down by product, model, context window, inference region, or speed.16Available to organizations on a Claude Enterprise plan. Requires an API17key with the `read:analytics` scope.1819### Query parameters2021- `starting_at: string`2223  Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days and no earlier than 2026-01-01T00:00:00Z.2425  format: date-time2627- `bucket_width: optional "1d" or "1h" or "1m"`2829  Time bucket granularity.3031  default: 1d3233  - `"1d"`3435  - `"1h"`3637  - `"1m"`3839- `claude_tag_categories: optional array of "dm" or "engaged" or "monitoring" or 2 more`4041  Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage with no category never matches. `dm` usage is reported under the user's product rather than `claude-tag`, so combining this filter with `products[]=claude-tag` excludes it. Use `group_by[]=claude_tag_category` to break out per-category values.4243  maxItems: 1004445  - `"dm"`4647  - `"engaged"`4849  - `"monitoring"`5051  - `"proactive"`5253  - `"scheduled"`5455- `claude_tag_user_ids: optional array of string`5657  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.5859  maxItems: 1006061- `context_windows: optional array of "0-200k" or "200k-1M"`6263  Filter to specific context-window pricing tiers. Use `group_by[]=context_window` to break out per-tier values.6465  maxItems: 1006667  - `"0-200k"`6869  - `"200k-1M"`7071- `ending_at: optional string`7273  End of range, exclusive. When omitted, defaults to the earlier of now and `starting_at` + 31 days. The range may span at most 31 days.7475  format: date-time7677- `group_by: optional array of "claude_tag_category" or "claude_tag_user_id" or "context_window" or 6 more`7879  Dimensions to break each time bucket out by. Defaults to no grouping (one total per bucket). Each bucket reports at most its top 100 groups; a group beyond that cap has no row in that bucket (there is no remainder row), so grouped buckets are not exhaustive when a dimension has more than 100 distinct values.8081  maxItems: 1008283  - `"claude_tag_category"`8485  - `"claude_tag_user_id"`8687  - `"context_window"`8889  - `"inference_geo"`9091  - `"model"`9293  - `"product"`9495  - `"rbac_group_id"`9697  - `"slack_channel_id"`9899  - `"speed"`100101- `inference_geos: optional array of "global" or "not_available" or "us"`102103  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.104105  maxItems: 100106107  - `"global"`108109  - `"not_available"`110111  - `"us"`112113- `limit: optional number`114115  Maximum number of time buckets per page. Defaults and caps vary by `bucket_width` (`1d`: default 7, max 31; `1h`: default 24, max 168; `1m`: default 60, max 256).116117  minimum: 1118119- `models: optional array of string`120121  Models to include. Defaults to all models. Use `group_by[]=model` to break out per-model values.122123  maxItems: 100124125- `page: optional string`126127  Opaque cursor from a previous response's `next_page` field.128129- `products: optional array of "chat" or "claude-tag" or "claude_code" or 4 more`130131  Product surfaces to include. Defaults to all products. Use `group_by[]=product` to break out per-product values.132133  maxItems: 100134135  - `"chat"`136137  - `"claude-tag"`138139  - `"claude_code"`140141  - `"claude_design"`142143  - `"claude_in_chrome"`144145  - `"cowork"`146147  - `"office_agent"`148149- `rbac_group_ids: optional array of string`150151  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.152153  maxItems: 100154155- `slack_channel_ids: optional array of string`156157  Filter to usage originating from specific Slack channels. Use `group_by[]=slack_channel_id` to break out per-channel values.158159  maxItems: 100160161- `speeds: optional array of "fast" or "standard"`162163  Filter to fast or standard inference mode. Use `group_by[]=speed` to break out per-mode values.164165  maxItems: 100166167  - `"fast"`168169  - `"standard"`170171- `user_ids: optional array of string`172173  Filter to specific users by tagged user ID.174175  maxItems: 100176177### Returns178179- `BetaUsageBucket object`180181  - `data: array of object`182183    Time buckets for this page, oldest first: one per `bucket_width` interval, including intervals with no data (their `results` list is empty). A page holds at most `limit` buckets.184185    - `ending_at: string`186187      End of the time bucket (exclusive) in RFC 3339 format.188189      format: date-time190191    - `results: array of object`192193      Rows for this time bucket. Empty when the bucket has no data; otherwise a single combined row when `group_by[]` is omitted, or one row per group (subject to the per-bucket group cap described on the `group_by[]` parameter).194195      - `cache_creation: BetaCacheCreation`196197        The number of input tokens for cache creation.198199        - `ephemeral_1h_input_tokens: number`200201          The number of input tokens used to create the 1 hour cache entry.202203          default: 0, minimum: 0204205        - `ephemeral_5m_input_tokens: number`206207          The number of input tokens used to create the 5 minute cache entry.208209          default: 0, minimum: 0210211      - `cache_read_input_tokens: number`212213        The number of input tokens read from the cache.214215      - `claude_tag_category: "dm" or "engaged" or "monitoring" or 2 more or null`216217        Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed Claude in a channel or thread), `proactive` (Claude responded without being addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching a channel it was asked to monitor), or `dm` (direct messages with Claude). Populated only when `claude_tag_category` is in `group_by[]`; null for usage that is not Claude Tag. Direct-message usage is billed to the individual user and is reported under that user's product, not under `claude-tag`. New categories may be added over time.218219        - `"dm"`220221        - `"engaged"`222223        - `"monitoring"`224225        - `"proactive"`226227        - `"scheduled"`228229      - `claude_tag_user_id: string or null`230231        Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude in Slack) usage is attributed to, not a claude.ai user ID. Populated only when `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag and for Claude Tag usage that is not attributed to a single user (for example `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum to less than the Claude Tag total. Cannot be combined with `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.232233      - `context_window: "0-200k" or "200k-1M" or null`234235        Context-window pricing tier of the usage or cost. Null unless `context_window` is in `group_by[]`; it can also be null on grouped rows with no context-window tier, such as code execution.236237        - `"0-200k"`238239        - `"200k-1M"`240241      - `inference_geo: "global" or "us" or null`242243        Inference region of the usage or cost. Null unless `inference_geo` is in `group_by[]`; it can also be null on grouped rows where the region is not set (the rows that `inference_geos[]=not_available` matches).244245        - `"global"`246247        - `"us"`248249      - `model: string or null`250251        Model that produced the usage or cost, as a model name in the form the `models[]` filter accepts (for example, `claude-opus-5`). Null unless `model` is in `group_by[]`; it can also be null on grouped rows whose usage or cost is not attributed to a specific model, such as code execution.252253      - `output_tokens: number`254255        The number of output tokens generated.256257      - `product: string or null`258259        Product surface that produced the usage or cost. Null unless product is in `group_by[]`; it can also be null on grouped rows whose usage cannot be attributed to a known surface. Values include `chat`, `claude_code`, `cowork`, `office_agent`, `claude_in_chrome`, `claude_design`, and `claude-tag`. `claude-tag` is Claude Tag, the Claude product in Slack. Some unattributed usage is reported as "other".260261      - `rbac_group_id: string or null`262263        RBAC group (team) the usage is attributed to, in the public tagged `rbac_group_...` spelling — the same spelling the activity resources use for this key, so the same team has one id across resources and it round-trips as an `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in `group_by[]`. Any-membership semantics: a user in several groups contributes their full usage to each of those groups' rows, so the named-group rows overlap and their sum can exceed the org total. A null value is the single unassigned row: users in no group on that (UTC) day. For the true org total, run the same query without `group_by[]`.264265      - `requests: number or null`266267        Number of API requests in this row's scope. For sandbox / code-execution events, this counts execution spans rather than HTTP requests (these rows surface with `product: null`).268269      - `server_tool_use: object`270271        Server-side tool usage metrics.272273        - `web_search_requests: number`274275          The number of web search requests made.276277      - `slack_channel_id: string or null`278279        Slack channel the usage originated from. Populated only when `slack_channel_id` is in `group_by[]`; null for usage outside Slack (and for rows recorded before channel attribution was enabled).280281      - `speed: "fast" or "standard" or null`282283        Inference speed mode of the usage or cost: `fast` or `standard`. Null unless `speed` is in `group_by[]`.284285        - `"fast"`286287        - `"standard"`288289      - `uncached_input_tokens: number`290291        The number of uncached input tokens processed.292293    - `starting_at: string`294295      Start of the time bucket (inclusive) in RFC 3339 format.296297      format: date-time298299  - `data_refreshed_at: string or null`300301    RFC 3339 timestamp of the export this response was served from. Null when no export yet covers any part of the requested range, in which case every bucket's `results` list is empty. Buckets beyond this watermark are incomplete; for stable results, set `ending_at` to this value or earlier. Data is typically refreshed every 4 hours but not final until about 30 days after the usage date (late-arriving events, reconciliation adjustments).302303    format: date-time304305  - `has_more: boolean`306307    Whether another page is available. When true, pass `next_page` as the `page` parameter to fetch it.308309  - `next_page: string or null`310311    Opaque cursor for the next page, or null when `has_more` is false. Pass it as the `page` parameter, keeping the other parameters unchanged. A cursor can expire after the underlying data refreshes; the request then returns HTTP 410 and pagination must restart from the first page.312313  - `organization_id: string`314315    ID of the Organization.316317### Example318319```bash320curl https://api.anthropic.com/v1/organizations/analytics/usage_report \321    -H 'anthropic-version: 2023-06-01' \322    -H "X-Api-Key: $ANTHROPIC_API_KEY"323```324325#### Response (200)326327```json328{329  "data": [330    {331      "ending_at": "2019-12-27T18:11:19.117Z",332      "results": [333        {334          "cache_creation": {335            "ephemeral_1h_input_tokens": 0,336            "ephemeral_5m_input_tokens": 0337          },338          "cache_read_input_tokens": 0,339          "claude_tag_category": "dm",340          "claude_tag_user_id": "U0123ABCDEF",341          "context_window": "0-200k",342          "inference_geo": "global",343          "model": "claude-opus-5",344          "output_tokens": 0,345          "product": "chat",346          "rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",347          "requests": 0,348          "server_tool_use": {349            "web_search_requests": 10350          },351          "slack_channel_id": "C0123ABCDEF",352          "speed": "fast",353          "uncached_input_tokens": 0354        }355      ],356      "starting_at": "2019-12-27T18:11:19.117Z"357    }358  ],359  "data_refreshed_at": "2019-12-27T18:11:19.117Z",360  "has_more": true,361  "next_page": "next_page",362  "organization_id": "org_013FP9SaFPBg7Kw7fetjn6cF"363}364```365366## Get Per-User Token Usage367368**GET** `/v1/organizations/analytics/user_usage_report`369370Get per-user token usage across a date range.371372Returns one row per user, ranked by the chosen token metric. Use this to373see which users consume the most tokens. Only usage attributable to a374seat user is included; for organization-wide totals including direct375API-key and automation traffic, use the bucketed376`/v1/organizations/analytics/usage_report` endpoint. Available to377organizations on a Claude Enterprise plan. Requires an API key with the378`read:analytics` scope.379380### Query parameters381382- `starting_at: string`383384  Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days and no earlier than 2026-01-01T00:00:00Z.385386  format: date-time387388- `bucket_width: optional "1d" or "1h" or "1m"`389390  Time-bucket granularity. When set, each row's `starting_at` and `ending_at` are populated and one actor may span several rows (one per time bucket with usage). The time bucket counts toward `limit`, so one page can return multiple rows for the same actor. `ending_at` is required when `bucket_width` is set, and with `bucket_width="1m"` the range may span at most 24 hours. When omitted, each row aggregates the full `[starting_at, ending_at)` range.391392  - `"1d"`393394  - `"1h"`395396  - `"1m"`397398- `claude_tag_categories: optional array of "dm" or "engaged" or "monitoring" or 2 more`399400  Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage with no category never matches. `dm` usage is reported under the user's product rather than `claude-tag`, so combining this filter with `products[]=claude-tag` excludes it. Use `group_by[]=claude_tag_category` to break out per-category values.401402  maxItems: 100403404  - `"dm"`405406  - `"engaged"`407408  - `"monitoring"`409410  - `"proactive"`411412  - `"scheduled"`413414- `claude_tag_user_ids: optional array of string`415416  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.417418  maxItems: 100419420- `context_windows: optional array of "0-200k" or "200k-1M"`421422  Filter to specific context-window pricing tiers. Use `group_by[]=context_window` to break out per-tier values.423424  maxItems: 100425426  - `"0-200k"`427428  - `"200k-1M"`429430- `ending_at: optional string`431432  End of range, exclusive. When omitted, defaults to the earlier of now and `starting_at` + 31 days. The range may span at most 31 days.433434  format: date-time435436- `exclude_deleted_users: optional boolean`437438  If true, omit rows for users who are deleted (`deleted: true`). A page may contain fewer than `limit` rows; use `has_more` and `next_page` to paginate as usual.439440  default: false441442- `group_by: optional array of "claude_tag_category" or "claude_tag_user_id" or "context_window" or 6 more`443444  Break each actor's row out by the given dimensions. Accepts the same values as the bucketed `/usage_report` endpoint. `limit` bounds (actor × time bucket × dimension) rows — with dimensions or `bucket_width` present, one actor may span several rows.445446  maxItems: 100447448  - `"claude_tag_category"`449450  - `"claude_tag_user_id"`451452  - `"context_window"`453454  - `"inference_geo"`455456  - `"model"`457458  - `"product"`459460  - `"rbac_group_id"`461462  - `"slack_channel_id"`463464  - `"speed"`465466- `inference_geos: optional array of "global" or "not_available" or "us"`467468  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.469470  maxItems: 100471472  - `"global"`473474  - `"not_available"`475476  - `"us"`477478- `limit: optional number`479480  Number of rows per page (1-1000, default 20). One row per actor unless `group_by[]` or `bucket_width` splits an actor across rows; `cost_type`/`token_type` fan-out rows (cost endpoint only) are the exception — they do not count toward this limit, so `data` can exceed it.481482  default: 20, maximum: 1000, minimum: 1483484- `models: optional array of string`485486  Models to include. Defaults to all models. Use `group_by[]=model` to break out per-model values.487488  maxItems: 100489490- `order: optional "asc" or "desc"`491492  Sort direction. Defaults to `desc`.493494  default: desc495496  - `"asc"`497498  - `"desc"`499500- `order_by: optional "output_tokens" or "requests" or "total_tokens" or "uncached_input_tokens"`501502  Metric to rank actors by. Defaults to `total_tokens`.503504  default: total_tokens505506  - `"output_tokens"`507508  - `"requests"`509510  - `"total_tokens"`511512  - `"uncached_input_tokens"`513514- `page: optional string`515516  Opaque cursor from a previous response's `next_page` field.517518- `products: optional array of "chat" or "claude-tag" or "claude_code" or 4 more`519520  Product surfaces to include. Defaults to all products.521522  maxItems: 100523524  - `"chat"`525526  - `"claude-tag"`527528  - `"claude_code"`529530  - `"claude_design"`531532  - `"claude_in_chrome"`533534  - `"cowork"`535536  - `"office_agent"`537538- `rbac_group_ids: optional array of string`539540  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.541542  maxItems: 100543544- `slack_channel_ids: optional array of string`545546  Filter to usage originating from specific Slack channels. Use `group_by[]=slack_channel_id` to break out per-channel values.547548  maxItems: 100549550- `speeds: optional array of "fast" or "standard"`551552  Filter to fast or standard inference mode. Use `group_by[]=speed` to break out per-mode values.553554  maxItems: 100555556  - `"fast"`557558  - `"standard"`559560- `user_ids: optional array of string`561562  Filter to specific users by tagged user ID.563564  maxItems: 100565566### Returns567568- `BetaUserUsage object`569570  - `data: array of object`571572    Rows for this page, ranked by `order_by` in the `order` direction. One row per user, or several per user when `group_by[]` or `bucket_width` breaks that user's usage or cost out across rows. Rows split out by `cost_type` or `token_type` (cost endpoint only) stay adjacent and are ranked as one unit.573574    - `actor: BetaAnalyticsUserActor`575576      The user this row's usage or cost is attributed to. Always a `user_actor`.577578      - `type: "user_actor"`579580        Actor type. Always `"user_actor"`.581582      - `deleted: boolean`583584        True when the account has been deleted, or when the user is no longer a member of the organization or its associated organizations (for example, their membership was removed or they were deprovisioned via your identity provider). `email` stays populated for removed users and is null when the account has been deleted. `name` follows the rules described on that field. The `user_id` is still populated for reconciliation.585586      - `email: string or null`587588        The user's email address, including for users who are no longer members of the organization or its associated organizations. Null when the account has been deleted (check `deleted`) and for system-minted service accounts, which have no person's mailbox behind them (check `name`).589590      - `name: string or null`591592        The user's full name. Null when the user has not set a name. Returns `"Deleted User"` when the account itself has been deleted, or when the user is no longer a member of the organization or its associated organizations and the organization has chosen to hide the names of removed users. Otherwise, the name stays populated for removed users. Rows for system-minted service accounts render the service name (for example, `"Claude Security"` for usage by Anthropic's security-patching service) or null.593594      - `user_id: string`595596        Tagged user ID.597598    - `cache_creation: BetaCacheCreation`599600      The number of input tokens for cache creation.601602      - `ephemeral_1h_input_tokens: number`603604        The number of input tokens used to create the 1 hour cache entry.605606        default: 0, minimum: 0607608      - `ephemeral_5m_input_tokens: number`609610        The number of input tokens used to create the 5 minute cache entry.611612        default: 0, minimum: 0613614    - `cache_read_input_tokens: number`615616      The number of input tokens read from the cache.617618    - `claude_tag_category: "dm" or "engaged" or "monitoring" or 2 more or null`619620      Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed Claude in a channel or thread), `proactive` (Claude responded without being addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching a channel it was asked to monitor), or `dm` (direct messages with Claude). Populated only when `claude_tag_category` is in `group_by[]`; null for usage that is not Claude Tag. Direct-message usage is billed to the individual user and is reported under that user's product, not under `claude-tag`. New categories may be added over time.621622      - `"dm"`623624      - `"engaged"`625626      - `"monitoring"`627628      - `"proactive"`629630      - `"scheduled"`631632    - `claude_tag_user_id: string or null`633634      Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude in Slack) usage is attributed to, not a claude.ai user ID. Populated only when `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag and for Claude Tag usage that is not attributed to a single user (for example `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum to less than the Claude Tag total. Cannot be combined with `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.635636    - `context_window: "0-200k" or "200k-1M" or null`637638      Context-window pricing tier of the usage or cost. Null unless `context_window` is in `group_by[]`; it can also be null on grouped rows with no context-window tier, such as code execution.639640      - `"0-200k"`641642      - `"200k-1M"`643644    - `ending_at: string or null`645646      End of the row's UTC time bucket (exclusive), as an RFC 3339 timestamp; equal to `starting_at` plus one `bucket_width`. Null unless `bucket_width` is set.647648      format: date-time649650    - `inference_geo: "global" or "us" or null`651652      Inference region of the usage or cost. Null unless `inference_geo` is in `group_by[]`; it can also be null on grouped rows where the region is not set (the rows that `inference_geos[]=not_available` matches).653654      - `"global"`655656      - `"us"`657658    - `model: string or null`659660      Model that produced the usage or cost, as a model name in the form the `models[]` filter accepts (for example, `claude-opus-5`). Null unless `model` is in `group_by[]`; it can also be null on grouped rows whose usage or cost is not attributed to a specific model, such as code execution.661662    - `output_tokens: number`663664      The number of output tokens generated.665666    - `product: string or null`667668      Product surface that produced the usage or cost. Null unless product is in `group_by[]`; it can also be null on grouped rows whose usage cannot be attributed to a known surface. Values include `chat`, `claude_code`, `cowork`, `office_agent`, `claude_in_chrome`, `claude_design`, and `claude-tag`. `claude-tag` is Claude Tag, the Claude product in Slack. Some unattributed usage is reported as "other".669670    - `rbac_group_id: string or null`671672      RBAC group (team) the usage is attributed to, in the public tagged `rbac_group_...` spelling — the same spelling the activity resources use for this key, so the same team has one id across resources and it round-trips as an `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in `group_by[]`. Any-membership semantics: a user in several groups contributes their full usage to each of those groups' rows, so the named-group rows overlap and their sum can exceed the org total. A null value is the single unassigned row: users in no group on that (UTC) day. For the true org total, run the same query without `group_by[]`.673674    - `requests: number or null`675676      Number of API requests in this row's scope. For sandbox / code-execution events, this counts execution spans rather than HTTP requests (these rows surface with `product: null`).677678    - `server_tool_use: object`679680      Server-side tool usage metrics.681682      - `web_search_requests: number`683684        The number of web search requests made.685686    - `slack_channel_id: string or null`687688      Slack channel the usage originated from. Populated only when `slack_channel_id` is in `group_by[]`; null for usage outside Slack (and for rows recorded before channel attribution was enabled).689690    - `speed: "fast" or "standard" or null`691692      Inference speed mode of the usage or cost: `fast` or `standard`. Null unless `speed` is in `group_by[]`.693694      - `"fast"`695696      - `"standard"`697698    - `starting_at: string or null`699700      Start of the row's UTC time bucket (inclusive), as an RFC 3339 timestamp. Null unless `bucket_width` is set; without `bucket_width`, each row aggregates the full requested range.701702      format: date-time703704    - `total_tokens: number`705706      Total token count across all token types. This is the value the default `order_by` (`total_tokens`) sorts on.707708    - `uncached_input_tokens: number`709710      The number of uncached input tokens processed.711712  - `data_refreshed_at: string or null`713714    RFC 3339 timestamp of the export this response was served from. Null when no export yet covers any part of the requested range, in which case `data` is empty. Data beyond this watermark is incomplete; for stable results, set `ending_at` to this value or earlier. Data is typically refreshed every 4 hours but not final until about 30 days after the usage date (late-arriving events, reconciliation adjustments).715716    format: date-time717718  - `has_more: boolean`719720    Whether another page is available. When true, pass `next_page` as the `page` parameter to fetch it.721722  - `next_page: string or null`723724    Opaque cursor for the next page, or null when `has_more` is false. Pass it as the `page` parameter, keeping the other parameters unchanged. A cursor can expire after the underlying data refreshes; the request then returns HTTP 410 and pagination must restart from the first page.725726  - `organization_id: string`727728    ID of the Organization.729730### Example731732```bash733curl https://api.anthropic.com/v1/organizations/analytics/user_usage_report \734    -H 'anthropic-version: 2023-06-01' \735    -H "X-Api-Key: $ANTHROPIC_API_KEY"736```737738#### Response (200)739740```json741{742  "data": [743    {744      "actor": {745        "deleted": true,746        "email": "jane@example.com",747        "name": "Jane Smith",748        "type": "user_actor",749        "user_id": "user_01AbCdEfGhIjKlMnOpQrSt"750      },751      "cache_creation": {752        "ephemeral_1h_input_tokens": 0,753        "ephemeral_5m_input_tokens": 0754      },755      "cache_read_input_tokens": 3200000,756      "claude_tag_category": "dm",757      "claude_tag_user_id": "U0123ABCDEF",758      "context_window": "0-200k",759      "ending_at": "2019-12-27T18:11:19.117Z",760      "inference_geo": "global",761      "model": "claude-opus-5",762      "output_tokens": 891000,763      "product": "chat",764      "rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",765      "requests": 128,766      "server_tool_use": {767        "web_search_requests": 10768      },769      "slack_channel_id": "C0123ABCDEF",770      "speed": "fast",771      "starting_at": "2019-12-27T18:11:19.117Z",772      "total_tokens": 5377000,773      "uncached_input_tokens": 1284500774    }775  ],776  "data_refreshed_at": "2019-12-27T18:11:19.117Z",777  "has_more": true,778  "next_page": "next_page",779  "organization_id": "org_013FP9SaFPBg7Kw7fetjn6cF"780}781```782783## Domain types784785### Beta Usage Bucket786787- `BetaUsageBucket object`788789  - `data: array of object`790791    Time buckets for this page, oldest first: one per `bucket_width` interval, including intervals with no data (their `results` list is empty). A page holds at most `limit` buckets.792793    - `ending_at: string`794795      End of the time bucket (exclusive) in RFC 3339 format.796797      format: date-time798799    - `results: array of object`800801      Rows for this time bucket. Empty when the bucket has no data; otherwise a single combined row when `group_by[]` is omitted, or one row per group (subject to the per-bucket group cap described on the `group_by[]` parameter).802803      - `cache_creation: BetaCacheCreation`804805        The number of input tokens for cache creation.806807        - `ephemeral_1h_input_tokens: number`808809          The number of input tokens used to create the 1 hour cache entry.810811          default: 0, minimum: 0812813        - `ephemeral_5m_input_tokens: number`814815          The number of input tokens used to create the 5 minute cache entry.816817          default: 0, minimum: 0818819      - `cache_read_input_tokens: number`820821        The number of input tokens read from the cache.822823      - `claude_tag_category: "dm" or "engaged" or "monitoring" or 2 more or null`824825        Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed Claude in a channel or thread), `proactive` (Claude responded without being addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching a channel it was asked to monitor), or `dm` (direct messages with Claude). Populated only when `claude_tag_category` is in `group_by[]`; null for usage that is not Claude Tag. Direct-message usage is billed to the individual user and is reported under that user's product, not under `claude-tag`. New categories may be added over time.826827        - `"dm"`828829        - `"engaged"`830831        - `"monitoring"`832833        - `"proactive"`834835        - `"scheduled"`836837      - `claude_tag_user_id: string or null`838839        Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude in Slack) usage is attributed to, not a claude.ai user ID. Populated only when `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag and for Claude Tag usage that is not attributed to a single user (for example `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum to less than the Claude Tag total. Cannot be combined with `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.840841      - `context_window: "0-200k" or "200k-1M" or null`842843        Context-window pricing tier of the usage or cost. Null unless `context_window` is in `group_by[]`; it can also be null on grouped rows with no context-window tier, such as code execution.844845        - `"0-200k"`846847        - `"200k-1M"`848849      - `inference_geo: "global" or "us" or null`850851        Inference region of the usage or cost. Null unless `inference_geo` is in `group_by[]`; it can also be null on grouped rows where the region is not set (the rows that `inference_geos[]=not_available` matches).852853        - `"global"`854855        - `"us"`856857      - `model: string or null`858859        Model that produced the usage or cost, as a model name in the form the `models[]` filter accepts (for example, `claude-opus-5`). Null unless `model` is in `group_by[]`; it can also be null on grouped rows whose usage or cost is not attributed to a specific model, such as code execution.860861      - `output_tokens: number`862863        The number of output tokens generated.864865      - `product: string or null`866867        Product surface that produced the usage or cost. Null unless product is in `group_by[]`; it can also be null on grouped rows whose usage cannot be attributed to a known surface. Values include `chat`, `claude_code`, `cowork`, `office_agent`, `claude_in_chrome`, `claude_design`, and `claude-tag`. `claude-tag` is Claude Tag, the Claude product in Slack. Some unattributed usage is reported as "other".868869      - `rbac_group_id: string or null`870871        RBAC group (team) the usage is attributed to, in the public tagged `rbac_group_...` spelling — the same spelling the activity resources use for this key, so the same team has one id across resources and it round-trips as an `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in `group_by[]`. Any-membership semantics: a user in several groups contributes their full usage to each of those groups' rows, so the named-group rows overlap and their sum can exceed the org total. A null value is the single unassigned row: users in no group on that (UTC) day. For the true org total, run the same query without `group_by[]`.872873      - `requests: number or null`874875        Number of API requests in this row's scope. For sandbox / code-execution events, this counts execution spans rather than HTTP requests (these rows surface with `product: null`).876877      - `server_tool_use: object`878879        Server-side tool usage metrics.880881        - `web_search_requests: number`882883          The number of web search requests made.884885      - `slack_channel_id: string or null`886887        Slack channel the usage originated from. Populated only when `slack_channel_id` is in `group_by[]`; null for usage outside Slack (and for rows recorded before channel attribution was enabled).888889      - `speed: "fast" or "standard" or null`890891        Inference speed mode of the usage or cost: `fast` or `standard`. Null unless `speed` is in `group_by[]`.892893        - `"fast"`894895        - `"standard"`896897      - `uncached_input_tokens: number`898899        The number of uncached input tokens processed.900901    - `starting_at: string`902903      Start of the time bucket (inclusive) in RFC 3339 format.904905      format: date-time906907  - `data_refreshed_at: string or null`908909    RFC 3339 timestamp of the export this response was served from. Null when no export yet covers any part of the requested range, in which case every bucket's `results` list is empty. Buckets beyond this watermark are incomplete; for stable results, set `ending_at` to this value or earlier. Data is typically refreshed every 4 hours but not final until about 30 days after the usage date (late-arriving events, reconciliation adjustments).910911    format: date-time912913  - `has_more: boolean`914915    Whether another page is available. When true, pass `next_page` as the `page` parameter to fetch it.916917  - `next_page: string or null`918919    Opaque cursor for the next page, or null when `has_more` is false. Pass it as the `page` parameter, keeping the other parameters unchanged. A cursor can expire after the underlying data refreshes; the request then returns HTTP 410 and pagination must restart from the first page.920921  - `organization_id: string`922923    ID of the Organization.924925### Beta User Usage926927- `BetaUserUsage object`928929  - `data: array of object`930931    Rows for this page, ranked by `order_by` in the `order` direction. One row per user, or several per user when `group_by[]` or `bucket_width` breaks that user's usage or cost out across rows. Rows split out by `cost_type` or `token_type` (cost endpoint only) stay adjacent and are ranked as one unit.932933    - `actor: BetaAnalyticsUserActor`934935      The user this row's usage or cost is attributed to. Always a `user_actor`.936937      - `type: "user_actor"`938939        Actor type. Always `"user_actor"`.940941      - `deleted: boolean`942943        True when the account has been deleted, or when the user is no longer a member of the organization or its associated organizations (for example, their membership was removed or they were deprovisioned via your identity provider). `email` stays populated for removed users and is null when the account has been deleted. `name` follows the rules described on that field. The `user_id` is still populated for reconciliation.944945      - `email: string or null`946947        The user's email address, including for users who are no longer members of the organization or its associated organizations. Null when the account has been deleted (check `deleted`) and for system-minted service accounts, which have no person's mailbox behind them (check `name`).948949      - `name: string or null`950951        The user's full name. Null when the user has not set a name. Returns `"Deleted User"` when the account itself has been deleted, or when the user is no longer a member of the organization or its associated organizations and the organization has chosen to hide the names of removed users. Otherwise, the name stays populated for removed users. Rows for system-minted service accounts render the service name (for example, `"Claude Security"` for usage by Anthropic's security-patching service) or null.952953      - `user_id: string`954955        Tagged user ID.956957    - `cache_creation: BetaCacheCreation`958959      The number of input tokens for cache creation.960961      - `ephemeral_1h_input_tokens: number`962963        The number of input tokens used to create the 1 hour cache entry.964965        default: 0, minimum: 0966967      - `ephemeral_5m_input_tokens: number`968969        The number of input tokens used to create the 5 minute cache entry.970971        default: 0, minimum: 0972973    - `cache_read_input_tokens: number`974975      The number of input tokens read from the cache.976977    - `claude_tag_category: "dm" or "engaged" or "monitoring" or 2 more or null`978979      Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed Claude in a channel or thread), `proactive` (Claude responded without being addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching a channel it was asked to monitor), or `dm` (direct messages with Claude). Populated only when `claude_tag_category` is in `group_by[]`; null for usage that is not Claude Tag. Direct-message usage is billed to the individual user and is reported under that user's product, not under `claude-tag`. New categories may be added over time.980981      - `"dm"`982983      - `"engaged"`984985      - `"monitoring"`986987      - `"proactive"`988989      - `"scheduled"`990991    - `claude_tag_user_id: string or null`992993      Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude in Slack) usage is attributed to, not a claude.ai user ID. Populated only when `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag and for Claude Tag usage that is not attributed to a single user (for example `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum to less than the Claude Tag total. Cannot be combined with `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.994995    - `context_window: "0-200k" or "200k-1M" or null`996997      Context-window pricing tier of the usage or cost. Null unless `context_window` is in `group_by[]`; it can also be null on grouped rows with no context-window tier, such as code execution.998999      - `"0-200k"`10001001      - `"200k-1M"`10021003    - `ending_at: string or null`10041005      End of the row's UTC time bucket (exclusive), as an RFC 3339 timestamp; equal to `starting_at` plus one `bucket_width`. Null unless `bucket_width` is set.10061007      format: date-time10081009    - `inference_geo: "global" or "us" or null`10101011      Inference region of the usage or cost. Null unless `inference_geo` is in `group_by[]`; it can also be null on grouped rows where the region is not set (the rows that `inference_geos[]=not_available` matches).10121013      - `"global"`10141015      - `"us"`10161017    - `model: string or null`10181019      Model that produced the usage or cost, as a model name in the form the `models[]` filter accepts (for example, `claude-opus-5`). Null unless `model` is in `group_by[]`; it can also be null on grouped rows whose usage or cost is not attributed to a specific model, such as code execution.10201021    - `output_tokens: number`10221023      The number of output tokens generated.10241025    - `product: string or null`10261027      Product surface that produced the usage or cost. Null unless product is in `group_by[]`; it can also be null on grouped rows whose usage cannot be attributed to a known surface. Values include `chat`, `claude_code`, `cowork`, `office_agent`, `claude_in_chrome`, `claude_design`, and `claude-tag`. `claude-tag` is Claude Tag, the Claude product in Slack. Some unattributed usage is reported as "other".10281029    - `rbac_group_id: string or null`10301031      RBAC group (team) the usage is attributed to, in the public tagged `rbac_group_...` spelling — the same spelling the activity resources use for this key, so the same team has one id across resources and it round-trips as an `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in `group_by[]`. Any-membership semantics: a user in several groups contributes their full usage to each of those groups' rows, so the named-group rows overlap and their sum can exceed the org total. A null value is the single unassigned row: users in no group on that (UTC) day. For the true org total, run the same query without `group_by[]`.10321033    - `requests: number or null`10341035      Number of API requests in this row's scope. For sandbox / code-execution events, this counts execution spans rather than HTTP requests (these rows surface with `product: null`).10361037    - `server_tool_use: object`10381039      Server-side tool usage metrics.10401041      - `web_search_requests: number`10421043        The number of web search requests made.10441045    - `slack_channel_id: string or null`10461047      Slack channel the usage originated from. Populated only when `slack_channel_id` is in `group_by[]`; null for usage outside Slack (and for rows recorded before channel attribution was enabled).10481049    - `speed: "fast" or "standard" or null`10501051      Inference speed mode of the usage or cost: `fast` or `standard`. Null unless `speed` is in `group_by[]`.10521053      - `"fast"`10541055      - `"standard"`10561057    - `starting_at: string or null`10581059      Start of the row's UTC time bucket (inclusive), as an RFC 3339 timestamp. Null unless `bucket_width` is set; without `bucket_width`, each row aggregates the full requested range.10601061      format: date-time10621063    - `total_tokens: number`10641065      Total token count across all token types. This is the value the default `order_by` (`total_tokens`) sorts on.10661067    - `uncached_input_tokens: number`10681069      The number of uncached input tokens processed.10701071  - `data_refreshed_at: string or null`10721073    RFC 3339 timestamp of the export this response was served from. Null when no export yet covers any part of the requested range, in which case `data` is empty. Data beyond this watermark is incomplete; for stable results, set `ending_at` to this value or earlier. Data is typically refreshed every 4 hours but not final until about 30 days after the usage date (late-arriving events, reconciliation adjustments).10741075    format: date-time10761077  - `has_more: boolean`10781079    Whether another page is available. When true, pass `next_page` as the `page` parameter to fetch it.10801081  - `next_page: string or null`10821083    Opaque cursor for the next page, or null when `has_more` is false. Pass it as the `page` parameter, keeping the other parameters unchanged. A cursor can expire after the underlying data refreshes; the request then returns HTTP 410 and pagination must restart from the first page.10841085  - `organization_id: string`10861087    ID of the Organization.1088
Files main
Menu

Theme