curl "https://api.anthropic.com/v1/organizations/usage_report/messages\
?starting_at=2025-08-01T00:00:00Z\
&group_by[]=api_key_id\
&group_by[]=workspace_id\
&group_by[]=model\
&group_by[]=service_tier\
&group_by[]=context_window\
&limit=1" \
--header "anthropic-version: 2023-06-01" \
--header "content-type: application/json" \
--header "x-api-key: $ANTHROPIC_ADMIN_KEY"{
"data": [
{
"starting_at": "2023-11-07T05:31:56Z",
"ending_at": "2023-11-07T05:31:56Z",
"results": [
{
"uncached_input_tokens": 123,
"cache_creation": {
"ephemeral_1h_input_tokens": 123,
"ephemeral_5m_input_tokens": 123
},
"cache_read_input_tokens": 123,
"output_tokens": 123,
"server_tool_use": {
"web_search_requests": 123
},
"api_key_id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
"workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
"model": "claude-sonnet-4-20250514",
"service_tier": "standard",
"context_window": "0-200k"
}
]
}
],
"has_more": true,
"next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}取得 Messages API 的使用報告
curl "https://api.anthropic.com/v1/organizations/usage_report/messages\
?starting_at=2025-08-01T00:00:00Z\
&group_by[]=api_key_id\
&group_by[]=workspace_id\
&group_by[]=model\
&group_by[]=service_tier\
&group_by[]=context_window\
&limit=1" \
--header "anthropic-version: 2023-06-01" \
--header "content-type: application/json" \
--header "x-api-key: $ANTHROPIC_ADMIN_KEY"{
"data": [
{
"starting_at": "2023-11-07T05:31:56Z",
"ending_at": "2023-11-07T05:31:56Z",
"results": [
{
"uncached_input_tokens": 123,
"cache_creation": {
"ephemeral_1h_input_tokens": 123,
"ephemeral_5m_input_tokens": 123
},
"cache_read_input_tokens": 123,
"output_tokens": 123,
"server_tool_use": {
"web_search_requests": 123
},
"api_key_id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
"workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
"model": "claude-sonnet-4-20250514",
"service_tier": "standard",
"context_window": "0-200k"
}
]
}
],
"has_more": true,
"next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="
}Documentation Index
Fetch the complete documentation index at: https://docs.claude.com/llms.txt
Use this file to discover all available pages before exploring further.
Headers
Query Parameters
Maximum number of time buckets to return in the response.
The default and max limits depend on bucket_width:
• "1d": Default of 7 days, maximum of 31 days
• "1h": Default of 24 hours, maximum of 168 hours
• "1m": Default of 60 minutes, maximum of 1440 minutes
7
Optionally set to the next_page token from the previous response.
"page_MjAyNS0wNS0xNFQwMDowMDowMFo="
Time buckets that start on or after this RFC 3339 timestamp will be returned. Each time bucket will be snapped to the start of the minute/hour/day in UTC.
"2024-10-30T23:58:27.427722Z"
Time buckets that end before this RFC 3339 timestamp will be returned.
"2024-10-30T23:58:27.427722Z"
Restrict usage returned to the specified API key ID(s).
"apikey_01Rj2N8SVvo6BePZj99NhmiT"
Restrict usage returned to the specified workspace ID(s).
"wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
Restrict usage returned to the specified model(s).
"claude-sonnet-4-20250514"
Restrict usage returned to the specified service tier(s).
standard, batch, priority "standard"
Restrict usage returned to the specified context window(s).
0-200k, 200k-1M "0-200k"
Group by any subset of the available options.
api_key_id, workspace_id, model, service_tier, context_window "api_key_id"
Time granularity of the response data.
1d, 1m, 1h "1d"
"1m"
"1h"
Response
Successful Response
Show child attributes
Show child attributes
Indicates if there are more results.
Token to provide in as page in the subsequent request to retrieve the next page of data.
"page_MjAyNS0wNS0xNFQwMDowMDowMFo="
Was this page helpful?