Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One capture · api

One read of Claude Developer Platformapi-20261015T200735Z

78 pages moved out of 781 read.

Pages moved 78 significant first
Pages read 781 in this capture
Captured 20:07 UTC
Corpus hash 28c59a41a592 corpus-hash

What this read moved

26-50 of 78, page 2 of 4

This capture is too large to show at once. Changes 26-50 of 78 are below, significant first; the rest are on the following screens.

build-with-claude/vision Changed · +21 / -23 lines

from line 548
548548 -H "x-api-key: $ANTHROPIC_API_KEY" \
549549 -H "anthropic-version: 2023-06-01" \
550550 -H "content-type: application/json" \
551 -d @- <<EOF
552 {
553 "model": "claude-opus-5-5",
554 "max_tokens": 1024,
555 "messages": [
556 {
557 "role": "user",
558 "content": [
559 {
560 "type": "image",
561 "source": {
562 "type": "file",
563 "file_id": "$FILE_ID"
551 -d '{
552 "model": "claude-opus-5-5",
553 "max_tokens": 1024,
554 "messages": [
555 {
556 "role": "user",
557 "content": [
558 {
559 "type": "image",
560 "source": {
561 "type": "file",
562 "file_id": "'"$FILE_ID"'"
563 }
564 },
565 {
566 "type": "text",
567 "text": "Describe this image."
564568 }
565 },
566 {
567 "type": "text",
568 "text": "Describe this image."
569 }
570 ]
571 }
572 ]
573 }
574 EOF
569 ]
570 }
571 ]
572 }'
575573 ```
576574 
577575 ```bash CLI

build-with-claude/vision-coordinates Changed · +16 / -20 lines

from line 43
4343 
4444First check which resolution tier your model is on (see [Resolution and token cost](https://platform.claude.com/docs/en/build-with-claude/vision#evaluate-image-size)) and pass the matching edge and token limits. The following reference implementation computes the exact size Claude resizes an image to:
4545 
46<CodeGroup>
47 ```bash cURL
48 # This reference implementation is local math that makes no API request, so
49 # there's nothing to show for cURL. See the SDK tabs.
50 ```
46<CodeGroup exclude="shell">
47 <CodeGroupItem language="cURL">
48 Compute this size in code.
49 </CodeGroupItem>
5150 
52 ```bash CLI
53 # This reference implementation is local math that makes no API request, so
54 # there's nothing to show for the CLI. See the SDK tabs.
55 ```
51 <CodeGroupItem language="CLI">
52 Compute this size in code.
53 </CodeGroupItem>
5654 
5755 ```python Python
5856 import math
from line 482
484482 
485483Screenshots and zoom images that you return to the [computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#handle-coordinate-scaling-for-higher-resolutions) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool#targets-and-coordinates) toolsets are an exception to automatic resizing. The API rejects a `tool_result` image that exceeds the model's limits with a validation error instead of resizing it. Resize those images in your application before returning them, then scale the coordinates Claude returns back to your screen's dimensions.
486484 
487<CodeGroup>
488 ```bash cURL
489 # This local coordinate conversion makes no API request, so there's nothing
490 # to show for cURL. See the SDK tabs.
491 ```
485<CodeGroup exclude="shell">
486 <CodeGroupItem language="cURL">
487 Convert the coordinates in code.
488 </CodeGroupItem>
492489 
493 ```bash CLI
494 # This local coordinate conversion makes no API request, so there's nothing
495 # to show for the CLI. See the SDK tabs.
496 ```
490 <CodeGroupItem language="CLI">
491 Convert the coordinates in code.
492 </CodeGroupItem>
497493 
498494 ```python Python
499495 # This helper calls resized_size from the resize example on this page.

cli-sdks-libraries/libraries/openai-sdk Changed · +8 / -14 lines

from line 33
3333 
3434### Quick start example
3535 
36<CodeGroup exclude="shell">
36<CodeGroup exclude="shell, php">
3737 ```python Python
3838 import os
3939 
from line 153
153153 }
154154 ```
155155 
156 ```php PHP
157 <?php
158 // There is no official OpenAI PHP SDK, so no example is shown here.
159 // To use Claude from PHP, use the native Claude API instead:
160 // https://platform.claude.com/docs/en/cli-sdks-libraries/overview
161 ```
156 <CodeGroupItem language="PHP">
157 OpenAI has no official PHP SDK. To use Claude from PHP, use the [Claude SDK for PHP](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/php) instead.
158 </CodeGroupItem>
162159 
163160 ```ruby Ruby
164161 require "openai"
from line 202
205202 
206203You can enable [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) by adding the `thinking` parameter. On current models thinking is adaptive, with Claude determining when and how deeply to think, and on Claude 5 models it is on by default; manually configured extended thinking is a legacy mode. Although thinking improves Claude's reasoning for complex tasks, the OpenAI SDK doesn't return Claude's thinking. For full thinking features, including [summarized thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#summarized-thinking), use the native Claude API.
207204 
208<CodeGroup exclude="shell">
205<CodeGroup exclude="shell, php">
209206 ```python Python
210207 response = client.chat.completions.create(
211208 model="claude-sonnet-4-6",
from line 260
263260 ChatCompletion completion = client.chat().completions().create(params);
264261 ```
265262 
266 ```php PHP
267 <?php
268 // There is no official OpenAI PHP SDK, so no example is shown here.
269 // To use Claude from PHP, use the native Claude API instead:
270 // https://platform.claude.com/docs/en/cli-sdks-libraries/overview
271 ```
263 <CodeGroupItem language="PHP">
264 OpenAI has no official PHP SDK. To use Claude from PHP, use the [Claude SDK for PHP](https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/php) instead.
265 </CodeGroupItem>
272266 
273267 ```ruby Ruby
274268 response = openai.chat.completions.create(

cli-sdks-libraries/sdks/ruby Changed · +9 / -4 lines

from line 301
301301Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
302302 
303303```ruby
304anthropic = Anthropic::Client.new
304305# Using the enum constants preserves the tagged type information:
305306anthropic.messages.create(
306 service_tier: Anthropic::MessageCreateParams::ServiceTier::AUTO,
307 # ...
307 max_tokens: 1024,
308 messages: [{role: "user", content: "Hello, Claude"}],
309 model: Anthropic::Model::CLAUDE_OPUS_5_5,
310 service_tier: Anthropic::MessageCreateParams::ServiceTier::AUTO
308311)
309312 
310313# Literal values are also permissible:
311314anthropic.messages.create(
312 service_tier: :auto,
313 # ...
315 max_tokens: 1024,
316 messages: [{role: "user", content: "Hello, Claude"}],
317 model: :"claude-opus-5-5",
318 service_tier: :auto
314319)
315320```
316321 

cli-sdks-libraries/sdks/typescript Changed · +5 / -1 lines

from line 81
8181You can see the exact usage for a given request through the `usage` response property, for example:
8282 
8383```typescript
84const message = await client.messages.create(/* ... */);
84const message = await client.messages.create({
85 max_tokens: 1024,
86 messages: [{ role: "user", content: "Hello, Claude" }],
87 model: "claude-opus-5-5"
88});
8589console.log(message.usage);
8690// { input_tokens: 25, output_tokens: 13 }
8791```

manage-claude/compliance-org-data Changed · +35 / -1 lines

## List user preferences

from line 9
99</Note>
1010 
1111<Check>
12 **Required scope:** `read:compliance_org_data` on the Compliance Access Key. The user and group-member endpoints require `read:compliance_user_data` instead.
12 **Required scope:** `read:compliance_org_data` on the Compliance Access Key. The user, user-preference, and group-member endpoints require `read:compliance_user_data` instead.
1313 
1414 Compliance Access Keys (`sk-ant-api01-...`) created in claude.ai are the only key type accepted; see [Set up the Compliance API](https://platform.claude.com/docs/en/manage-claude/compliance-api-access) to provision one. Calls authenticated with an Admin API key (`sk-ant-admin01-...`) return [403 Forbidden](https://platform.claude.com/docs/en/manage-claude/compliance-errors#403-forbidden).
1515</Check>
from line 101
101101The user IDs returned here are the same `user_...` identifiers accepted by the [Query the Activity Feed](https://platform.claude.com/docs/en/manage-claude/compliance-activity-feed) `actor_ids[]` filter and the `user_ids[]` filters on [Retrieve chats and messages](https://platform.claude.com/docs/en/manage-claude/compliance-content-data#retrieve-chats-and-messages) and the [remote session list](https://platform.claude.com/docs/en/manage-claude/compliance-sessions#retrieve-remote-sessions); the [local session list](https://platform.claude.com/docs/en/manage-claude/compliance-sessions#retrieve-local-sessions) has no user filter, so attribute local sessions by the `user.id` on each session object. The `organization_role` field carries the user's built-in membership level within the listed organization (one of `admin`, `billing`, `claude_code_user`, `developer`, `managed`, `membership_admin`, `owner`, `primary_owner`, or `user`), an axis independent of any custom RBAC role assignments returned by [List roles](https://platform.claude.com/docs/en/manage-claude/compliance-org-data#list-roles). A typical eDiscovery flow lists users for one or more organizations, filters against your own external records, and feeds the resulting IDs into chat and project queries.
102102 
103103A user only appears here while they are an active member of the organization. Removed users are dropped from the list immediately. Their historical activity remains queryable through the Activity Feed for the full retention window, indexed by the same `user_...` ID.
104 
105## List user preferences
106 
107The `GET /v1/compliance/organizations/{org_uuid}/user_preferences` endpoint returns the text that current members of one organization saved as **Instructions for Claude** in claude.ai (`conversation_preferences`) and as **Global instructions** in Cowork (`cowork_global_instructions`). Both are account-level settings, so the same text is returned under every organization a member belongs to. This endpoint is in beta.
108 
109This endpoint requires `read:compliance_user_data`, not `read:compliance_org_data`; a call with a key that lacks `read:compliance_user_data` returns [403 Forbidden](https://platform.claude.com/docs/en/manage-claude/compliance-errors#403-forbidden).
110 
111By default, the response lists only members who have set at least one of the two values. Pass `include_unset=true` to list every current member, with `null` for each value that is not set. To return specific members only, pass up to 10 user IDs in `user_ids[]`. Results paginate with `limit` (default 20, maximum 100) and `page`. As on the [organization users endpoint](https://platform.claude.com/docs/en/manage-claude/compliance-org-data#list-organization-users), pass `next_page` back unchanged as `page`; also send the same `include_unset` and `user_ids[]` values with every page, or the call returns [400 Bad Request](https://platform.claude.com/docs/en/manage-claude/compliance-errors#invalid-pagination-cursor). A page can hold fewer results than `limit`, or none, and still not be the last, so keep requesting pages until `next_page` is `null`.
112 
113```bash cURL
114org_uuid="91012d09-e48b-438e-a489-1bebfd8fa6f9"
115 
116curl --fail-with-body -sS \
117 "https://api.anthropic.com/v1/compliance/organizations/$org_uuid/user_preferences" \
118 -H "x-api-key: $ANTHROPIC_COMPLIANCE_ACCESS_KEY" \
119 -H "anthropic-version: 2023-06-01"
120```
121 
122```json Response
123{
124 "data": [
125 {
126 "user": {
127 "id": "user_01XyDMpzjS89pFZXqSFUBDr6",
128 "email_address": "[email protected]"
129 },
130 "conversation_preferences": "Keep answers brief and cite sources.",
131 "cowork_global_instructions": null
132 }
133 ],
134 "has_more": false,
135 "next_page": null
136}
137```
104138 
105139## List roles
106140 

manage-claude/opentelemetry Changed · +7 / -1 lines

from line 19
1919 
2020## Get started
2121 
22You can set up SDK tracing, API tracing, or both. Set up both to see a request's SDK and API spans in one trace, as in the [example traces](https://platform.claude.com/docs/en/manage-claude/opentelemetry#example-traces-and-how-to-read-them). For requests to Claude Platform on AWS, the API spans are in their own traces instead.
22You can set up SDK tracing, API tracing, or both. Set up both to see a request's SDK and API spans in one trace, as in the [example traces](https://platform.claude.com/docs/en/manage-claude/opentelemetry#example-traces-and-how-to-read-them).
23 
24Let Claude Code set up this feature for you
25 
26```text
27Set up OpenTelemetry tracing with the Claude API and Claude SDK
28```
2329 
2430<CardGroup cols={3}>
2531 <Card title="Set up SDK tracing" icon="code-brackets" href="https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk" layout="horizontal">

manage-claude/spend-limits-api Changed · +1990 / -104 lines

The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.

from line 34
3434* Your organization must be on a Claude Enterprise plan.
3535* Usage credits must be turned on for your organization. Your primary owner can turn them on in claude.ai billing settings.
3636 
37The SDK exposes these endpoints under `client.beta.organization.spend_limits` (typescript: `client.beta.organization.spendLimits`; csharp, go: `client.Beta.Organization.SpendLimits`; java: `client.beta().organization().spendLimits()`; php: `$client->beta->organization->spendLimits`), and the `ant` CLI under `ant beta:organization:spend-limits`. Both send the `anthropic-version` header for you. The examples read the Admin API key from the `ANTHROPIC_API_KEY` environment variable. The SDK and the CLI fetch more pages for you as you go through the results, so `limit` sets the page size, not the total (see [Pagination](https://platform.claude.com/docs/en/manage-claude/spend-limits-api#pagination)).
38 
3739## Quick start
3840 
3941List every member's effective monthly spend limit and period-to-date spend:
4042 
41```bash cURL
42curl "https://api.anthropic.com/v1/organizations/spend_limits/effective?limit=20" \
43 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
44 --header "anthropic-version: 2023-06-01"
45```
43<CodeGroup>
44 ```bash cURL
45 curl "https://api.anthropic.com/v1/organizations/spend_limits/effective?limit=20" \
46 -H "x-api-key: $ANTHROPIC_API_KEY" \
47 -H "anthropic-version: 2023-06-01"
48 ```
49 
50 ```bash CLI
51 ant beta:organization:spend-limits:effective list --limit 20
52 ```
53 
54 ```python Python
55 client = anthropic.Anthropic()
56 
57 effective_limits = client.beta.organization.spend_limits.effective.list(limit=20)
58 
59 for effective_limit in effective_limits:
60 scope = effective_limit.scope
61 if scope.type == "user":
62 amount = effective_limit.amount or "unlimited"
63 print(f"{scope.user_id}: {effective_limit.period_to_date_spend} of {amount}")
64 ```
65 
66 ```typescript TypeScript
67 const client = new Anthropic();
68 
69 const effectiveLimits = await client.beta.organization.spendLimits.effective.list({
70 limit: 20
71 });
72 
73 for await (const effectiveLimit of effectiveLimits) {
74 const { scope } = effectiveLimit;
75 if (scope.type === "user") {
76 const amount = effectiveLimit.amount ?? "unlimited";
77 console.log(`${scope.user_id}: ${effectiveLimit.period_to_date_spend} of ${amount}`);
78 }
79 }
80 ```
81 
82 ```csharp C#
83 AnthropicClient client = new();
84 
85 var page = await client.Beta.Organization.SpendLimits.Effective.List(
86 new() { Limit = 20 }
87 );
88 
89 await foreach (var effectiveLimit in page.Paginate())
90 {
91 if (effectiveLimit.Scope.TryPickBetaSpendLimitUser(out var userScope))
92 {
93 var amount = effectiveLimit.Amount ?? "unlimited";
94 Console.WriteLine($"{userScope.UserID}: {effectiveLimit.PeriodToDateSpend} of {amount}");
95 }
96 }
97 ```
98 
99 ```go Go
100 client := anthropic.NewClient()
101 
102 effectiveLimits := client.Beta.Organization.SpendLimits.Effective.ListAutoPaging(context.Background(), anthropic.BetaOrganizationSpendLimitEffectiveListParams{
103 Limit: anthropic.Int(20),
104 })
105 
106 for effectiveLimits.Next() {
107 effectiveLimit := effectiveLimits.Current()
108 if userScope, ok := effectiveLimit.Scope.AsAny().(anthropic.BetaSpendLimitUserScope); ok {
109 amount := effectiveLimit.Amount
110 if !effectiveLimit.JSON.Amount.Valid() {
111 amount = "unlimited"
112 }
113 fmt.Printf("%s: %s of %s\n", userScope.UserID, effectiveLimit.PeriodToDateSpend, amount)
114 }
115 }
116 if err := effectiveLimits.Err(); err != nil {
117 log.Fatal(err)
118 }
119 ```
120 
121 ```java Java
122 import com.anthropic.models.beta.organization.spendlimits.effective.EffectiveListParams;
123 
124 void main() {
125 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
126 
127 var params = EffectiveListParams.builder()
128 .limit(20)
129 .build();
130 var effectiveLimits = client.beta().organization().spendLimits().effective().list(params);
131 
132 for (var effectiveLimit : effectiveLimits.autoPager()) {
133 var amount = effectiveLimit.amount().orElse("unlimited");
134 effectiveLimit.scope().user().ifPresent(userScope ->
135 IO.println(userScope.userId() + ": " + effectiveLimit.periodToDateSpend() + " of " + amount)
136 );
137 }
138 }
139 ```
140 
141 ```php PHP
142 use Anthropic\Beta\Organization\SpendLimits\SpendLimitUserScope;
143 // ...
144 
145 $client = new Client();
146 
147 $effectiveLimits = $client->beta->organization->spendLimits->effective->list(limit: 20);
148 
149 foreach ($effectiveLimits->pagingEachItem() as $effectiveLimit) {
150 $scope = $effectiveLimit->scope;
151 if ($scope instanceof SpendLimitUserScope) {
152 $amount = $effectiveLimit->amount ?? 'unlimited';
153 echo "{$scope->userID}: {$effectiveLimit->periodToDateSpend} of {$amount}\n";
154 }
155 }
156 ```
157 
158 ```ruby Ruby
159 client = Anthropic::Client.new
160 
161 page = client.beta.organization.spend_limits.effective.list(limit: 20)
162 
163 page.auto_paging_each do |effective_limit|
164 scope = effective_limit.scope
165 if scope.is_a?(Anthropic::Models::Beta::Organization::BetaSpendLimitUserScope)
166 amount = effective_limit.amount || "unlimited"
167 puts "#{scope.user_id}: #{effective_limit.period_to_date_spend} of #{amount}"
168 end
169 end
170 ```
171</CodeGroup>
46172 
47173## Key concepts
48174 
from line 242
116242 
117243For complete parameter details and response schemas, see [List effective spend limits](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/effective/list) in the API reference.
118244 
119```bash cURL
120curl "https://api.anthropic.com/v1/organizations/spend_limits/effective?limit=20" \
121 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
122 --header "anthropic-version: 2023-06-01"
123```
245<CodeGroup>
246 ```bash cURL
247 curl "https://api.anthropic.com/v1/organizations/spend_limits/effective?limit=20" \
248 -H "x-api-key: $ANTHROPIC_API_KEY" \
249 -H "anthropic-version: 2023-06-01"
250 ```
251 
252 ```bash CLI
253 ant beta:organization:spend-limits:effective list --limit 20
254 ```
255 
256 ```python Python
257 client = anthropic.Anthropic()
258 
259 effective_limits = client.beta.organization.spend_limits.effective.list(limit=20)
260 
261 for effective_limit in effective_limits:
262 scope = effective_limit.scope
263 if scope.type == "user":
264 amount = effective_limit.amount or "unlimited"
265 print(f"{scope.user_id}: {effective_limit.period_to_date_spend} of {amount}")
266 ```
267 
268 ```typescript TypeScript
269 const client = new Anthropic();
270 
271 const effectiveLimits = await client.beta.organization.spendLimits.effective.list({
272 limit: 20
273 });
274 
275 for await (const effectiveLimit of effectiveLimits) {
276 const { scope } = effectiveLimit;
277 if (scope.type === "user") {
278 const amount = effectiveLimit.amount ?? "unlimited";
279 console.log(`${scope.user_id}: ${effectiveLimit.period_to_date_spend} of ${amount}`);
280 }
281 }
282 ```
283 
284 ```csharp C#
285 AnthropicClient client = new();
286 
287 var page = await client.Beta.Organization.SpendLimits.Effective.List(
288 new() { Limit = 20 }
289 );
290 
291 await foreach (var effectiveLimit in page.Paginate())
292 {
293 if (effectiveLimit.Scope.TryPickBetaSpendLimitUser(out var userScope))
294 {
295 var amount = effectiveLimit.Amount ?? "unlimited";
296 Console.WriteLine($"{userScope.UserID}: {effectiveLimit.PeriodToDateSpend} of {amount}");
297 }
298 }
299 ```
300 
301 ```go Go
302 client := anthropic.NewClient()
303 
304 effectiveLimits := client.Beta.Organization.SpendLimits.Effective.ListAutoPaging(context.Background(), anthropic.BetaOrganizationSpendLimitEffectiveListParams{
305 Limit: anthropic.Int(20),
306 })
307 
308 for effectiveLimits.Next() {
309 effectiveLimit := effectiveLimits.Current()
310 if userScope, ok := effectiveLimit.Scope.AsAny().(anthropic.BetaSpendLimitUserScope); ok {
311 amount := effectiveLimit.Amount
312 if !effectiveLimit.JSON.Amount.Valid() {
313 amount = "unlimited"
314 }
315 fmt.Printf("%s: %s of %s\n", userScope.UserID, effectiveLimit.PeriodToDateSpend, amount)
316 }
317 }
318 if err := effectiveLimits.Err(); err != nil {
319 log.Fatal(err)
320 }
321 ```
322 
323 ```java Java
324 import com.anthropic.models.beta.organization.spendlimits.effective.EffectiveListParams;
325 
326 void main() {
327 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
328 
329 var params = EffectiveListParams.builder()
330 .limit(20)
331 .build();
332 var effectiveLimits = client.beta().organization().spendLimits().effective().list(params);
333 
334 for (var effectiveLimit : effectiveLimits.autoPager()) {
335 var amount = effectiveLimit.amount().orElse("unlimited");
336 effectiveLimit.scope().user().ifPresent(userScope ->
337 IO.println(userScope.userId() + ": " + effectiveLimit.periodToDateSpend() + " of " + amount)
338 );
339 }
340 }
341 ```
342 
343 ```php PHP
344 use Anthropic\Beta\Organization\SpendLimits\SpendLimitUserScope;
345 // ...
346 
347 $client = new Client();
348 
349 $effectiveLimits = $client->beta->organization->spendLimits->effective->list(limit: 20);
350 
351 foreach ($effectiveLimits->pagingEachItem() as $effectiveLimit) {
352 $scope = $effectiveLimit->scope;
353 if ($scope instanceof SpendLimitUserScope) {
354 $amount = $effectiveLimit->amount ?? 'unlimited';
355 echo "{$scope->userID}: {$effectiveLimit->periodToDateSpend} of {$amount}\n";
356 }
357 }
358 ```
359 
360 ```ruby Ruby
361 client = Anthropic::Client.new
362 
363 page = client.beta.organization.spend_limits.effective.list(limit: 20)
364 
365 page.auto_paging_each do |effective_limit|
366 scope = effective_limit.scope
367 if scope.is_a?(Anthropic::Models::Beta::Organization::BetaSpendLimitUserScope)
368 amount = effective_limit.amount || "unlimited"
369 puts "#{scope.user_id}: #{effective_limit.period_to_date_spend} of #{amount}"
370 end
371 end
372 ```
373</CodeGroup>
124374 
125375```json
126376{
from line 402
152402 
153403For complete parameter details and response schemas, see [Retrieve a spend limit](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/retrieve) in the API reference.
154404 
155```bash cURL
156curl "https://api.anthropic.com/v1/organizations/spend_limits/spl_01AbCdEfGhIjKlMnOpQrSt" \
157 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
158 --header "anthropic-version: 2023-06-01"
159```
405<CodeGroup>
406 ```bash cURL
407 curl "https://api.anthropic.com/v1/organizations/spend_limits/spl_01AbCdEfGhIjKlMnOpQrSt" \
408 -H "x-api-key: $ANTHROPIC_API_KEY" \
409 -H "anthropic-version: 2023-06-01"
410 ```
411 
412 ```bash CLI
413 ant beta:organization:spend-limits retrieve \
414 --spend-limit-id spl_01AbCdEfGhIjKlMnOpQrSt
415 ```
416 
417 ```python Python
418 client = anthropic.Anthropic()
419 
420 spend_limit = client.beta.organization.spend_limits.retrieve(
421 "spl_01AbCdEfGhIjKlMnOpQrSt"
422 )
423 
424 amount = spend_limit.amount or "none"
425 print(f"id: {spend_limit.id}")
426 print(f"amount: {amount}")
427 ```
428 
429 ```typescript TypeScript
430 const client = new Anthropic();
431 
432 const spendLimit = await client.beta.organization.spendLimits.retrieve(
433 "spl_01AbCdEfGhIjKlMnOpQrSt"
434 );
435 
436 const amount = spendLimit.amount ?? "none";
437 console.log(`id: ${spendLimit.id}`);
438 console.log(`amount: ${amount}`);
439 ```
440 
441 ```csharp C#
442 AnthropicClient client = new();
443 
444 var spendLimit = await client.Beta.Organization.SpendLimits.Retrieve(
445 "spl_01AbCdEfGhIjKlMnOpQrSt"
446 );
447 
448 var amount = spendLimit.Amount ?? "none";
449 Console.WriteLine($"id: {spendLimit.ID}");
450 Console.WriteLine($"amount: {amount}");
451 ```
452 
453 ```go Go
454 client := anthropic.NewClient()
455 
456 spendLimit, err := client.Beta.Organization.SpendLimits.Get(context.Background(), "spl_01AbCdEfGhIjKlMnOpQrSt")
457 if err != nil {
458 log.Fatal(err)
459 }
460 
461 amount := spendLimit.Amount
462 if !spendLimit.JSON.Amount.Valid() {
463 amount = "none"
464 }
465 
466 fmt.Printf("id: %s\n", spendLimit.ID)
467 fmt.Printf("amount: %s\n", amount)
468 ```
469 
470 ```java Java
471 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
472 
473 var spendLimit = client.beta().organization().spendLimits()
474 .retrieve("spl_01AbCdEfGhIjKlMnOpQrSt");
475 
476 var amount = spendLimit.amount().orElse("none");
477 IO.println("id: " + spendLimit.id());
478 IO.println("amount: " + amount);
479 ```
480 
481 ```php PHP
482 $client = new Client();
483 
484 $spendLimit = $client->beta->organization->spendLimits->retrieve('spl_01AbCdEfGhIjKlMnOpQrSt');
485 
486 $amount = $spendLimit->amount ?? 'none';
487 echo "id: {$spendLimit->id}\n";
488 echo "amount: {$amount}\n";
489 ```
490 
491 ```ruby Ruby
492 client = Anthropic::Client.new
493 
494 spend_limit = client.beta.organization.spend_limits.retrieve("spl_01AbCdEfGhIjKlMnOpQrSt")
495 
496 amount = spend_limit.amount || "none"
497 puts "id: #{spend_limit.id}"
498 puts "amount: #{amount}"
499 ```
500</CodeGroup>
160501 
161502### Set a per-user override
162503 
from line 505
164505 
165506For complete parameter details and response schemas, see [Create a spend limit](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/set) in the API reference.
166507 
167```bash cURL
168curl --request POST "https://api.anthropic.com/v1/organizations/spend_limits" \
169 --header "content-type: application/json" \
170 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
171 --header "anthropic-version: 2023-06-01" \
172 --data '{"scope": {"type": "user", "user_id": "user_01AbCdEfGh"}, "amount": "75000"}'
173```
508<CodeGroup>
509 ```bash cURL
510 curl -X POST "https://api.anthropic.com/v1/organizations/spend_limits" \
511 -H "content-type: application/json" \
512 -H "x-api-key: $ANTHROPIC_API_KEY" \
513 -H "anthropic-version: 2023-06-01" \
514 -d '{"scope": {"type": "user", "user_id": "user_01AbCdEfGh"}, "amount": "75000"}'
515 ```
516 
517 ```bash CLI
518 ant beta:organization:spend-limits set \
519 --scope '{type: user, user_id: user_01AbCdEfGh}' \
520 --amount 75000
521 ```
522 
523 ```python Python
524 client = anthropic.Anthropic()
525 
526 spend_limit = client.beta.organization.spend_limits.set(
527 scope={"type": "user", "user_id": "user_01AbCdEfGh"}, amount="75000"
528 )
529 
530 print(f"id: {spend_limit.id}")
531 print(f"amount: {spend_limit.amount}")
532 ```
533 
534 ```typescript TypeScript
535 const client = new Anthropic();
536 
537 const spendLimit = await client.beta.organization.spendLimits.set({
538 scope: { type: "user", user_id: "user_01AbCdEfGh" },
539 amount: "75000"
540 });
541 
542 console.log(`id: ${spendLimit.id}`);
543 console.log(`amount: ${spendLimit.amount}`);
544 ```
545 
546 ```csharp C#
547 using Anthropic.Models.Beta.Organization.SpendLimits;
548 
549 AnthropicClient client = new();
550 
551 var spendLimit = await client.Beta.Organization.SpendLimits.Set(
552 new()
553 {
554 Scope = new BetaSpendLimitUserScope("user_01AbCdEfGh"),
555 Amount = "75000",
556 }
557 );
558 
559 Console.WriteLine($"id: {spendLimit.ID}");
560 Console.WriteLine($"amount: {spendLimit.Amount}");
561 ```
562 
563 ```go Go
564 client := anthropic.NewClient()
565 
566 spendLimit, err := client.Beta.Organization.SpendLimits.Set(context.Background(), anthropic.BetaOrganizationSpendLimitSetParams{
567 Scope: anthropic.BetaOrganizationSpendLimitSetParamsScopeUnion{
568 OfUser: &anthropic.BetaSpendLimitUserScopeParam{UserID: "user_01AbCdEfGh"},
569 },
570 Amount: anthropic.String("75000"),
571 })
572 if err != nil {
573 log.Fatal(err)
574 }
575 
576 fmt.Printf("id: %s\n", spendLimit.ID)
577 fmt.Printf("amount: %s\n", spendLimit.Amount)
578 ```
579 
580 ```java Java
581 import com.anthropic.models.beta.organization.spendlimits.SpendLimitSetParams;
582 
583 void main() {
584 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
585 
586 var params = SpendLimitSetParams.builder()
587 .userScope("user_01AbCdEfGh")
588 .amount("75000")
589 .build();
590 var spendLimit = client.beta().organization().spendLimits().set(params);
591 
592 IO.println("id: " + spendLimit.id());
593 IO.println("amount: " + spendLimit.amount().orElseThrow());
594 }
595 ```
596 
597 ```php PHP
598 use Anthropic\Beta\Organization\SpendLimits\SpendLimitUserScope;
599 // ...
600 
601 $client = new Client();
602 
603 $spendLimit = $client->beta->organization->spendLimits->set(
604 scope: SpendLimitUserScope::with(userID: 'user_01AbCdEfGh'),
605 amount: '75000',
606 );
607 
608 echo "id: {$spendLimit->id}\n";
609 echo "amount: {$spendLimit->amount}\n";
610 ```
611 
612 ```ruby Ruby
613 client = Anthropic::Client.new
614 
615 spend_limit = client.beta.organization.spend_limits.set(
616 scope: { type: :user, user_id: "user_01AbCdEfGh" },
617 amount: "75000"
618 )
619 
620 puts "id: #{spend_limit.id}"
621 puts "amount: #{spend_limit.amount}"
622 ```
623</CodeGroup>
174624 
175625```json
176626{
from line 641
191641 
192642For complete parameter details and response schemas, see [Delete a spend limit](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/delete) in the API reference.
193643 
194```bash cURL
195curl --request DELETE "https://api.anthropic.com/v1/organizations/spend_limits/spl_01RsTuVwXyZaBcDeFgHiJk" \
196 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
197 --header "anthropic-version: 2023-06-01"
198```
644<CodeGroup>
645 ```bash cURL
646 curl -X DELETE "https://api.anthropic.com/v1/organizations/spend_limits/spl_01RsTuVwXyZaBcDeFgHiJk" \
647 -H "x-api-key: $ANTHROPIC_API_KEY" \
648 -H "anthropic-version: 2023-06-01"
649 ```
650 
651 ```bash CLI
652 ant beta:organization:spend-limits delete \
653 --spend-limit-id spl_01RsTuVwXyZaBcDeFgHiJk
654 ```
655 
656 ```python Python
657 client = anthropic.Anthropic()
658 
659 deleted_spend_limit = client.beta.organization.spend_limits.delete(
660 "spl_01RsTuVwXyZaBcDeFgHiJk"
661 )
662 
663 print(f"id: {deleted_spend_limit.id}")
664 ```
665 
666 ```typescript TypeScript
667 const client = new Anthropic();
668 
669 const deletedSpendLimit = await client.beta.organization.spendLimits.delete(
670 "spl_01RsTuVwXyZaBcDeFgHiJk"
671 );
672 
673 console.log(`id: ${deletedSpendLimit.id}`);
674 ```
675 
676 ```csharp C#
677 AnthropicClient client = new();
678 
679 var deletedSpendLimit = await client.Beta.Organization.SpendLimits.Delete(
680 "spl_01RsTuVwXyZaBcDeFgHiJk"
681 );
682 
683 Console.WriteLine($"id: {deletedSpendLimit.ID}");
684 ```
685 
686 ```go Go
687 client := anthropic.NewClient()
688 
689 deletedSpendLimit, err := client.Beta.Organization.SpendLimits.Delete(context.Background(), "spl_01RsTuVwXyZaBcDeFgHiJk")
690 if err != nil {
691 log.Fatal(err)
692 }
693 
694 fmt.Printf("id: %s\n", deletedSpendLimit.ID)
695 ```
696 
697 ```java Java
698 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
699 
700 var deletedSpendLimit = client.beta().organization().spendLimits()
701 .delete("spl_01RsTuVwXyZaBcDeFgHiJk");
702 
703 IO.println("id: " + deletedSpendLimit.id());
704 ```
705 
706 ```php PHP
707 $client = new Client();
708 
709 $deletedSpendLimit = $client->beta->organization->spendLimits->delete('spl_01RsTuVwXyZaBcDeFgHiJk');
710 
711 echo "id: {$deletedSpendLimit->id}\n";
712 ```
713 
714 ```ruby Ruby
715 client = Anthropic::Client.new
716 
717 deleted_spend_limit = client.beta.organization.spend_limits.delete("spl_01RsTuVwXyZaBcDeFgHiJk")
718 
719 puts "id: #{deleted_spend_limit.id}"
720 ```
721</CodeGroup>
199722 
200723## Spend limit increase requests
201724 
from line 728
205728 
206729For complete parameter details and response schemas, see [List spend limit increase requests](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/increase_requests/list) in the API reference.
207730 
208```bash cURL
209curl --globoff "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests?status[]=pending&limit=50" \
210 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
211 --header "anthropic-version: 2023-06-01"
212```
731<CodeGroup>
732 ```bash cURL
733 curl -g "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests?status[]=pending&limit=50" \
734 -H "x-api-key: $ANTHROPIC_API_KEY" \
735 -H "anthropic-version: 2023-06-01"
736 ```
737 
738 ```bash CLI
739 ant beta:organization:spend-limits:increase-requests list \
740 --status pending \
741 --limit 50
742 ```
743 
744 ```python Python
745 client = anthropic.Anthropic()
746 
747 increase_requests = client.beta.organization.spend_limits.increase_requests.list(
748 status=["pending"], limit=50
749 )
750 
751 for increase_request in increase_requests:
752 print(f"{increase_request.id}: {increase_request.status}")
753 ```
754 
755 ```typescript TypeScript
756 const client = new Anthropic();
757 
758 const increaseRequests = await client.beta.organization.spendLimits.increaseRequests.list({
759 status: ["pending"],
760 limit: 50
761 });
762 
763 for await (const increaseRequest of increaseRequests) {
764 console.log(`${increaseRequest.id}: ${increaseRequest.status}`);
765 }
766 ```
767 
768 ```csharp C#
769 using Anthropic.Models.Beta.Organization.SpendLimits.IncreaseRequests;
770 
771 AnthropicClient client = new();
772 
773 var page = await client.Beta.Organization.SpendLimits.IncreaseRequests.List(
774 new() { Status = [BetaSpendLimitIncreaseRequestStatus.Pending], Limit = 50 }
775 );
776 
777 await foreach (var increaseRequest in page.Paginate())
778 {
779 Console.WriteLine($"{increaseRequest.ID}: {increaseRequest.Status.Raw()}");
780 }
781 ```
782 
783 ```go Go
784 client := anthropic.NewClient()
785 
786 increaseRequests := client.Beta.Organization.SpendLimits.IncreaseRequests.ListAutoPaging(context.Background(), anthropic.BetaOrganizationSpendLimitIncreaseRequestListParams{
787 Status: []anthropic.BetaSpendLimitIncreaseRequestStatus{anthropic.BetaSpendLimitIncreaseRequestStatusPending},
788 Limit: anthropic.Int(50),
789 })
790 
791 for increaseRequests.Next() {
792 increaseRequest := increaseRequests.Current()
793 fmt.Printf("%s: %s\n", increaseRequest.ID, increaseRequest.Status)
794 }
795 if err := increaseRequests.Err(); err != nil {
796 log.Fatal(err)
797 }
798 ```
799 
800 ```java Java
801 import com.anthropic.models.beta.organization.spendlimits.increaserequests.BetaSpendLimitIncreaseRequestStatus;
802 import com.anthropic.models.beta.organization.spendlimits.increaserequests.IncreaseRequestListParams;
803 
804 void main() {
805 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
806 
807 var params = IncreaseRequestListParams.builder()
808 .addStatus(BetaSpendLimitIncreaseRequestStatus.PENDING)
809 .limit(50)
810 .build();
811 var increaseRequests = client.beta().organization().spendLimits().increaseRequests().list(params);
812 
813 for (var increaseRequest : increaseRequests.autoPager()) {
814 IO.println(increaseRequest.id() + ": " + increaseRequest.status().asString());
815 }
816 }
817 ```
818 
819 ```php PHP
820 $client = new Client();
821 
822 $increaseRequests = $client->beta->organization->spendLimits->increaseRequests->list(
823 status: ['pending'],
824 limit: 50,
825 );
826 
827 foreach ($increaseRequests->pagingEachItem() as $increaseRequest) {
828 echo "{$increaseRequest->id}: {$increaseRequest->status}\n";
829 }
830 ```
831 
832 ```ruby Ruby
833 client = Anthropic::Client.new
834 
835 page = client.beta.organization.spend_limits.increase_requests.list(status: [:pending], limit: 50)
836 
837 page.auto_paging_each do |increase_request|
838 puts "#{increase_request.id}: #{increase_request.status}"
839 end
840 ```
841</CodeGroup>
213842 
214843Each pending request carries a live `spend_summary` showing the requester's current effective spend limit and period-to-date spend, enough to decide without a separate lookup.
215844 
from line 848
219848 
220849For complete parameter details and response schemas, see [Retrieve a spend limit increase request](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/increase_requests/retrieve) in the API reference.
221850 
222```bash cURL
223curl "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt" \
224 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
225 --header "anthropic-version: 2023-06-01"
226```
851<CodeGroup>
852 ```bash cURL
853 curl "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt" \
854 -H "x-api-key: $ANTHROPIC_API_KEY" \
855 -H "anthropic-version: 2023-06-01"
856 ```
857 
858 ```bash CLI
859 ant beta:organization:spend-limits:increase-requests retrieve \
860 --spend-limit-increase-request-id slir_01AbCdEfGhIjKlMnOpQrSt
861 ```
862 
863 ```python Python
864 client = anthropic.Anthropic()
865 
866 increase_request = client.beta.organization.spend_limits.increase_requests.retrieve(
867 "slir_01AbCdEfGhIjKlMnOpQrSt"
868 )
869 
870 print(f"id: {increase_request.id}")
871 print(f"status: {increase_request.status}")
872 ```
873 
874 ```typescript TypeScript
875 const client = new Anthropic();
876 
877 const increaseRequest = await client.beta.organization.spendLimits.increaseRequests.retrieve(
878 "slir_01AbCdEfGhIjKlMnOpQrSt"
879 );
880 
881 console.log(`id: ${increaseRequest.id}`);
882 console.log(`status: ${increaseRequest.status}`);
883 ```
884 
885 ```csharp C#
886 AnthropicClient client = new();
887 
888 var increaseRequest = await client.Beta.Organization.SpendLimits.IncreaseRequests.Retrieve(
889 "slir_01AbCdEfGhIjKlMnOpQrSt"
890 );
891 
892 Console.WriteLine($"id: {increaseRequest.ID}");
893 Console.WriteLine($"status: {increaseRequest.Status.Raw()}");
894 ```
895 
896 ```go Go
897 client := anthropic.NewClient()
898 
899 increaseRequest, err := client.Beta.Organization.SpendLimits.IncreaseRequests.Get(context.Background(), "slir_01AbCdEfGhIjKlMnOpQrSt")
900 if err != nil {
901 log.Fatal(err)
902 }
903 
904 fmt.Printf("id: %s\n", increaseRequest.ID)
905 fmt.Printf("status: %s\n", increaseRequest.Status)
906 ```
907 
908 ```java Java
909 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
910 
911 var increaseRequest = client.beta().organization().spendLimits().increaseRequests()
912 .retrieve("slir_01AbCdEfGhIjKlMnOpQrSt");
913 
914 IO.println("id: " + increaseRequest.id());
915 IO.println("status: " + increaseRequest.status().asString());
916 ```
917 
918 ```php PHP
919 $client = new Client();
920 
921 $increaseRequest = $client->beta->organization->spendLimits->increaseRequests->retrieve(
922 'slir_01AbCdEfGhIjKlMnOpQrSt',
923 );
924 
925 echo "id: {$increaseRequest->id}\n";
926 echo "status: {$increaseRequest->status}\n";
927 ```
928 
929 ```ruby Ruby
930 client = Anthropic::Client.new
931 
932 increase_request = client.beta.organization.spend_limits.increase_requests.retrieve(
933 "slir_01AbCdEfGhIjKlMnOpQrSt"
934 )
935 
936 puts "id: #{increase_request.id}"
937 puts "status: #{increase_request.status}"
938 ```
939</CodeGroup>
227940 
228941### Approve an increase request
229942 
from line 944
231944 
232945For complete parameter details and response schemas, see [Approve a spend limit increase request](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/increase_requests/approve) in the API reference.
233946 
234```bash cURL
235curl --request POST "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt/approve" \
236 --header "content-type: application/json" \
237 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
238 --header "anthropic-version: 2023-06-01" \
239 --data '{"amount": "75000", "suppress_notification": true}'
240```
947<CodeGroup>
948 ```bash cURL
949 curl -X POST "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt/approve" \
950 -H "content-type: application/json" \
951 -H "x-api-key: $ANTHROPIC_API_KEY" \
952 -H "anthropic-version: 2023-06-01" \
953 -d '{"amount": "75000", "suppress_notification": true}'
954 ```
955 
956 ```bash CLI
957 ant beta:organization:spend-limits:increase-requests approve \
958 --spend-limit-increase-request-id slir_01AbCdEfGhIjKlMnOpQrSt \
959 --amount 75000 \
960 --suppress-notification
961 ```
962 
963 ```python Python
964 client = anthropic.Anthropic()
965 
966 increase_request = client.beta.organization.spend_limits.increase_requests.approve(
967 "slir_01AbCdEfGhIjKlMnOpQrSt", amount="75000", suppress_notification=True
968 )
969 
970 print(f"id: {increase_request.id}")
971 print(f"status: {increase_request.status}")
972 ```
973 
974 ```typescript TypeScript
975 const client = new Anthropic();
976 
977 const increaseRequest = await client.beta.organization.spendLimits.increaseRequests.approve(
978 "slir_01AbCdEfGhIjKlMnOpQrSt",
979 {
980 amount: "75000",
981 suppress_notification: true
982 }
983 );
984 
985 console.log(`id: ${increaseRequest.id}`);
986 console.log(`status: ${increaseRequest.status}`);
987 ```
988 
989 ```csharp C#
990 AnthropicClient client = new();
991 
992 var increaseRequest = await client.Beta.Organization.SpendLimits.IncreaseRequests.Approve(
993 "slir_01AbCdEfGhIjKlMnOpQrSt",
994 new() { Amount = "75000", SuppressNotification = true }
995 );
996 
997 Console.WriteLine($"id: {increaseRequest.ID}");
998 Console.WriteLine($"status: {increaseRequest.Status.Raw()}");
999 ```
1000 
1001 ```go Go
1002 client := anthropic.NewClient()
1003 
1004 increaseRequest, err := client.Beta.Organization.SpendLimits.IncreaseRequests.Approve(
1005 context.Background(),
1006 "slir_01AbCdEfGhIjKlMnOpQrSt",
1007 anthropic.BetaOrganizationSpendLimitIncreaseRequestApproveParams{
1008 Amount: "75000",
1009 SuppressNotification: anthropic.Bool(true),
1010 },
1011 )
1012 if err != nil {
1013 log.Fatal(err)
1014 }
1015 
1016 fmt.Printf("id: %s\n", increaseRequest.ID)
1017 fmt.Printf("status: %s\n", increaseRequest.Status)
1018 ```
1019 
1020 ```java Java
1021 import com.anthropic.models.beta.organization.spendlimits.increaserequests.IncreaseRequestApproveParams;
1022 
1023 void main() {
1024 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1025 
1026 var params = IncreaseRequestApproveParams.builder()
1027 .amount("75000")
1028 .suppressNotification(true)
1029 .build();
1030 var increaseRequest = client.beta().organization().spendLimits().increaseRequests()
1031 .approve("slir_01AbCdEfGhIjKlMnOpQrSt", params);
1032 
1033 IO.println("id: " + increaseRequest.id());
1034 IO.println("status: " + increaseRequest.status().asString());
1035 }
1036 ```
1037 
1038 ```php PHP
1039 $client = new Client();
1040 
1041 $increaseRequest = $client->beta->organization->spendLimits->increaseRequests->approve(
1042 'slir_01AbCdEfGhIjKlMnOpQrSt',
1043 amount: '75000',
1044 suppressNotification: true,
1045 );
1046 
1047 echo "id: {$increaseRequest->id}\n";
1048 echo "status: {$increaseRequest->status}\n";
1049 ```
1050 
1051 ```ruby Ruby
1052 client = Anthropic::Client.new
1053 
1054 increase_request = client.beta.organization.spend_limits.increase_requests.approve(
1055 "slir_01AbCdEfGhIjKlMnOpQrSt",
1056 amount: "75000",
1057 suppress_notification: true
1058 )
1059 
1060 puts "id: #{increase_request.id}"
1061 puts "status: #{increase_request.status}"
1062 ```
1063</CodeGroup>
2411064 
2421065### Deny an increase request
2431066 
from line 1068
2451068 
2461069For complete parameter details and response schemas, see [Deny a spend limit increase request](https://platform.claude.com/docs/en/api/beta/organization/spend_limits/increase_requests/deny) in the API reference.
2471070 
248```bash cURL
249curl --request POST "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt/deny" \
250 --header "content-type: application/json" \
251 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
252 --header "anthropic-version: 2023-06-01" \
253 --data '{"suppress_notification": true}'
254```
1071<CodeGroup>
1072 ```bash cURL
1073 curl -X POST "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt/deny" \
1074 -H "content-type: application/json" \
1075 -H "x-api-key: $ANTHROPIC_API_KEY" \
1076 -H "anthropic-version: 2023-06-01" \
1077 -d '{"suppress_notification": true}'
1078 ```
1079 
1080 ```bash CLI
1081 ant beta:organization:spend-limits:increase-requests deny \
1082 --spend-limit-increase-request-id slir_01AbCdEfGhIjKlMnOpQrSt \
1083 --suppress-notification
1084 ```
1085 
1086 ```python Python
1087 client = anthropic.Anthropic()
1088 
1089 increase_request = client.beta.organization.spend_limits.increase_requests.deny(
1090 "slir_01AbCdEfGhIjKlMnOpQrSt", suppress_notification=True
1091 )
1092 
1093 print(f"id: {increase_request.id}")
1094 print(f"status: {increase_request.status}")
1095 ```
1096 
1097 ```typescript TypeScript
1098 const client = new Anthropic();
1099 
1100 const increaseRequest = await client.beta.organization.spendLimits.increaseRequests.deny(
1101 "slir_01AbCdEfGhIjKlMnOpQrSt",
1102 {
1103 suppress_notification: true
1104 }
1105 );
1106 
1107 console.log(`id: ${increaseRequest.id}`);
1108 console.log(`status: ${increaseRequest.status}`);
1109 ```
1110 
1111 ```csharp C#
1112 AnthropicClient client = new();
1113 
1114 var increaseRequest = await client.Beta.Organization.SpendLimits.IncreaseRequests.Deny(
1115 "slir_01AbCdEfGhIjKlMnOpQrSt",
1116 new() { SuppressNotification = true }
1117 );
1118 
1119 Console.WriteLine($"id: {increaseRequest.ID}");
1120 Console.WriteLine($"status: {increaseRequest.Status.Raw()}");
1121 ```
1122 
1123 ```go Go
1124 client := anthropic.NewClient()
1125 
1126 increaseRequest, err := client.Beta.Organization.SpendLimits.IncreaseRequests.Deny(
1127 context.Background(),
1128 "slir_01AbCdEfGhIjKlMnOpQrSt",
1129 anthropic.BetaOrganizationSpendLimitIncreaseRequestDenyParams{
1130 SuppressNotification: anthropic.Bool(true),
1131 },
1132 )
1133 if err != nil {
1134 log.Fatal(err)
1135 }
1136 
1137 fmt.Printf("id: %s\n", increaseRequest.ID)
1138 fmt.Printf("status: %s\n", increaseRequest.Status)
1139 ```
1140 
1141 ```java Java
1142 import com.anthropic.models.beta.organization.spendlimits.increaserequests.IncreaseRequestDenyParams;
1143 
1144 void main() {
1145 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1146 
1147 var params = IncreaseRequestDenyParams.builder()
1148 .suppressNotification(true)
1149 .build();
1150 var increaseRequest = client.beta().organization().spendLimits().increaseRequests()
1151 .deny("slir_01AbCdEfGhIjKlMnOpQrSt", params);
1152 
1153 IO.println("id: " + increaseRequest.id());
1154 IO.println("status: " + increaseRequest.status().asString());
1155 }
1156 ```
1157 
1158 ```php PHP
1159 $client = new Client();
1160 
1161 $increaseRequest = $client->beta->organization->spendLimits->increaseRequests->deny(
1162 'slir_01AbCdEfGhIjKlMnOpQrSt',
1163 suppressNotification: true,
1164 );
1165 
1166 echo "id: {$increaseRequest->id}\n";
1167 echo "status: {$increaseRequest->status}\n";
1168 ```
1169 
1170 ```ruby Ruby
1171 client = Anthropic::Client.new
1172 
1173 increase_request = client.beta.organization.spend_limits.increase_requests.deny(
1174 "slir_01AbCdEfGhIjKlMnOpQrSt",
1175 suppress_notification: true
1176 )
1177 
1178 puts "id: #{increase_request.id}"
1179 puts "status: #{increase_request.status}"
1180 ```
1181</CodeGroup>
2551182 
2561183## Example workflows
2571184 
2581185Some of these workflows combine the Spend Limits API with the [Analytics APIs](https://platform.claude.com/docs/en/manage-claude/analytics-api) cost endpoints. The Analytics cost endpoints are designed for organization-wide spend reporting across a date range. `GET /spend_limits/effective` returns the cap that currently applies to each member. Start a sweep with Analytics to discover which members to look at, then read their current caps with `/effective`.
2591186 
260Spend Limits endpoints require the `spend_limits` scopes and Analytics cost endpoints require `read:analytics`; see [Analytics APIs](https://platform.claude.com/docs/en/manage-claude/analytics-api) for how to provision access. All monetary values on both are decimal strings in minor units (cents). Both APIs paginate with an opaque cursor. Set an explicit `limit` and page through `next_page` until it's `null` to cover the whole organization.
1187Spend Limits endpoints require the `spend_limits` scopes and Analytics cost endpoints require `read:analytics`; see [Analytics APIs](https://platform.claude.com/docs/en/manage-claude/analytics-api) for how to provision access. The examples use one Admin API key that has the scopes of every API they call. A primary owner [selects these scopes when creating the key](https://platform.claude.com/docs/en/manage-claude/admin-api-keys#choose-scopes-for-a-claude-enterprise-key). All monetary values on both are decimal strings in minor units (cents). Both APIs paginate with an opaque cursor. Set an explicit `limit` and page through `next_page` until it's `null` to cover the whole organization.
2611188 
2621189### Automate the increase-request review flow
2631190 
from line 1192
2651192 
26611931. List pending requests:
2671194 
268 ```bash cURL
269 curl --globoff "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests?status[]=pending&limit=100" \
270 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
271 --header "anthropic-version: 2023-06-01"
272 ```
1195 <CodeGroup>
1196 ```bash cURL
1197 curl -g "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests?status[]=pending&limit=100" \
1198 -H "x-api-key: $ANTHROPIC_API_KEY" \
1199 -H "anthropic-version: 2023-06-01"
1200 ```
1201 
1202 ```bash CLI
1203 ant beta:organization:spend-limits:increase-requests list \
1204 --status pending \
1205 --limit 100
1206 ```
1207 
1208 ```python Python
1209 client = anthropic.Anthropic()
1210 
1211 increase_requests = client.beta.organization.spend_limits.increase_requests.list(
1212 status=["pending"], limit=100
1213 )
1214 
1215 for increase_request in increase_requests:
1216 print(f"{increase_request.id}: {increase_request.status}")
1217 ```
1218 
1219 ```typescript TypeScript
1220 const client = new Anthropic();
1221 
1222 const increaseRequests = await client.beta.organization.spendLimits.increaseRequests.list({
1223 status: ["pending"],
1224 limit: 100
1225 });
1226 
1227 for await (const increaseRequest of increaseRequests) {
1228 console.log(`${increaseRequest.id}: ${increaseRequest.status}`);
1229 }
1230 ```
1231 
1232 ```csharp C#
1233 using Anthropic.Models.Beta.Organization.SpendLimits.IncreaseRequests;
1234 
1235 AnthropicClient client = new();
1236 
1237 var page = await client.Beta.Organization.SpendLimits.IncreaseRequests.List(
1238 new() { Status = [BetaSpendLimitIncreaseRequestStatus.Pending], Limit = 100 }
1239 );
1240 
1241 await foreach (var increaseRequest in page.Paginate())
1242 {
1243 Console.WriteLine($"{increaseRequest.ID}: {increaseRequest.Status.Raw()}");
1244 }
1245 ```
1246 
1247 ```go Go
1248 client := anthropic.NewClient()
1249 
1250 increaseRequests := client.Beta.Organization.SpendLimits.IncreaseRequests.ListAutoPaging(context.Background(), anthropic.BetaOrganizationSpendLimitIncreaseRequestListParams{
1251 Status: []anthropic.BetaSpendLimitIncreaseRequestStatus{anthropic.BetaSpendLimitIncreaseRequestStatusPending},
1252 Limit: anthropic.Int(100),
1253 })
1254 
1255 for increaseRequests.Next() {
1256 increaseRequest := increaseRequests.Current()
1257 fmt.Printf("%s: %s\n", increaseRequest.ID, increaseRequest.Status)
1258 }
1259 if err := increaseRequests.Err(); err != nil {
1260 log.Fatal(err)
1261 }
1262 ```
1263 
1264 ```java Java
1265 import com.anthropic.models.beta.organization.spendlimits.increaserequests.BetaSpendLimitIncreaseRequestStatus;
1266 import com.anthropic.models.beta.organization.spendlimits.increaserequests.IncreaseRequestListParams;
1267 
1268 void main() {
1269 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1270 
1271 var params = IncreaseRequestListParams.builder()
1272 .addStatus(BetaSpendLimitIncreaseRequestStatus.PENDING)
1273 .limit(100)
1274 .build();
1275 var increaseRequests = client.beta().organization().spendLimits().increaseRequests().list(params);
1276 
1277 for (var increaseRequest : increaseRequests.autoPager()) {
1278 IO.println(increaseRequest.id() + ": " + increaseRequest.status().asString());
1279 }
1280 }
1281 ```
1282 
1283 ```php PHP
1284 $client = new Client();
1285 
1286 $increaseRequests = $client->beta->organization->spendLimits->increaseRequests->list(
1287 status: ['pending'],
1288 limit: 100,
1289 );
1290 
1291 foreach ($increaseRequests->pagingEachItem() as $increaseRequest) {
1292 echo "{$increaseRequest->id}: {$increaseRequest->status}\n";
1293 }
1294 ```
1295 
1296 ```ruby Ruby
1297 client = Anthropic::Client.new
1298 
1299 page = client.beta.organization.spend_limits.increase_requests.list(status: [:pending], limit: 100)
1300 
1301 page.auto_paging_each do |increase_request|
1302 puts "#{increase_request.id}: #{increase_request.status}"
1303 end
1304 ```
1305 </CodeGroup>
2731306 
2741307 Each request carries the requester's `actor.user_id` and a live `spend_summary` with their current effective `amount` and `period_to_date_spend`, enough to decide without a separate lookup.
2751308 
from line 1310
2771310 
27813113. Resolve each request. To approve, supply the new cap:
2791312 
280 ```bash cURL
281 curl --request POST "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/{id}/approve" \
282 --header "content-type: application/json" \
283 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
284 --header "anthropic-version: 2023-06-01" \
285 --data '{"amount": "75000", "suppress_notification": true}'
286 ```
287 
288 To deny, `POST` to `.../{id}/deny` instead. Pass `suppress_notification: true` when your own system notifies the requester.
1313 <CodeGroup>
1314 ```bash cURL
1315 curl -X POST "https://api.anthropic.com/v1/organizations/spend_limit_increase_requests/slir_01AbCdEfGhIjKlMnOpQrSt/approve" \
1316 -H "content-type: application/json" \
1317 -H "x-api-key: $ANTHROPIC_API_KEY" \
1318 -H "anthropic-version: 2023-06-01" \
1319 -d '{"amount": "75000", "suppress_notification": true}'
1320 ```
1321 
1322 ```bash CLI
1323 ant beta:organization:spend-limits:increase-requests approve \
1324 --spend-limit-increase-request-id slir_01AbCdEfGhIjKlMnOpQrSt \
1325 --amount 75000 \
1326 --suppress-notification
1327 ```
1328 
1329 ```python Python
1330 client = anthropic.Anthropic()
1331 
1332 increase_request = client.beta.organization.spend_limits.increase_requests.approve(
1333 "slir_01AbCdEfGhIjKlMnOpQrSt", amount="75000", suppress_notification=True
1334 )
1335 
1336 print(f"id: {increase_request.id}")
1337 print(f"status: {increase_request.status}")
1338 ```
1339 
1340 ```typescript TypeScript
1341 const client = new Anthropic();
1342 
1343 const increaseRequest = await client.beta.organization.spendLimits.increaseRequests.approve(
1344 "slir_01AbCdEfGhIjKlMnOpQrSt",
1345 {
1346 amount: "75000",
1347 suppress_notification: true
1348 }
1349 );
1350 
1351 console.log(`id: ${increaseRequest.id}`);
1352 console.log(`status: ${increaseRequest.status}`);
1353 ```
1354 
1355 ```csharp C#
1356 AnthropicClient client = new();
1357 
1358 var increaseRequest = await client.Beta.Organization.SpendLimits.IncreaseRequests.Approve(
1359 "slir_01AbCdEfGhIjKlMnOpQrSt",
1360 new() { Amount = "75000", SuppressNotification = true }
1361 );
1362 
1363 Console.WriteLine($"id: {increaseRequest.ID}");
1364 Console.WriteLine($"status: {increaseRequest.Status.Raw()}");
1365 ```
1366 
1367 ```go Go
1368 client := anthropic.NewClient()
1369 
1370 increaseRequest, err := client.Beta.Organization.SpendLimits.IncreaseRequests.Approve(
1371 context.Background(),
1372 "slir_01AbCdEfGhIjKlMnOpQrSt",
1373 anthropic.BetaOrganizationSpendLimitIncreaseRequestApproveParams{
1374 Amount: "75000",
1375 SuppressNotification: anthropic.Bool(true),
1376 },
1377 )
1378 if err != nil {
1379 log.Fatal(err)
1380 }
1381 
1382 fmt.Printf("id: %s\n", increaseRequest.ID)
1383 fmt.Printf("status: %s\n", increaseRequest.Status)
1384 ```
1385 
1386 ```java Java
1387 import com.anthropic.models.beta.organization.spendlimits.increaserequests.IncreaseRequestApproveParams;
1388 
1389 void main() {
1390 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1391 
1392 var params = IncreaseRequestApproveParams.builder()
1393 .amount("75000")
1394 .suppressNotification(true)
1395 .build();
1396 var increaseRequest = client.beta().organization().spendLimits().increaseRequests()
1397 .approve("slir_01AbCdEfGhIjKlMnOpQrSt", params);
1398 
1399 IO.println("id: " + increaseRequest.id());
1400 IO.println("status: " + increaseRequest.status().asString());
1401 }
1402 ```
1403 
1404 ```php PHP
1405 $client = new Client();
1406 
1407 $increaseRequest = $client->beta->organization->spendLimits->increaseRequests->approve(
1408 'slir_01AbCdEfGhIjKlMnOpQrSt',
1409 amount: '75000',
1410 suppressNotification: true,
1411 );
1412 
1413 echo "id: {$increaseRequest->id}\n";
1414 echo "status: {$increaseRequest->status}\n";
1415 ```
1416 
1417 ```ruby Ruby
1418 client = Anthropic::Client.new
1419 
1420 increase_request = client.beta.organization.spend_limits.increase_requests.approve(
1421 "slir_01AbCdEfGhIjKlMnOpQrSt",
1422 amount: "75000",
1423 suppress_notification: true
1424 )
1425 
1426 puts "id: #{increase_request.id}"
1427 puts "status: #{increase_request.status}"
1428 ```
1429 </CodeGroup>
1430 
1431 To deny, call the [deny endpoint](https://platform.claude.com/docs/en/manage-claude/spend-limits-api#deny-an-increase-request) with the same ID instead. Pass `suppress_notification: true` when your own system notifies the requester.
2891432 
2901433### Identify members close to their spend limit
2911434 
from line 1436
2931436 
29414371. Pull each member's month-to-date spend from the Analytics API (one row per member, highest spend first by default):
2951438 
296 ```bash cURL
297 curl "https://api.anthropic.com/v1/organizations/analytics/user_cost_report?starting_at=2026-06-01T00:00:00Z&limit=1000" \
298 --header "x-api-key: $ANALYTICS_API_KEY" \
299 --header "anthropic-version: 2023-06-01"
300 ```
301 
302 Each row carries `actor.user_id`, `actor.email`, and `amount` (the member's spend in cents). Page through `next_page` to cover the whole organization.
1439 <CodeGroup>
1440 ```bash cURL
1441 curl "https://api.anthropic.com/v1/organizations/analytics/user_cost_report?starting_at=2026-06-01T00:00:00Z&limit=1000" \
1442 -H "x-api-key: $ANTHROPIC_API_KEY" \
1443 -H "anthropic-version: 2023-06-01"
1444 ```
1445 
1446 ```bash CLI
1447 ant beta:organization:analytics:user-cost-report list \
1448 --starting-at 2026-06-01T00:00:00Z \
1449 --limit 1000
1450 ```
1451 
1452 ```python Python
1453 client = anthropic.Anthropic()
1454 
1455 cost_rows = client.beta.organization.analytics.user_cost_report.list(
1456 starting_at="2026-06-01T00:00:00Z", limit=1000
1457 )
1458 
1459 for cost_row in cost_rows:
1460 print(f"{cost_row.actor.user_id}: {cost_row.amount}")
1461 ```
1462 
1463 ```typescript TypeScript
1464 const client = new Anthropic();
1465 
1466 const costRows = await client.beta.organization.analytics.userCostReport.list({
1467 starting_at: "2026-06-01T00:00:00Z",
1468 limit: 1000
1469 });
1470 
1471 for await (const costRow of costRows) {
1472 console.log(`${costRow.actor.user_id}: ${costRow.amount}`);
1473 }
1474 ```
1475 
1476 ```csharp C#
1477 AnthropicClient client = new();
1478 
1479 var page = await client.Beta.Organization.Analytics.UserCostReport.List(
1480 new()
1481 {
1482 StartingAt = DateTimeOffset.Parse("2026-06-01T00:00:00Z"),
1483 Limit = 1000,
1484 }
1485 );
1486 
1487 await foreach (var costRow in page.Paginate())
1488 {
1489 Console.WriteLine($"{costRow.Actor.UserID}: {costRow.Amount}");
1490 }
1491 ```
1492 
1493 ```go Go
1494 client := anthropic.NewClient()
1495 
1496 costRows := client.Beta.Organization.Analytics.UserCostReport.ListAutoPaging(context.Background(), anthropic.BetaOrganizationAnalyticsUserCostReportListParams{
1497 StartingAt: time.Date(2026, time.June, 1, 0, 0, 0, 0, time.UTC),
1498 Limit: anthropic.Int(1000),
1499 })
1500 
1501 for costRows.Next() {
1502 costRow := costRows.Current()
1503 fmt.Printf("%s: %s\n", costRow.Actor.UserID, costRow.Amount)
1504 }
1505 if err := costRows.Err(); err != nil {
1506 log.Fatal(err)
1507 }
1508 ```
1509 
1510 ```java Java
1511 import com.anthropic.models.beta.organization.analytics.usercostreport.UserCostReportListParams;
1512 import java.time.OffsetDateTime;
1513 
1514 void main() {
1515 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1516 
1517 var params = UserCostReportListParams.builder()
1518 .startingAt(OffsetDateTime.parse("2026-06-01T00:00:00Z"))
1519 .limit(1000)
1520 .build();
1521 var costRows = client.beta().organization().analytics().userCostReport().list(params);
1522 
1523 for (var costRow : costRows.autoPager()) {
1524 IO.println(costRow.actor().userId() + ": " + costRow.amount());
1525 }
1526 }
1527 ```
1528 
1529 ```php PHP
1530 $client = new Client();
1531 
1532 $costRows = $client->beta->organization->analytics->userCostReport->list(
1533 startingAt: new \DateTimeImmutable('2026-06-01T00:00:00Z'),
1534 limit: 1000,
1535 );
1536 
1537 foreach ($costRows->pagingEachItem() as $costRow) {
1538 echo "{$costRow->actor->userID}: {$costRow->amount}\n";
1539 }
1540 ```
1541 
1542 ```ruby Ruby
1543 client = Anthropic::Client.new
1544 
1545 page = client.beta.organization.analytics.user_cost_report.list(
1546 starting_at: Time.utc(2026, 6, 1),
1547 limit: 1000
1548 )
1549 
1550 page.auto_paging_each do |cost_row|
1551 puts "#{cost_row.actor.user_id}: #{cost_row.amount}"
1552 end
1553 ```
1554 </CodeGroup>
1555 
1556 Each row contains `actor.user_id`, `actor.email_address`, and `amount` (the member's spend in cents). Page through `next_page` to cover the whole organization.
3031557 
30415582. For the top spenders (or everyone above a dollar threshold), fetch effective caps in batches:
3051559 
306 ```bash cURL
307 curl --globoff "https://api.anthropic.com/v1/organizations/spend_limits/effective?user_ids[]=user_01Ab...&user_ids[]=user_01Cd...&limit=100" \
308 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
309 --header "anthropic-version: 2023-06-01"
310 ```
1560 <CodeGroup>
1561 ```bash cURL
1562 curl -g "https://api.anthropic.com/v1/organizations/spend_limits/effective?user_ids[]=user_01AbCdEfGh&user_ids[]=user_01JkLmNoPq&limit=100" \
1563 -H "x-api-key: $ANTHROPIC_API_KEY" \
1564 -H "anthropic-version: 2023-06-01"
1565 ```
1566 
1567 ```bash CLI
1568 ant beta:organization:spend-limits:effective list \
1569 --user-id user_01AbCdEfGh \
1570 --user-id user_01JkLmNoPq \
1571 --limit 100
1572 ```
1573 
1574 ```python Python
1575 client = anthropic.Anthropic()
1576 
1577 effective_limits = client.beta.organization.spend_limits.effective.list(
1578 user_ids=["user_01AbCdEfGh", "user_01JkLmNoPq"], limit=100
1579 )
1580 
1581 for effective_limit in effective_limits:
1582 scope = effective_limit.scope
1583 if scope.type == "user":
1584 amount = effective_limit.amount or "unlimited"
1585 print(f"{scope.user_id}: {effective_limit.period_to_date_spend} of {amount}")
1586 ```
1587 
1588 ```typescript TypeScript
1589 const client = new Anthropic();
1590 
1591 const effectiveLimits = await client.beta.organization.spendLimits.effective.list({
1592 user_ids: ["user_01AbCdEfGh", "user_01JkLmNoPq"],
1593 limit: 100
1594 });
1595 
1596 for await (const effectiveLimit of effectiveLimits) {
1597 const { scope } = effectiveLimit;
1598 if (scope.type === "user") {
1599 const amount = effectiveLimit.amount ?? "unlimited";
1600 console.log(`${scope.user_id}: ${effectiveLimit.period_to_date_spend} of ${amount}`);
1601 }
1602 }
1603 ```
1604 
1605 ```csharp C#
1606 AnthropicClient client = new();
1607 
1608 var page = await client.Beta.Organization.SpendLimits.Effective.List(
1609 new() { UserIds = ["user_01AbCdEfGh", "user_01JkLmNoPq"], Limit = 100 }
1610 );
1611 
1612 await foreach (var effectiveLimit in page.Paginate())
1613 {
1614 if (effectiveLimit.Scope.TryPickBetaSpendLimitUser(out var userScope))
1615 {
1616 var amount = effectiveLimit.Amount ?? "unlimited";
1617 Console.WriteLine($"{userScope.UserID}: {effectiveLimit.PeriodToDateSpend} of {amount}");
1618 }
1619 }
1620 ```
1621 
1622 ```go Go
1623 client := anthropic.NewClient()
1624 
1625 effectiveLimits := client.Beta.Organization.SpendLimits.Effective.ListAutoPaging(context.Background(), anthropic.BetaOrganizationSpendLimitEffectiveListParams{
1626 UserIDs: []string{"user_01AbCdEfGh", "user_01JkLmNoPq"},
1627 Limit: anthropic.Int(100),
1628 })
1629 
1630 for effectiveLimits.Next() {
1631 effectiveLimit := effectiveLimits.Current()
1632 if userScope, ok := effectiveLimit.Scope.AsAny().(anthropic.BetaSpendLimitUserScope); ok {
1633 amount := effectiveLimit.Amount
1634 if !effectiveLimit.JSON.Amount.Valid() {
1635 amount = "unlimited"
1636 }
1637 fmt.Printf("%s: %s of %s\n", userScope.UserID, effectiveLimit.PeriodToDateSpend, amount)
1638 }
1639 }
1640 if err := effectiveLimits.Err(); err != nil {
1641 log.Fatal(err)
1642 }
1643 ```
1644 
1645 ```java Java
1646 import com.anthropic.models.beta.organization.spendlimits.effective.EffectiveListParams;
1647 
1648 void main() {
1649 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1650 
1651 var params = EffectiveListParams.builder()
1652 .addUserId("user_01AbCdEfGh")
1653 .addUserId("user_01JkLmNoPq")
1654 .limit(100)
1655 .build();
1656 var effectiveLimits = client.beta().organization().spendLimits().effective().list(params);
1657 
1658 for (var effectiveLimit : effectiveLimits.autoPager()) {
1659 var amount = effectiveLimit.amount().orElse("unlimited");
1660 effectiveLimit.scope().user().ifPresent(userScope ->
1661 IO.println(userScope.userId() + ": " + effectiveLimit.periodToDateSpend() + " of " + amount)
1662 );
1663 }
1664 }
1665 ```
1666 
1667 ```php PHP
1668 use Anthropic\Beta\Organization\SpendLimits\SpendLimitUserScope;
1669 // ...
1670 
1671 $client = new Client();
1672 
1673 $effectiveLimits = $client->beta->organization->spendLimits->effective->list(
1674 userIDs: ['user_01AbCdEfGh', 'user_01JkLmNoPq'],
1675 limit: 100,
1676 );
1677 
1678 foreach ($effectiveLimits->pagingEachItem() as $effectiveLimit) {
1679 $scope = $effectiveLimit->scope;
1680 if ($scope instanceof SpendLimitUserScope) {
1681 $amount = $effectiveLimit->amount ?? 'unlimited';
1682 echo "{$scope->userID}: {$effectiveLimit->periodToDateSpend} of {$amount}\n";
1683 }
1684 }
1685 ```
1686 
1687 ```ruby Ruby
1688 client = Anthropic::Client.new
1689 
1690 page = client.beta.organization.spend_limits.effective.list(
1691 user_ids: ["user_01AbCdEfGh", "user_01JkLmNoPq"],
1692 limit: 100
1693 )
1694 
1695 page.auto_paging_each do |effective_limit|
1696 scope = effective_limit.scope
1697 if scope.is_a?(Anthropic::Models::Beta::Organization::BetaSpendLimitUserScope)
1698 amount = effective_limit.amount || "unlimited"
1699 puts "#{scope.user_id}: #{effective_limit.period_to_date_spend} of #{amount}"
1700 end
1701 end
1702 ```
1703 </CodeGroup>
3111704 
3121705 Each row returns the cap as `amount` (`null` = unlimited, `"0"` = included usage only) alongside `period_to_date_spend`.
3131706 
from line 1714
3211714 
32217151. Pull per-member daily cost for the trailing two weeks from the Analytics API:
3231716 
324 ```bash cURL
325 curl "https://api.anthropic.com/v1/organizations/analytics/user_cost_report?starting_at=2026-06-09T00:00:00Z&ending_at=2026-06-23T00:00:00Z&bucket_width=1d&limit=1000" \
326 --header "x-api-key: $ANALYTICS_API_KEY" \
327 --header "anthropic-version: 2023-06-01"
328 ```
329 
330 With `bucket_width` set, each member spans one row per day with usage; page through `next_page` to collect every member's full series.
1717 <CodeGroup>
1718 ```bash cURL
1719 curl "https://api.anthropic.com/v1/organizations/analytics/user_cost_report?starting_at=2026-06-09T00:00:00Z&ending_at=2026-06-23T00:00:00Z&bucket_width=1d&limit=1000" \
1720 -H "x-api-key: $ANTHROPIC_API_KEY" \
1721 -H "anthropic-version: 2023-06-01"
1722 ```
1723 
1724 ```bash CLI
1725 ant beta:organization:analytics:user-cost-report list \
1726 --starting-at 2026-06-09T00:00:00Z \
1727 --ending-at 2026-06-23T00:00:00Z \
1728 --bucket-width 1d \
1729 --limit 1000
1730 ```
1731 
1732 ```python Python
1733 client = anthropic.Anthropic()
1734 
1735 cost_rows = client.beta.organization.analytics.user_cost_report.list(
1736 starting_at="2026-06-09T00:00:00Z",
1737 ending_at="2026-06-23T00:00:00Z",
1738 bucket_width="1d",
1739 limit=1000,
1740 )
1741 
1742 for cost_row in cost_rows:
1743 print(f"{cost_row.actor.user_id} {cost_row.starting_at}: {cost_row.amount}")
1744 ```
1745 
1746 ```typescript TypeScript
1747 const client = new Anthropic();
1748 
1749 const costRows = await client.beta.organization.analytics.userCostReport.list({
1750 starting_at: "2026-06-09T00:00:00Z",
1751 ending_at: "2026-06-23T00:00:00Z",
1752 bucket_width: "1d",
1753 limit: 1000
1754 });
1755 
1756 for await (const costRow of costRows) {
1757 console.log(`${costRow.actor.user_id} ${costRow.starting_at}: ${costRow.amount}`);
1758 }
1759 ```
1760 
1761 ```csharp C#
1762 using Anthropic.Models.Beta.Organization.Analytics.UserCostReport;
1763 
1764 AnthropicClient client = new();
1765 
1766 var page = await client.Beta.Organization.Analytics.UserCostReport.List(
1767 new()
1768 {
1769 StartingAt = DateTimeOffset.Parse("2026-06-09T00:00:00Z"),
1770 EndingAt = DateTimeOffset.Parse("2026-06-23T00:00:00Z"),
1771 BucketWidth = BucketWidth.Day,
1772 Limit = 1000,
1773 }
1774 );
1775 
1776 await foreach (var costRow in page.Paginate())
1777 {
1778 Console.WriteLine($"{costRow.Actor.UserID} {costRow.StartingAt}: {costRow.Amount}");
1779 }
1780 ```
1781 
1782 ```go Go
1783 client := anthropic.NewClient()
1784 
1785 costRows := client.Beta.Organization.Analytics.UserCostReport.ListAutoPaging(context.Background(), anthropic.BetaOrganizationAnalyticsUserCostReportListParams{
1786 StartingAt: time.Date(2026, time.June, 9, 0, 0, 0, 0, time.UTC),
1787 EndingAt: anthropic.Time(time.Date(2026, time.June, 23, 0, 0, 0, 0, time.UTC)),
1788 BucketWidth: anthropic.BetaOrganizationAnalyticsUserCostReportListParamsBucketWidthDay,
1789 Limit: anthropic.Int(1000),
1790 })
1791 
1792 for costRows.Next() {
1793 costRow := costRows.Current()
1794 fmt.Printf("%s %s: %s\n", costRow.Actor.UserID, costRow.StartingAt, costRow.Amount)
1795 }
1796 if err := costRows.Err(); err != nil {
1797 log.Fatal(err)
1798 }
1799 ```
1800 
1801 ```java Java
1802 import com.anthropic.models.beta.organization.analytics.usercostreport.UserCostReportListParams;
1803 import java.time.OffsetDateTime;
1804 
1805 void main() {
1806 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1807 
1808 var params = UserCostReportListParams.builder()
1809 .startingAt(OffsetDateTime.parse("2026-06-09T00:00:00Z"))
1810 .endingAt(OffsetDateTime.parse("2026-06-23T00:00:00Z"))
1811 .bucketWidth(UserCostReportListParams.BucketWidth.DAY)
1812 .limit(1000)
1813 .build();
1814 var costRows = client.beta().organization().analytics().userCostReport().list(params);
1815 
1816 for (var costRow : costRows.autoPager()) {
1817 IO.println(costRow.actor().userId() + " " + costRow.startingAt().orElseThrow() + ": " + costRow.amount());
1818 }
1819 }
1820 ```
1821 
1822 ```php PHP
1823 $client = new Client();
1824 
1825 $costRows = $client->beta->organization->analytics->userCostReport->list(
1826 startingAt: new \DateTimeImmutable('2026-06-09T00:00:00Z'),
1827 endingAt: new \DateTimeImmutable('2026-06-23T00:00:00Z'),
1828 bucketWidth: '1d',
1829 limit: 1000,
1830 );
1831 
1832 foreach ($costRows->pagingEachItem() as $costRow) {
1833 $startingAt = $costRow->startingAt?->format(\DateTimeInterface::ATOM);
1834 echo "{$costRow->actor->userID} {$startingAt}: {$costRow->amount}\n";
1835 }
1836 ```
1837 
1838 ```ruby Ruby
1839 client = Anthropic::Client.new
1840 
1841 page = client.beta.organization.analytics.user_cost_report.list(
1842 starting_at: Time.utc(2026, 6, 9),
1843 ending_at: Time.utc(2026, 6, 23),
1844 bucket_width: :"1d",
1845 limit: 1000
1846 )
1847 
1848 page.auto_paging_each do |cost_row|
1849 puts "#{cost_row.actor.user_id} #{cost_row.starting_at}: #{cost_row.amount}"
1850 end
1851 ```
1852 </CodeGroup>
1853 
1854 With `bucket_width` set, each member spans one row per day with usage. Page through `next_page` to collect every member's full series.
3311855 
33218562. Group rows by `actor.user_id`. For each member, sum the most recent seven days and the prior seven days. Flag members whose recent week exceeds the prior week by your chosen multiple (for example, three). Recent-day cost is provisional and can be revised upward; for repeatable comparisons, set `ending_at` at or before a previously returned `data_refreshed_at` (see [Data availability and freshness](https://platform.claude.com/docs/en/manage-claude/analytics-api#data-availability-and-freshness)).
3331857 
from line 1863
3391863 
34018641. Read the member's current cap, and record it for the rollback:
3411865 
342 ```bash cURL
343 curl --globoff "https://api.anthropic.com/v1/organizations/spend_limits/effective?user_ids[]=user_01AbCdEfGh&period[]=monthly" \
344 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
345 --header "anthropic-version: 2023-06-01"
346 ```
1866 <CodeGroup>
1867 ```bash cURL
1868 curl -g "https://api.anthropic.com/v1/organizations/spend_limits/effective?user_ids[]=user_01AbCdEfGh&period[]=monthly" \
1869 -H "x-api-key: $ANTHROPIC_API_KEY" \
1870 -H "anthropic-version: 2023-06-01"
1871 ```
1872 
1873 ```bash CLI
1874 ant beta:organization:spend-limits:effective list \
1875 --user-id user_01AbCdEfGh \
1876 --period monthly
1877 ```
1878 
1879 ```python Python
1880 client = anthropic.Anthropic()
1881 
1882 effective_limits = client.beta.organization.spend_limits.effective.list(
1883 user_ids=["user_01AbCdEfGh"], period=["monthly"]
1884 )
1885 
1886 for effective_limit in effective_limits:
1887 scope = effective_limit.scope
1888 if scope.type == "user":
1889 amount = effective_limit.amount or "unlimited"
1890 print(f"{scope.user_id}: {effective_limit.period_to_date_spend} of {amount}")
1891 ```
1892 
1893 ```typescript TypeScript
1894 const client = new Anthropic();
1895 
1896 const effectiveLimits = await client.beta.organization.spendLimits.effective.list({
1897 user_ids: ["user_01AbCdEfGh"],
1898 period: ["monthly"]
1899 });
1900 
1901 for await (const effectiveLimit of effectiveLimits) {
1902 const { scope } = effectiveLimit;
1903 if (scope.type === "user") {
1904 const amount = effectiveLimit.amount ?? "unlimited";
1905 console.log(`${scope.user_id}: ${effectiveLimit.period_to_date_spend} of ${amount}`);
1906 }
1907 }
1908 ```
1909 
1910 ```csharp C#
1911 using Anthropic.Models.Beta.Organization.SpendLimits.Effective;
1912 
1913 AnthropicClient client = new();
1914 
1915 var page = await client.Beta.Organization.SpendLimits.Effective.List(
1916 new() { UserIds = ["user_01AbCdEfGh"], Period = [Period.Monthly] }
1917 );
1918 
1919 await foreach (var effectiveLimit in page.Paginate())
1920 {
1921 if (effectiveLimit.Scope.TryPickBetaSpendLimitUser(out var userScope))
1922 {
1923 var amount = effectiveLimit.Amount ?? "unlimited";
1924 Console.WriteLine($"{userScope.UserID}: {effectiveLimit.PeriodToDateSpend} of {amount}");
1925 }
1926 }
1927 ```
1928 
1929 ```go Go
1930 client := anthropic.NewClient()
1931 
1932 effectiveLimits := client.Beta.Organization.SpendLimits.Effective.ListAutoPaging(context.Background(), anthropic.BetaOrganizationSpendLimitEffectiveListParams{
1933 UserIDs: []string{"user_01AbCdEfGh"},
1934 Period: []string{"monthly"},
1935 })
1936 
1937 for effectiveLimits.Next() {
1938 effectiveLimit := effectiveLimits.Current()
1939 if userScope, ok := effectiveLimit.Scope.AsAny().(anthropic.BetaSpendLimitUserScope); ok {
1940 amount := effectiveLimit.Amount
1941 if !effectiveLimit.JSON.Amount.Valid() {
1942 amount = "unlimited"
1943 }
1944 fmt.Printf("%s: %s of %s\n", userScope.UserID, effectiveLimit.PeriodToDateSpend, amount)
1945 }
1946 }
1947 if err := effectiveLimits.Err(); err != nil {
1948 log.Fatal(err)
1949 }
1950 ```
1951 
1952 ```java Java
1953 import com.anthropic.models.beta.organization.spendlimits.effective.EffectiveListParams;
1954 
1955 void main() {
1956 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1957 
1958 var params = EffectiveListParams.builder()
1959 .addUserId("user_01AbCdEfGh")
1960 .addPeriod(EffectiveListParams.Period.MONTHLY)
1961 .build();
1962 var effectiveLimits = client.beta().organization().spendLimits().effective().list(params);
1963 
1964 for (var effectiveLimit : effectiveLimits.autoPager()) {
1965 var amount = effectiveLimit.amount().orElse("unlimited");
1966 effectiveLimit.scope().user().ifPresent(userScope ->
1967 IO.println(userScope.userId() + ": " + effectiveLimit.periodToDateSpend() + " of " + amount)
1968 );
1969 }
1970 }
1971 ```
1972 
1973 ```php PHP
1974 use Anthropic\Beta\Organization\SpendLimits\SpendLimitUserScope;
1975 // ...
1976 
1977 $client = new Client();
1978 
1979 $effectiveLimits = $client->beta->organization->spendLimits->effective->list(
1980 userIDs: ['user_01AbCdEfGh'],
1981 period: ['monthly'],
1982 );
1983 
1984 foreach ($effectiveLimits->pagingEachItem() as $effectiveLimit) {
1985 $scope = $effectiveLimit->scope;
1986 if ($scope instanceof SpendLimitUserScope) {
1987 $amount = $effectiveLimit->amount ?? 'unlimited';
1988 echo "{$scope->userID}: {$effectiveLimit->periodToDateSpend} of {$amount}\n";
1989 }
1990 }
1991 ```
1992 
1993 ```ruby Ruby
1994 client = Anthropic::Client.new
1995 
1996 page = client.beta.organization.spend_limits.effective.list(
1997 user_ids: ["user_01AbCdEfGh"],
1998 period: [:monthly]
1999 )
2000 
2001 page.auto_paging_each do |effective_limit|
2002 scope = effective_limit.scope
2003 if scope.is_a?(Anthropic::Models::Beta::Organization::BetaSpendLimitUserScope)
2004 amount = effective_limit.amount || "unlimited"
2005 puts "#{scope.user_id}: #{effective_limit.period_to_date_spend} of #{amount}"
2006 end
2007 end
2008 ```
2009 </CodeGroup>
3472010 
34820112. Raise the cap:
3492012 
350 ```bash cURL
351 curl --request POST "https://api.anthropic.com/v1/organizations/spend_limits" \
352 --header "content-type: application/json" \
353 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
354 --header "anthropic-version: 2023-06-01" \
355 --data '{"scope": {"type": "user", "user_id": "user_01AbCdEfGh"}, "amount": "500000", "period": "monthly"}'
356 ```
2013 <CodeGroup>
2014 ```bash cURL
2015 curl -X POST "https://api.anthropic.com/v1/organizations/spend_limits" \
2016 -H "content-type: application/json" \
2017 -H "x-api-key: $ANTHROPIC_API_KEY" \
2018 -H "anthropic-version: 2023-06-01" \
2019 -d '{"scope": {"type": "user", "user_id": "user_01AbCdEfGh"}, "amount": "500000", "period": "monthly"}'
2020 ```
2021 
2022 ```bash CLI
2023 ant beta:organization:spend-limits set \
2024 --scope '{type: user, user_id: user_01AbCdEfGh}' \
2025 --amount 500000 \
2026 --period monthly
2027 ```
2028 
2029 ```python Python
2030 client = anthropic.Anthropic()
2031 
2032 spend_limit = client.beta.organization.spend_limits.set(
2033 scope={"type": "user", "user_id": "user_01AbCdEfGh"},
2034 amount="500000",
2035 period="monthly",
2036 )
2037 
2038 print(f"id: {spend_limit.id}")
2039 print(f"amount: {spend_limit.amount}")
2040 ```
2041 
2042 ```typescript TypeScript
2043 const client = new Anthropic();
2044 
2045 const spendLimit = await client.beta.organization.spendLimits.set({
2046 scope: { type: "user", user_id: "user_01AbCdEfGh" },
2047 amount: "500000",
2048 period: "monthly"
2049 });
2050 
2051 console.log(`id: ${spendLimit.id}`);
2052 console.log(`amount: ${spendLimit.amount}`);
2053 ```
2054 
2055 ```csharp C#
2056 using Anthropic.Models.Beta.Organization.SpendLimits;
2057 
2058 AnthropicClient client = new();
2059 
2060 var spendLimit = await client.Beta.Organization.SpendLimits.Set(
2061 new()
2062 {
2063 Scope = new BetaSpendLimitUserScope("user_01AbCdEfGh"),
2064 Amount = "500000",
2065 Period = BetaSpendLimitPeriod.Monthly,
2066 }
2067 );
2068 
2069 Console.WriteLine($"id: {spendLimit.ID}");
2070 Console.WriteLine($"amount: {spendLimit.Amount}");
2071 ```
2072 
2073 ```go Go
2074 client := anthropic.NewClient()
2075 
2076 spendLimit, err := client.Beta.Organization.SpendLimits.Set(context.Background(), anthropic.BetaOrganizationSpendLimitSetParams{
2077 Scope: anthropic.BetaOrganizationSpendLimitSetParamsScopeUnion{
2078 OfUser: &anthropic.BetaSpendLimitUserScopeParam{UserID: "user_01AbCdEfGh"},
2079 },
2080 Amount: anthropic.String("500000"),
2081 Period: anthropic.BetaSpendLimitPeriodMonthly,
2082 })
2083 if err != nil {
2084 log.Fatal(err)
2085 }
2086 
2087 fmt.Printf("id: %s\n", spendLimit.ID)
2088 fmt.Printf("amount: %s\n", spendLimit.Amount)
2089 ```
2090 
2091 ```java Java
2092 import com.anthropic.models.beta.organization.spendlimits.BetaSpendLimitPeriod;
2093 import com.anthropic.models.beta.organization.spendlimits.SpendLimitSetParams;
2094 
2095 void main() {
2096 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
2097 
2098 var params = SpendLimitSetParams.builder()
2099 .userScope("user_01AbCdEfGh")
2100 .amount("500000")
2101 .period(BetaSpendLimitPeriod.MONTHLY)
2102 .build();
2103 var spendLimit = client.beta().organization().spendLimits().set(params);
2104 
2105 IO.println("id: " + spendLimit.id());
2106 IO.println("amount: " + spendLimit.amount().orElseThrow());
2107 }
2108 ```
2109 
2110 ```php PHP
2111 use Anthropic\Beta\Organization\SpendLimits\SpendLimitUserScope;
2112 // ...
2113 
2114 $client = new Client();
2115 
2116 $spendLimit = $client->beta->organization->spendLimits->set(
2117 scope: SpendLimitUserScope::with(userID: 'user_01AbCdEfGh'),
2118 amount: '500000',
2119 period: 'monthly',
2120 );
2121 
2122 echo "id: {$spendLimit->id}\n";
2123 echo "amount: {$spendLimit->amount}\n";
2124 ```
2125 
2126 ```ruby Ruby
2127 client = Anthropic::Client.new
2128 
2129 spend_limit = client.beta.organization.spend_limits.set(
2130 scope: { type: :user, user_id: "user_01AbCdEfGh" },
2131 amount: "500000",
2132 period: :monthly
2133 )
2134 
2135 puts "id: #{spend_limit.id}"
2136 puts "amount: #{spend_limit.amount}"
2137 ```
2138 </CodeGroup>
3572139 
35821403. If responders need broader access during an incident, pre-provision an incident-responders group whose [custom role](https://platform.claude.com/docs/en/manage-claude/user-management#custom-roles) grants it, and add the member for the duration:
3592141 
360 ```bash cURL
361 curl --request POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members" \
362 --header "content-type: application/json" \
363 --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
364 --header "anthropic-version: 2023-06-01" \
365 --data '{"user_id": "user_01AbCdEfGh"}'
366 ```
2142 <CodeGroup>
2143 ```bash cURL
2144 curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members" \
2145 -H "content-type: application/json" \
2146 -H "x-api-key: $ANTHROPIC_API_KEY" \
2147 -H "anthropic-version: 2023-06-01" \
2148 -d '{"user_id": "user_01AbCdEfGh"}'
2149 ```
2150 
2151 ```bash CLI
2152 ant beta:organization:rbac-groups:members add \
2153 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
2154 --user-id user_01AbCdEfGh
2155 ```
2156 
2157 ```python Python
2158 client = anthropic.Anthropic()
2159 
2160 member = client.beta.organization.rbac_groups.members.add(
2161 "rbac_group_01UvWxYzAbCdEfGhIjKlMn", user_id="user_01AbCdEfGh"
2162 )
2163 
2164 print(f"user_id: {member.user_id}")
2165 print(f"rbac_group_id: {member.rbac_group_id}")
2166 ```
2167 
2168 ```typescript TypeScript
2169 const client = new Anthropic();
2170 
2171 const member = await client.beta.organization.rbacGroups.members.add(
2172 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
2173 {
2174 user_id: "user_01AbCdEfGh"
2175 }
2176 );
2177 
2178 console.log(`user_id: ${member.user_id}`);
2179 console.log(`rbac_group_id: ${member.rbac_group_id}`);
2180 ```
2181 
2182 ```csharp C#
2183 AnthropicClient client = new();
2184 
2185 var member = await client.Beta.Organization.RbacGroups.Members.Add(
2186 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
2187 new() { UserID = "user_01AbCdEfGh" }
2188 );
2189 
2190 Console.WriteLine($"user_id: {member.UserID}");
2191 Console.WriteLine($"rbac_group_id: {member.RbacGroupID}");
2192 ```
2193 
2194 ```go Go
2195 client := anthropic.NewClient()
2196 
2197 member, err := client.Beta.Organization.RBACGroups.Members.Add(
2198 context.Background(),
2199 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
2200 anthropic.BetaOrganizationRBACGroupMemberAddParams{
2201 UserID: "user_01AbCdEfGh",
2202 },
2203 )
2204 if err != nil {
2205 log.Fatal(err)
2206 }
2207 
2208 fmt.Printf("user_id: %s\n", member.UserID)
2209 fmt.Printf("rbac_group_id: %s\n", member.RBACGroupID)
2210 ```
2211 
2212 ```java Java
2213 import com.anthropic.models.beta.organization.rbacgroups.members.MemberAddParams;
2214 
2215 void main() {
2216 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
2217 
2218 var params = MemberAddParams.builder()
2219 .userId("user_01AbCdEfGh")
2220 .build();
2221 var member = client.beta().organization().rbacGroups().members()
2222 .add("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);
2223 
2224 IO.println("user_id: " + member.userId());
2225 IO.println("rbac_group_id: " + member.rbacGroupId());
2226 }
2227 ```
2228 
2229 ```php PHP
2230 $client = new Client();
2231 
2232 $member = $client->beta->organization->rbacGroups->members->add(
2233 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
2234 userID: 'user_01AbCdEfGh',
2235 );
2236 
2237 echo "user_id: {$member->userID}\n";
2238 echo "rbac_group_id: {$member->rbacGroupID}\n";
2239 ```
2240 
2241 ```ruby Ruby
2242 client = Anthropic::Client.new
2243 
2244 member = client.beta.organization.rbac_groups.members.add(
2245 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
2246 user_id: "user_01AbCdEfGh"
2247 )
2248 
2249 puts "user_id: #{member.user_id}"
2250 puts "rbac_group_id: #{member.rbac_group_id}"
2251 ```
2252 </CodeGroup>
3672253 
3682254 See [User management](https://platform.claude.com/docs/en/manage-claude/user-management#groups) for the group endpoints.
3692255 
3702256 

manage-claude/usage-cost-api Changed · +4 / -10 lines

#### Fast mode #### Fast mode (research preview)

from line 104
104104 
105105* **Time buckets:** Aggregate usage data in fixed intervals (`1m`, `1h`, or `1d`)
106106* **Token tracking:** Measure uncached input, cached input, cache creation, and output tokens
107* **Filtering & grouping:** Filter by API key, workspace, model, service tier, context window, [data residency](https://platform.claude.com/docs/en/manage-claude/data-residency), or speed (beta), and group results by these dimensions
107* **Filtering & grouping:** Filter by API key, workspace, model, service tier, context window, [data residency](https://platform.claude.com/docs/en/manage-claude/data-residency), or speed, and group results by these dimensions
108108* **Server tool usage:** Track usage of server-side tools such as web search
109109 
110110For complete parameter details and response schemas, see the [Usage API reference](https://platform.claude.com/docs/en/api/beta/organization/usage_report/retrieve_messages).
from line 190
190190 Models released before February 2026 (prior to Claude Opus 4.6 and Claude Sonnet 4.6) don't support the `inference_geo` request parameter, so their usage reports return `"not_available"` for this dimension. You can use `not_available` as a filter value in `inference_geos[]` to target those models.
191191</Note>
192192 
193#### Fast mode (research preview)
193#### Fast mode
194194 
195195Track [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) usage by grouping and filtering with the `speed` dimension. This is useful for monitoring standard versus fast mode usage.
196196 
from line 202
202202group_by[]=model&\
203203bucket_width=1d" \
204204 -H "anthropic-version: 2023-06-01" \
205 -H "anthropic-beta: fast-mode-2026-02-01" \
206205 -H "x-api-key: $ANTHROPIC_ADMIN_KEY"
207206```
208207 
from line 215
216215group_by[]=model&\
217216bucket_width=1d" \
218217 -H "anthropic-version: 2023-06-01" \
219 -H "anthropic-beta: fast-mode-2026-02-01" \
220218 -H "x-api-key: $ANTHROPIC_ADMIN_KEY"
221219```
222 
223<Note>
224 Both the `speeds[]` filter and the `speed` group\_by value require the `fast-mode-2026-02-01` beta header.
225</Note>
226220 
227221### Time granularity limits
228222 

manage-claude/user-management Changed · +2038 / -120 lines

The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.

from line 47
4747 
4848## Quick start
4949 
50Set the `ANTHROPIC_API_KEY` environment variable to your Admin API key. The examples on this page read the key from it. The SDK and the `ant` CLI send the `x-api-key` and `anthropic-version` headers for you.
51 
5052List the organization's members, newest first:
5153 
52```bash cURL
53curl "https://api.anthropic.com/v1/organizations/users?limit=20" \
54 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
55 -H "anthropic-version: 2023-06-01"
56```
54<CodeGroup>
55 ```bash cURL
56 curl "https://api.anthropic.com/v1/organizations/users?limit=20" \
57 -H "x-api-key: $ANTHROPIC_API_KEY" \
58 -H "anthropic-version: 2023-06-01"
59 ```
60 
61 ```bash CLI
62 ant organization:users list --limit 20
63 ```
64 
65 ```python Python
66 client = anthropic.Anthropic()
67 
68 users = client.organization.users.list(limit=20)
69 
70 for user in users:
71 print(f"{user.id}: {user.email} ({user.role})")
72 ```
73 
74 ```typescript TypeScript
75 const client = new Anthropic();
76 
77 const users = await client.organization.users.list({ limit: 20 });
78 
79 for await (const user of users) {
80 console.log(`${user.id}: ${user.email} (${user.role})`);
81 }
82 ```
83 
84 ```csharp C#
85 AnthropicClient client = new();
86 
87 var page = await client.Organization.Users.List(new() { Limit = 20 });
88 
89 await foreach (var user in page.Paginate())
90 {
91 Console.WriteLine($"{user.ID}: {user.Email} ({user.Role.Raw()})");
92 }
93 ```
94 
95 ```go Go
96 client := anthropic.NewClient()
97 
98 users := client.Organization.Users.ListAutoPaging(context.Background(), anthropic.OrganizationUserListParams{
99 Limit: anthropic.Int(20),
100 })
101 
102 for users.Next() {
103 user := users.Current()
104 fmt.Printf("%s: %s (%s)\n", user.ID, user.Email, user.Role)
105 }
106 if err := users.Err(); err != nil {
107 log.Fatal(err)
108 }
109 ```
110 
111 ```java Java
112 import com.anthropic.models.organization.users.UserListParams;
113 
114 void main() {
115 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
116 
117 var params = UserListParams.builder()
118 .limit(20)
119 .build();
120 var users = client.organization().users().list(params);
121 
122 for (var user : users.autoPager()) {
123 IO.println(user.id() + ": " + user.email() + " (" + user.role().asString() + ")");
124 }
125 }
126 ```
127 
128 ```php PHP
129 $client = new Client();
130 
131 $users = $client->organization->users->list(limit: 20);
132 
133 foreach ($users->pagingEachItem() as $user) {
134 echo "{$user->id}: {$user->email} ({$user->role})\n";
135 }
136 ```
137 
138 ```ruby Ruby
139 client = Anthropic::Client.new
140 
141 users = client.organization.users.list(limit: 20)
142 
143 users.auto_paging_each do |user|
144 puts "#{user.id}: #{user.email} (#{user.role})"
145 end
146 ```
147</CodeGroup>
57148 
58149```json
59150{
from line 202
111202 
112203Member and invite lists use ID-based pagination: pass `limit` (default 20, max 1000) plus at most one of `before_id` or `after_id`, and page using the `first_id` and `last_id` fields of each response until `has_more` is `false`. Group and custom-role lists use an **opaque cursor** instead: the response's `next_page` value is passed unchanged as the `page` parameter on the next request, until `next_page` is `null`.
113204 
205When you iterate over the results, the SDK fetches more pages for you, so `limit` sets the page size, not the total. In the CLI, `--limit` sets the total number of results for member and invite lists. For group and role lists, it sets the page size.
206 
114207## Error responses
115208 
116209Error responses follow the standard shape documented in [Errors](https://platform.claude.com/docs/en/api/errors).
from line 216
123216 
124217For complete parameter details and response schemas, see [List users](https://platform.claude.com/docs/en/api/organization/users/list) in the API reference.
125218 
126```bash cURL
127curl "https://api.anthropic.com/v1/organizations/[email protected]" \
128 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
129 -H "anthropic-version: 2023-06-01"
130```
219<CodeGroup>
220 ```bash cURL
221 curl "https://api.anthropic.com/v1/organizations/[email protected]" \
222 -H "x-api-key: $ANTHROPIC_API_KEY" \
223 -H "anthropic-version: 2023-06-01"
224 ```
225 
226 ```bash CLI
227 ant organization:users list --email [email protected]
228 ```
229 
230 ```python Python
231 client = anthropic.Anthropic()
232 
233 users = client.organization.users.list(email="[email protected]")
234 
235 for user in users:
236 print(f"{user.id}: {user.email} ({user.role})")
237 ```
238 
239 ```typescript TypeScript
240 const client = new Anthropic();
241 
242 const users = await client.organization.users.list({ email: "[email protected]" });
243 
244 for await (const user of users) {
245 console.log(`${user.id}: ${user.email} (${user.role})`);
246 }
247 ```
248 
249 ```csharp C#
250 AnthropicClient client = new();
251 
252 var page = await client.Organization.Users.List(new() { Email = "[email protected]" });
253 
254 await foreach (var user in page.Paginate())
255 {
256 Console.WriteLine($"{user.ID}: {user.Email} ({user.Role.Raw()})");
257 }
258 ```
259 
260 ```go Go
261 client := anthropic.NewClient()
262 
263 users := client.Organization.Users.ListAutoPaging(context.Background(), anthropic.OrganizationUserListParams{
264 Email: anthropic.String("[email protected]"),
265 })
266 
267 for users.Next() {
268 user := users.Current()
269 fmt.Printf("%s: %s (%s)\n", user.ID, user.Email, user.Role)
270 }
271 if err := users.Err(); err != nil {
272 log.Fatal(err)
273 }
274 ```
275 
276 ```java Java
277 import com.anthropic.models.organization.users.UserListParams;
278 
279 void main() {
280 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
281 
282 var params = UserListParams.builder()
283 .email("[email protected]")
284 .build();
285 var users = client.organization().users().list(params);
286 
287 for (var user : users.autoPager()) {
288 IO.println(user.id() + ": " + user.email() + " (" + user.role().asString() + ")");
289 }
290 }
291 ```
292 
293 ```php PHP
294 $client = new Client();
295 
296 $users = $client->organization->users->list(email: '[email protected]');
297 
298 foreach ($users->pagingEachItem() as $user) {
299 echo "{$user->id}: {$user->email} ({$user->role})\n";
300 }
301 ```
302 
303 ```ruby Ruby
304 client = Anthropic::Client.new
305 
306 users = client.organization.users.list(email: "[email protected]")
307 
308 users.auto_paging_each do |user|
309 puts "#{user.id}: #{user.email} (#{user.role})"
310 end
311 ```
312</CodeGroup>
131313 
132314### Get a member
133315 
from line 317
135317 
136318For complete parameter details and response schemas, see [Get user](https://platform.claude.com/docs/en/api/organization/users/retrieve) in the API reference.
137319 
138```bash cURL
139curl "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
140 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
141 -H "anthropic-version: 2023-06-01"
142```
320<CodeGroup>
321 ```bash cURL
322 curl "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
323 -H "x-api-key: $ANTHROPIC_API_KEY" \
324 -H "anthropic-version: 2023-06-01"
325 ```
326 
327 ```bash CLI
328 ant organization:users retrieve --user-id user_01AbCdEfGhIjKlMnOpQrSt
329 ```
330 
331 ```python Python
332 client = anthropic.Anthropic()
333 
334 user = client.organization.users.retrieve("user_01AbCdEfGhIjKlMnOpQrSt")
335 
336 print(f"id: {user.id}")
337 print(f"email: {user.email}")
338 print(f"role: {user.role}")
339 ```
340 
341 ```typescript TypeScript
342 const client = new Anthropic();
343 
344 const user = await client.organization.users.retrieve("user_01AbCdEfGhIjKlMnOpQrSt");
345 
346 console.log(`id: ${user.id}`);
347 console.log(`email: ${user.email}`);
348 console.log(`role: ${user.role}`);
349 ```
350 
351 ```csharp C#
352 AnthropicClient client = new();
353 
354 var user = await client.Organization.Users.Retrieve("user_01AbCdEfGhIjKlMnOpQrSt");
355 
356 Console.WriteLine($"id: {user.ID}");
357 Console.WriteLine($"email: {user.Email}");
358 Console.WriteLine($"role: {user.Role.Raw()}");
359 ```
360 
361 ```go Go
362 client := anthropic.NewClient()
363 
364 user, err := client.Organization.Users.Get(context.Background(), "user_01AbCdEfGhIjKlMnOpQrSt")
365 if err != nil {
366 log.Fatal(err)
367 }
368 
369 fmt.Printf("id: %s\n", user.ID)
370 fmt.Printf("email: %s\n", user.Email)
371 fmt.Printf("role: %s\n", user.Role)
372 ```
373 
374 ```java Java
375 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
376 
377 var user = client.organization().users()
378 .retrieve("user_01AbCdEfGhIjKlMnOpQrSt");
379 
380 IO.println("id: " + user.id());
381 IO.println("email: " + user.email());
382 IO.println("role: " + user.role().asString());
383 ```
384 
385 ```php PHP
386 $client = new Client();
387 
388 $user = $client->organization->users->retrieve(
389 userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
390 );
391 
392 echo "id: {$user->id}\n";
393 echo "email: {$user->email}\n";
394 echo "role: {$user->role}\n";
395 ```
396 
397 ```ruby Ruby
398 client = Anthropic::Client.new
399 
400 user = client.organization.users.retrieve("user_01AbCdEfGhIjKlMnOpQrSt")
401 
402 puts "id: #{user.id}"
403 puts "email: #{user.email}"
404 puts "role: #{user.role}"
405 ```
406</CodeGroup>
143407 
144408### Change a member's role
145409 
from line 411
147411 
148412For complete parameter details and response schemas, see [Update user](https://platform.claude.com/docs/en/api/organization/users/update) in the API reference.
149413 
150```bash cURL
151curl -X POST "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
152 -H "content-type: application/json" \
153 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
154 -H "anthropic-version: 2023-06-01" \
155 -d '{"role": "managed"}'
156```
414<CodeGroup>
415 ```bash cURL
416 curl -X POST "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
417 -H "content-type: application/json" \
418 -H "x-api-key: $ANTHROPIC_API_KEY" \
419 -H "anthropic-version: 2023-06-01" \
420 -d '{"role": "managed"}'
421 ```
422 
423 ```bash CLI
424 ant organization:users update \
425 --user-id user_01AbCdEfGhIjKlMnOpQrSt \
426 --role managed
427 ```
428 
429 ```python Python
430 client = anthropic.Anthropic()
431 
432 user = client.organization.users.update("user_01AbCdEfGhIjKlMnOpQrSt", role="managed")
433 
434 print(f"id: {user.id}")
435 print(f"role: {user.role}")
436 ```
437 
438 ```typescript TypeScript
439 const client = new Anthropic();
440 
441 const user = await client.organization.users.update("user_01AbCdEfGhIjKlMnOpQrSt", {
442 role: "managed"
443 });
444 
445 console.log(`id: ${user.id}`);
446 console.log(`role: ${user.role}`);
447 ```
448 
449 ```csharp C#
450 using Anthropic.Models.Organization.Users;
451 // ...
452 
453 AnthropicClient client = new();
454 
455 var user = await client.Organization.Users.Update(
456 "user_01AbCdEfGhIjKlMnOpQrSt",
457 new() { Role = Role.Managed }
458 );
459 
460 Console.WriteLine($"id: {user.ID}");
461 Console.WriteLine($"role: {user.Role.Raw()}");
462 ```
463 
464 ```go Go
465 client := anthropic.NewClient()
466 
467 user, err := client.Organization.Users.Update(
468 context.Background(),
469 "user_01AbCdEfGhIjKlMnOpQrSt",
470 anthropic.OrganizationUserUpdateParams{
471 Role: anthropic.OrganizationUserUpdateParamsRoleManaged,
472 },
473 )
474 if err != nil {
475 log.Fatal(err)
476 }
477 
478 fmt.Printf("id: %s\n", user.ID)
479 fmt.Printf("role: %s\n", user.Role)
480 ```
481 
482 ```java Java
483 import com.anthropic.models.organization.users.UserUpdateParams;
484 
485 void main() {
486 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
487 
488 var params = UserUpdateParams.builder()
489 .role(UserUpdateParams.Role.MANAGED)
490 .build();
491 var user = client.organization().users()
492 .update("user_01AbCdEfGhIjKlMnOpQrSt", params);
493 
494 IO.println("id: " + user.id());
495 IO.println("role: " + user.role().asString());
496 }
497 ```
498 
499 ```php PHP
500 use Anthropic\Organization\Users\UserUpdateParams\Role;
501 // ...
502 
503 $client = new Client();
504 
505 $user = $client->organization->users->update(
506 userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
507 role: Role::MANAGED,
508 );
509 
510 echo "id: {$user->id}\n";
511 echo "role: {$user->role}\n";
512 ```
513 
514 ```ruby Ruby
515 client = Anthropic::Client.new
516 
517 user_id = "user_01AbCdEfGhIjKlMnOpQrSt"
518 user = client.organization.users.update(user_id, role: :managed)
519 
520 puts "id: #{user.id}"
521 puts "role: #{user.role}"
522 ```
523</CodeGroup>
157524 
158525### Remove a member
159526 
from line 528
161528 
162529For complete parameter details and response schemas, see [Remove user](https://platform.claude.com/docs/en/api/organization/users/remove) in the API reference.
163530 
164```bash cURL
165curl -X DELETE "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
166 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
167 -H "anthropic-version: 2023-06-01"
168```
531<CodeGroup>
532 ```bash cURL
533 curl -X DELETE "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
534 -H "x-api-key: $ANTHROPIC_API_KEY" \
535 -H "anthropic-version: 2023-06-01"
536 ```
537 
538 ```bash CLI
539 ant organization:users remove --user-id user_01AbCdEfGhIjKlMnOpQrSt
540 ```
541 
542 ```python Python
543 client = anthropic.Anthropic()
544 
545 removed_user = client.organization.users.remove("user_01AbCdEfGhIjKlMnOpQrSt")
546 
547 print(f"id: {removed_user.id}")
548 ```
549 
550 ```typescript TypeScript
551 const client = new Anthropic();
552 
553 const removedUser = await client.organization.users.remove("user_01AbCdEfGhIjKlMnOpQrSt");
554 
555 console.log(`id: ${removedUser.id}`);
556 ```
557 
558 ```csharp C#
559 AnthropicClient client = new();
560 
561 var removedUser = await client.Organization.Users.Remove("user_01AbCdEfGhIjKlMnOpQrSt");
562 
563 Console.WriteLine($"id: {removedUser.ID}");
564 ```
565 
566 ```go Go
567 client := anthropic.NewClient()
568 
569 removedUser, err := client.Organization.Users.Remove(context.Background(), "user_01AbCdEfGhIjKlMnOpQrSt")
570 if err != nil {
571 log.Fatal(err)
572 }
573 
574 fmt.Printf("id: %s\n", removedUser.ID)
575 ```
576 
577 ```java Java
578 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
579 
580 var removedUser = client.organization().users()
581 .remove("user_01AbCdEfGhIjKlMnOpQrSt");
582 
583 IO.println("id: " + removedUser.id());
584 ```
585 
586 ```php PHP
587 $client = new Client();
588 
589 $removedUser = $client->organization->users->remove(
590 userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
591 );
592 
593 echo "id: {$removedUser->id}\n";
594 ```
595 
596 ```ruby Ruby
597 client = Anthropic::Client.new
598 
599 user_id = "user_01AbCdEfGhIjKlMnOpQrSt"
600 removed_user = client.organization.users.remove(user_id)
601 
602 puts "id: #{removed_user.id}"
603 ```
604</CodeGroup>
169605 
170606```json
171607{
from line 616
180616 
181617`POST /v1/organizations/invites` sends an invitation email and returns the invite with a server-assigned `expires_at`. `role` must be `user` or `managed`. If a pending invite already exists for the email address, or the address already belongs to a member, the request returns 400 naming the existing resource. Organizations whose identity provider provisions users automatically (JIT or SCIM) cannot create invites through the API. Requires the `write:members` scope, plus `write:rbac_groups` when `role` is `managed`.
182618 
183On plans that draw members from a finite seat pool, the invite automatically takes a seat from the lowest tier that has availability; the API does not take a tier parameter. If no seat is free, the request fails with a 400 error rather than purchasing a seat. Add seats through the organization's plan management and retry.
619On plans that draw members from a finite seat pool, the invite automatically takes a seat from the lowest tier that has availability. The API does not take a tier parameter. If no seat is free, the request fails with a 400 error rather than purchasing a seat. Add seats through the organization's plan management and retry.
184620 
185621The optional `rbac_group_ids` field lists groups (by `rbac_group_`-prefixed ID) to assign to the member when they accept. Passing a non-empty `rbac_group_ids` additionally requires the key to carry the `write:rbac_groups` scope, because group assignment can grant the permissions attached to the group's roles.
186622 
187623For complete parameter details and response schemas, see [Create invite](https://platform.claude.com/docs/en/api/organization/invites/create) in the API reference.
188624 
189```bash cURL
190curl -X POST "https://api.anthropic.com/v1/organizations/invites" \
191 -H "content-type: application/json" \
192 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
193 -H "anthropic-version: 2023-06-01" \
194 -d '{
195 "email": "[email protected]",
196 "role": "managed",
197 "rbac_group_ids": ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
198 }'
199```
625<CodeGroup>
626 ```bash cURL
627 curl -X POST "https://api.anthropic.com/v1/organizations/invites" \
628 -H "content-type: application/json" \
629 -H "x-api-key: $ANTHROPIC_API_KEY" \
630 -H "anthropic-version: 2023-06-01" \
631 -d '{
632 "email": "[email protected]",
633 "role": "managed",
634 "rbac_group_ids": ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
635 }'
636 ```
637 
638 ```bash CLI
639 ant organization:invites create \
640 --email [email protected] \
641 --role managed \
642 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn
643 ```
644 
645 ```python Python
646 client = anthropic.Anthropic()
647 
648 invite = client.organization.invites.create(
649 email="[email protected]",
650 role="managed",
651 rbac_group_ids=["rbac_group_01UvWxYzAbCdEfGhIjKlMn"],
652 )
653 
654 print(f"id: {invite.id}")
655 print(f"email: {invite.email}")
656 print(f"status: {invite.status}")
657 print(f"expires_at: {invite.expires_at}")
658 ```
659 
660 ```typescript TypeScript
661 const client = new Anthropic();
662 
663 const invite = await client.organization.invites.create({
664 email: "[email protected]",
665 role: "managed",
666 rbac_group_ids: ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
667 });
668 
669 console.log(`id: ${invite.id}`);
670 console.log(`email: ${invite.email}`);
671 console.log(`status: ${invite.status}`);
672 console.log(`expires_at: ${invite.expires_at}`);
673 ```
674 
675 ```csharp C#
676 using Anthropic.Models.Organization.Invites;
677 // ...
678 
679 AnthropicClient client = new();
680 
681 var invite = await client.Organization.Invites.Create(new()
682 {
683 Email = "[email protected]",
684 Role = Role.Managed,
685 RbacGroupIds = ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
686 });
687 
688 Console.WriteLine($"id: {invite.ID}");
689 Console.WriteLine($"email: {invite.Email}");
690 Console.WriteLine($"status: {invite.Status.Raw()}");
691 Console.WriteLine($"expires_at: {invite.ExpiresAt:O}");
692 ```
693 
694 ```go Go
695 client := anthropic.NewClient()
696 
697 invite, err := client.Organization.Invites.New(context.Background(), anthropic.OrganizationInviteNewParams{
698 Email: "[email protected]",
699 Role: anthropic.OrganizationInviteNewParamsRoleManaged,
700 RBACGroupIDs: []string{"rbac_group_01UvWxYzAbCdEfGhIjKlMn"},
701 })
702 if err != nil {
703 log.Fatal(err)
704 }
705 
706 fmt.Printf("id: %s\n", invite.ID)
707 fmt.Printf("email: %s\n", invite.Email)
708 fmt.Printf("status: %s\n", invite.Status)
709 fmt.Printf("expires_at: %s\n", invite.ExpiresAt.Format(time.RFC3339))
710 ```
711 
712 ```java Java
713 import com.anthropic.models.organization.invites.InviteCreateParams;
714 
715 void main() {
716 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
717 
718 var params = InviteCreateParams.builder()
719 .email("[email protected]")
720 .role(InviteCreateParams.Role.MANAGED)
721 .addRbacGroupId("rbac_group_01UvWxYzAbCdEfGhIjKlMn")
722 .build();
723 var invite = client.organization().invites().create(params);
724 
725 IO.println("id: " + invite.id());
726 IO.println("email: " + invite.email());
727 IO.println("status: " + invite.status().asString());
728 IO.println("expires_at: " + invite.expiresAt());
729 }
730 ```
731 
732 ```php PHP
733 use Anthropic\Organization\Invites\InviteCreateParams\Role;
734 // ...
735 
736 $client = new Client();
737 
738 $invite = $client->organization->invites->create(
739 email: '[email protected]',
740 role: Role::MANAGED,
741 rbacGroupIDs: ['rbac_group_01UvWxYzAbCdEfGhIjKlMn'],
742 );
743 
744 echo "id: {$invite->id}\n";
745 echo "email: {$invite->email}\n";
746 echo "status: {$invite->status}\n";
747 echo "expires_at: {$invite->expiresAt->format(DATE_ATOM)}\n";
748 ```
749 
750 ```ruby Ruby
751 client = Anthropic::Client.new
752 
753 invite = client.organization.invites.create(
754 email: "[email protected]",
755 role: :managed,
756 rbac_group_ids: ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
757 )
758 
759 puts "id: #{invite.id}"
760 puts "email: #{invite.email}"
761 puts "status: #{invite.status}"
762 puts "expires_at: #{invite.expires_at.iso8601}"
763 ```
764</CodeGroup>
200765 
201766```json
202767{
from line 783
218783 
219784For complete parameter details and response schemas, see [List invites](https://platform.claude.com/docs/en/api/organization/invites/list) in the API reference.
220785 
221```bash cURL
222curl "https://api.anthropic.com/v1/organizations/invites?limit=20" \
223 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
224 -H "anthropic-version: 2023-06-01"
225```
786<CodeGroup>
787 ```bash cURL
788 curl "https://api.anthropic.com/v1/organizations/invites?limit=20" \
789 -H "x-api-key: $ANTHROPIC_API_KEY" \
790 -H "anthropic-version: 2023-06-01"
791 ```
792 
793 ```bash CLI
794 ant organization:invites list --limit 20
795 ```
796 
797 ```python Python
798 client = anthropic.Anthropic()
799 
800 invites = client.organization.invites.list(limit=20)
801 
802 for invite in invites:
803 print(f"{invite.id}: {invite.email} ({invite.status})")
804 ```
805 
806 ```typescript TypeScript
807 const client = new Anthropic();
808 
809 const invites = await client.organization.invites.list({ limit: 20 });
810 
811 for await (const invite of invites) {
812 console.log(`${invite.id}: ${invite.email} (${invite.status})`);
813 }
814 ```
815 
816 ```csharp C#
817 AnthropicClient client = new();
818 
819 var page = await client.Organization.Invites.List(new() { Limit = 20 });
820 
821 await foreach (var invite in page.Paginate())
822 {
823 Console.WriteLine($"{invite.ID}: {invite.Email} ({invite.Status.Raw()})");
824 }
825 ```
826 
827 ```go Go
828 client := anthropic.NewClient()
829 
830 invites := client.Organization.Invites.ListAutoPaging(context.Background(), anthropic.OrganizationInviteListParams{
831 Limit: anthropic.Int(20),
832 })
833 
834 for invites.Next() {
835 invite := invites.Current()
836 fmt.Printf("%s: %s (%s)\n", invite.ID, invite.Email, invite.Status)
837 }
838 if err := invites.Err(); err != nil {
839 log.Fatal(err)
840 }
841 ```
842 
843 ```java Java
844 import com.anthropic.models.organization.invites.InviteListParams;
845 
846 void main() {
847 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
848 
849 var params = InviteListParams.builder()
850 .limit(20)
851 .build();
852 var invites = client.organization().invites().list(params);
853 
854 for (var invite : invites.autoPager()) {
855 IO.println(invite.id() + ": " + invite.email() + " (" + invite.status().asString() + ")");
856 }
857 }
858 ```
859 
860 ```php PHP
861 $client = new Client();
862 
863 $invites = $client->organization->invites->list(limit: 20);
864 
865 foreach ($invites->pagingEachItem() as $invite) {
866 echo "{$invite->id}: {$invite->email} ({$invite->status})\n";
867 }
868 ```
869 
870 ```ruby Ruby
871 client = Anthropic::Client.new
872 
873 invites = client.organization.invites.list(limit: 20)
874 
875 invites.auto_paging_each do |invite|
876 puts "#{invite.id}: #{invite.email} (#{invite.status})"
877 end
878 ```
879</CodeGroup>
226880 
227881### Get an invite
228882 
from line 884
230884 
231885For complete parameter details and response schemas, see [Get invite](https://platform.claude.com/docs/en/api/organization/invites/retrieve) in the API reference.
232886 
233```bash cURL
234curl "https://api.anthropic.com/v1/organizations/invites/invite_01QrStUvWxYzAbCdEfGhIj" \
235 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
236 -H "anthropic-version: 2023-06-01"
237```
887<CodeGroup>
888 ```bash cURL
889 curl "https://api.anthropic.com/v1/organizations/invites/invite_01QrStUvWxYzAbCdEfGhIj" \
890 -H "x-api-key: $ANTHROPIC_API_KEY" \
891 -H "anthropic-version: 2023-06-01"
892 ```
893 
894 ```bash CLI
895 ant organization:invites retrieve --invite-id invite_01QrStUvWxYzAbCdEfGhIj
896 ```
897 
898 ```python Python
899 client = anthropic.Anthropic()
900 
901 invite = client.organization.invites.retrieve("invite_01QrStUvWxYzAbCdEfGhIj")
902 
903 print(f"id: {invite.id}")
904 print(f"email: {invite.email}")
905 print(f"status: {invite.status}")
906 ```
907 
908 ```typescript TypeScript
909 const client = new Anthropic();
910 
911 const invite = await client.organization.invites.retrieve("invite_01QrStUvWxYzAbCdEfGhIj");
912 
913 console.log(`id: ${invite.id}`);
914 console.log(`email: ${invite.email}`);
915 console.log(`status: ${invite.status}`);
916 ```
917 
918 ```csharp C#
919 AnthropicClient client = new();
920 
921 var invite = await client.Organization.Invites.Retrieve("invite_01QrStUvWxYzAbCdEfGhIj");
922 
923 Console.WriteLine($"id: {invite.ID}");
924 Console.WriteLine($"email: {invite.Email}");
925 Console.WriteLine($"status: {invite.Status.Raw()}");
926 ```
927 
928 ```go Go
929 client := anthropic.NewClient()
930 
931 invite, err := client.Organization.Invites.Get(context.Background(), "invite_01QrStUvWxYzAbCdEfGhIj")
932 if err != nil {
933 log.Fatal(err)
934 }
935 
936 fmt.Printf("id: %s\n", invite.ID)
937 fmt.Printf("email: %s\n", invite.Email)
938 fmt.Printf("status: %s\n", invite.Status)
939 ```
940 
941 ```java Java
942 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
943 
944 var invite = client.organization().invites()
945 .retrieve("invite_01QrStUvWxYzAbCdEfGhIj");
946 
947 IO.println("id: " + invite.id());
948 IO.println("email: " + invite.email());
949 IO.println("status: " + invite.status().asString());
950 ```
951 
952 ```php PHP
953 $client = new Client();
954 
955 $invite = $client->organization->invites->retrieve(
956 inviteID: 'invite_01QrStUvWxYzAbCdEfGhIj',
957 );
958 
959 echo "id: {$invite->id}\n";
960 echo "email: {$invite->email}\n";
961 echo "status: {$invite->status}\n";
962 ```
963 
964 ```ruby Ruby
965 client = Anthropic::Client.new
966 
967 invite = client.organization.invites.retrieve("invite_01QrStUvWxYzAbCdEfGhIj")
968 
969 puts "id: #{invite.id}"
970 puts "email: #{invite.email}"
971 puts "status: #{invite.status}"
972 ```
973</CodeGroup>
238974 
239975### Withdraw an invite
240976 
from line 978
242978 
243979For complete parameter details and response schemas, see [Delete invite](https://platform.claude.com/docs/en/api/organization/invites/delete) in the API reference.
244980 
245```bash cURL
246curl -X DELETE "https://api.anthropic.com/v1/organizations/invites/invite_01QrStUvWxYzAbCdEfGhIj" \
247 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
248 -H "anthropic-version: 2023-06-01"
249```
981<CodeGroup>
982 ```bash cURL
983 curl -X DELETE "https://api.anthropic.com/v1/organizations/invites/invite_01QrStUvWxYzAbCdEfGhIj" \
984 -H "x-api-key: $ANTHROPIC_API_KEY" \
985 -H "anthropic-version: 2023-06-01"
986 ```
987 
988 ```bash CLI
989 ant organization:invites delete --invite-id invite_01QrStUvWxYzAbCdEfGhIj
990 ```
991 
992 ```python Python
993 client = anthropic.Anthropic()
994 
995 deleted_invite = client.organization.invites.delete("invite_01QrStUvWxYzAbCdEfGhIj")
996 
997 print(f"id: {deleted_invite.id}")
998 ```
999 
1000 ```typescript TypeScript
1001 const client = new Anthropic();
1002 
1003 const deletedInvite = await client.organization.invites.delete(
1004 "invite_01QrStUvWxYzAbCdEfGhIj"
1005 );
1006 
1007 console.log(`id: ${deletedInvite.id}`);
1008 ```
1009 
1010 ```csharp C#
1011 AnthropicClient client = new();
1012 
1013 var deletedInvite = await client.Organization.Invites.Delete("invite_01QrStUvWxYzAbCdEfGhIj");
1014 
1015 Console.WriteLine($"id: {deletedInvite.ID}");
1016 ```
1017 
1018 ```go Go
1019 client := anthropic.NewClient()
1020 
1021 deletedInvite, err := client.Organization.Invites.Delete(context.Background(), "invite_01QrStUvWxYzAbCdEfGhIj")
1022 if err != nil {
1023 log.Fatal(err)
1024 }
1025 
1026 fmt.Printf("id: %s\n", deletedInvite.ID)
1027 ```
1028 
1029 ```java Java
1030 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1031 
1032 var deletedInvite = client.organization().invites()
1033 .delete("invite_01QrStUvWxYzAbCdEfGhIj");
1034 
1035 IO.println("id: " + deletedInvite.id());
1036 ```
1037 
1038 ```php PHP
1039 $client = new Client();
1040 
1041 $deletedInvite = $client->organization->invites->delete(
1042 inviteID: 'invite_01QrStUvWxYzAbCdEfGhIj',
1043 );
1044 
1045 echo "id: {$deletedInvite->id}\n";
1046 ```
1047 
1048 ```ruby Ruby
1049 client = Anthropic::Client.new
1050 
1051 invite_id = "invite_01QrStUvWxYzAbCdEfGhIj"
1052 deleted_invite = client.organization.invites.delete(invite_id)
1053 
1054 puts "id: #{deleted_invite.id}"
1055 ```
1056</CodeGroup>
2501057 
2511058## Groups
2521059 
from line 1065
2581065 
2591066For complete parameter details and response schemas, see [List groups](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/list) in the API reference.
2601067 
261```bash cURL
262curl "https://api.anthropic.com/v1/organizations/rbac_groups?limit=20" \
263 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
264 -H "anthropic-version: 2023-06-01"
265```
1068<CodeGroup>
1069 ```bash cURL
1070 curl "https://api.anthropic.com/v1/organizations/rbac_groups?limit=20" \
1071 -H "x-api-key: $ANTHROPIC_API_KEY" \
1072 -H "anthropic-version: 2023-06-01"
1073 ```
1074 
1075 ```bash CLI
1076 ant beta:organization:rbac-groups list --limit 20
1077 ```
1078 
1079 ```python Python
1080 client = anthropic.Anthropic()
1081 
1082 groups = client.beta.organization.rbac_groups.list(limit=20)
1083 
1084 for group in groups:
1085 print(f"{group.id}: {group.name} ({group.source_type})")
1086 ```
1087 
1088 ```typescript TypeScript
1089 const client = new Anthropic();
1090 
1091 const groups = await client.beta.organization.rbacGroups.list({ limit: 20 });
1092 
1093 for await (const group of groups) {
1094 console.log(`${group.id}: ${group.name} (${group.source_type})`);
1095 }
1096 ```
1097 
1098 ```csharp C#
1099 AnthropicClient client = new();
1100 
1101 var page = await client.Beta.Organization.RbacGroups.List(new() { Limit = 20 });
1102 
1103 await foreach (var group in page.Paginate())
1104 {
1105 Console.WriteLine($"{group.ID}: {group.Name} ({group.SourceType.Raw()})");
1106 }
1107 ```
1108 
1109 ```go Go
1110 client := anthropic.NewClient()
1111 
1112 groups := client.Beta.Organization.RBACGroups.ListAutoPaging(context.Background(), anthropic.BetaOrganizationRBACGroupListParams{
1113 Limit: anthropic.Int(20),
1114 })
1115 
1116 for groups.Next() {
1117 group := groups.Current()
1118 fmt.Printf("%s: %s (%s)\n", group.ID, group.Name, group.SourceType)
1119 }
1120 if err := groups.Err(); err != nil {
1121 log.Fatal(err)
1122 }
1123 ```
1124 
1125 ```java Java
1126 import com.anthropic.models.beta.organization.rbacgroups.RbacGroupListParams;
1127 
1128 void main() {
1129 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1130 
1131 var params = RbacGroupListParams.builder()
1132 .limit(20)
1133 .build();
1134 var groups = client.beta().organization().rbacGroups().list(params);
1135 
1136 for (var group : groups.autoPager()) {
1137 IO.println(group.id() + ": " + group.name() + " (" + group.sourceType().asString() + ")");
1138 }
1139 }
1140 ```
1141 
1142 ```php PHP
1143 $client = new Client();
1144 
1145 $groups = $client->beta->organization->rbacGroups->list(limit: 20);
1146 
1147 foreach ($groups->pagingEachItem() as $group) {
1148 echo "{$group->id}: {$group->name} ({$group->sourceType})\n";
1149 }
1150 ```
1151 
1152 ```ruby Ruby
1153 client = Anthropic::Client.new
1154 
1155 groups = client.beta.organization.rbac_groups.list(limit: 20)
1156 
1157 groups.auto_paging_each do |group|
1158 puts "#{group.id}: #{group.name} (#{group.source_type})"
1159 end
1160 ```
1161</CodeGroup>
2661162 
2671163```json
2681164{
from line 1185
2891185 
2901186For complete parameter details and response schemas, see [Get group](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/retrieve) in the API reference.
2911187 
292```bash cURL
293curl "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
294 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
295 -H "anthropic-version: 2023-06-01"
296```
1188<CodeGroup>
1189 ```bash cURL
1190 curl "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
1191 -H "x-api-key: $ANTHROPIC_API_KEY" \
1192 -H "anthropic-version: 2023-06-01"
1193 ```
1194 
1195 ```bash CLI
1196 ant beta:organization:rbac-groups retrieve \
1197 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn
1198 ```
1199 
1200 ```python Python
1201 client = anthropic.Anthropic()
1202 
1203 group = client.beta.organization.rbac_groups.retrieve(
1204 "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1205 )
1206 
1207 print(f"id: {group.id}")
1208 print(f"name: {group.name}")
1209 print(f"source_type: {group.source_type}")
1210 ```
1211 
1212 ```typescript TypeScript
1213 const client = new Anthropic();
1214 
1215 const group = await client.beta.organization.rbacGroups.retrieve(
1216 "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1217 );
1218 
1219 console.log(`id: ${group.id}`);
1220 console.log(`name: ${group.name}`);
1221 console.log(`source_type: ${group.source_type}`);
1222 ```
1223 
1224 ```csharp C#
1225 AnthropicClient client = new();
1226 
1227 var group = await client.Beta.Organization.RbacGroups.Retrieve("rbac_group_01UvWxYzAbCdEfGhIjKlMn");
1228 
1229 Console.WriteLine($"id: {group.ID}");
1230 Console.WriteLine($"name: {group.Name}");
1231 Console.WriteLine($"source_type: {group.SourceType.Raw()}");
1232 ```
1233 
1234 ```go Go
1235 client := anthropic.NewClient()
1236 
1237 group, err := client.Beta.Organization.RBACGroups.Get(context.Background(), "rbac_group_01UvWxYzAbCdEfGhIjKlMn")
1238 if err != nil {
1239 log.Fatal(err)
1240 }
1241 
1242 fmt.Printf("id: %s\n", group.ID)
1243 fmt.Printf("name: %s\n", group.Name)
1244 fmt.Printf("source_type: %s\n", group.SourceType)
1245 ```
1246 
1247 ```java Java
1248 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1249 
1250 var group = client.beta().organization().rbacGroups()
1251 .retrieve("rbac_group_01UvWxYzAbCdEfGhIjKlMn");
1252 
1253 IO.println("id: " + group.id());
1254 IO.println("name: " + group.name());
1255 IO.println("source_type: " + group.sourceType().asString());
1256 ```
1257 
1258 ```php PHP
1259 $client = new Client();
1260 
1261 $group = $client->beta->organization->rbacGroups->retrieve(
1262 rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
1263 );
1264 
1265 echo "id: {$group->id}\n";
1266 echo "name: {$group->name}\n";
1267 echo "source_type: {$group->sourceType}\n";
1268 ```
1269 
1270 ```ruby Ruby
1271 client = Anthropic::Client.new
1272 
1273 rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1274 group = client.beta.organization.rbac_groups.retrieve(rbac_group_id)
1275 
1276 puts "id: #{group.id}"
1277 puts "name: #{group.name}"
1278 puts "source_type: #{group.source_type}"
1279 ```
1280</CodeGroup>
2971281 
2981282### Create a group
2991283 
from line 1285
3011285 
3021286For complete parameter details and response schemas, see [Create group](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/create) in the API reference.
3031287 
304```bash cURL
305curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups" \
306 -H "content-type: application/json" \
307 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
308 -H "anthropic-version: 2023-06-01" \
309 -d '{"name": "Engineering"}'
310```
1288<CodeGroup>
1289 ```bash cURL
1290 curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups" \
1291 -H "content-type: application/json" \
1292 -H "x-api-key: $ANTHROPIC_API_KEY" \
1293 -H "anthropic-version: 2023-06-01" \
1294 -d '{"name": "Engineering"}'
1295 ```
1296 
1297 ```bash CLI
1298 ant beta:organization:rbac-groups create --name Engineering
1299 ```
1300 
1301 ```python Python
1302 client = anthropic.Anthropic()
1303 
1304 group = client.beta.organization.rbac_groups.create(name="Engineering")
1305 
1306 print(f"id: {group.id}")
1307 print(f"name: {group.name}")
1308 ```
1309 
1310 ```typescript TypeScript
1311 const client = new Anthropic();
1312 
1313 const group = await client.beta.organization.rbacGroups.create({ name: "Engineering" });
1314 
1315 console.log(`id: ${group.id}`);
1316 console.log(`name: ${group.name}`);
1317 ```
1318 
1319 ```csharp C#
1320 AnthropicClient client = new();
1321 
1322 var group = await client.Beta.Organization.RbacGroups.Create(new()
1323 {
1324 Name = "Engineering"
1325 });
1326 
1327 Console.WriteLine($"id: {group.ID}");
1328 Console.WriteLine($"name: {group.Name}");
1329 ```
1330 
1331 ```go Go
1332 client := anthropic.NewClient()
1333 
1334 group, err := client.Beta.Organization.RBACGroups.New(context.Background(), anthropic.BetaOrganizationRBACGroupNewParams{
1335 Name: "Engineering",
1336 })
1337 if err != nil {
1338 log.Fatal(err)
1339 }
1340 
1341 fmt.Printf("id: %s\n", group.ID)
1342 fmt.Printf("name: %s\n", group.Name)
1343 ```
1344 
1345 ```java Java
1346 import com.anthropic.models.beta.organization.rbacgroups.RbacGroupCreateParams;
1347 
1348 void main() {
1349 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1350 
1351 var params = RbacGroupCreateParams.builder()
1352 .name("Engineering")
1353 .build();
1354 var group = client.beta().organization().rbacGroups().create(params);
1355 
1356 IO.println("id: " + group.id());
1357 IO.println("name: " + group.name());
1358 }
1359 ```
1360 
1361 ```php PHP
1362 $client = new Client();
1363 
1364 $group = $client->beta->organization->rbacGroups->create(
1365 name: 'Engineering',
1366 );
1367 
1368 echo "id: {$group->id}\n";
1369 echo "name: {$group->name}\n";
1370 ```
1371 
1372 ```ruby Ruby
1373 client = Anthropic::Client.new
1374 
1375 group = client.beta.organization.rbac_groups.create(name: "Engineering")
1376 
1377 puts "id: #{group.id}"
1378 puts "name: #{group.name}"
1379 ```
1380</CodeGroup>
3111381 
3121382```json
3131383{
from line 1398
3281398 
3291399For complete parameter details and response schemas, see [Update group](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/update) in the API reference.
3301400 
331```bash cURL
332curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
333 -H "content-type: application/json" \
334 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
335 -H "anthropic-version: 2023-06-01" \
336 -d '{"name": "Platform Engineering"}'
337```
1401<CodeGroup>
1402 ```bash cURL
1403 curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
1404 -H "content-type: application/json" \
1405 -H "x-api-key: $ANTHROPIC_API_KEY" \
1406 -H "anthropic-version: 2023-06-01" \
1407 -d '{"name": "Platform Engineering"}'
1408 ```
1409 
1410 ```bash CLI
1411 ant beta:organization:rbac-groups update \
1412 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
1413 --name "Platform Engineering"
1414 ```
1415 
1416 ```python Python
1417 client = anthropic.Anthropic()
1418 
1419 group = client.beta.organization.rbac_groups.update(
1420 "rbac_group_01UvWxYzAbCdEfGhIjKlMn", name="Platform Engineering"
1421 )
1422 
1423 print(f"id: {group.id}")
1424 print(f"name: {group.name}")
1425 ```
1426 
1427 ```typescript TypeScript
1428 const client = new Anthropic();
1429 
1430 const group = await client.beta.organization.rbacGroups.update(
1431 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1432 { name: "Platform Engineering" }
1433 );
1434 
1435 console.log(`id: ${group.id}`);
1436 console.log(`name: ${group.name}`);
1437 ```
1438 
1439 ```csharp C#
1440 AnthropicClient client = new();
1441 
1442 var group = await client.Beta.Organization.RbacGroups.Update(
1443 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1444 new() { Name = "Platform Engineering" }
1445 );
1446 
1447 Console.WriteLine($"id: {group.ID}");
1448 Console.WriteLine($"name: {group.Name}");
1449 ```
1450 
1451 ```go Go
1452 client := anthropic.NewClient()
1453 
1454 group, err := client.Beta.Organization.RBACGroups.Update(
1455 context.Background(),
1456 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1457 anthropic.BetaOrganizationRBACGroupUpdateParams{
1458 Name: anthropic.String("Platform Engineering"),
1459 },
1460 )
1461 if err != nil {
1462 log.Fatal(err)
1463 }
1464 
1465 fmt.Printf("id: %s\n", group.ID)
1466 fmt.Printf("name: %s\n", group.Name)
1467 ```
1468 
1469 ```java Java
1470 import com.anthropic.models.beta.organization.rbacgroups.RbacGroupUpdateParams;
1471 
1472 void main() {
1473 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1474 
1475 var params = RbacGroupUpdateParams.builder()
1476 .name("Platform Engineering")
1477 .build();
1478 var group = client.beta().organization().rbacGroups()
1479 .update("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);
1480 
1481 IO.println("id: " + group.id());
1482 IO.println("name: " + group.name());
1483 }
1484 ```
1485 
1486 ```php PHP
1487 $client = new Client();
1488 
1489 $group = $client->beta->organization->rbacGroups->update(
1490 rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
1491 name: 'Platform Engineering',
1492 );
1493 
1494 echo "id: {$group->id}\n";
1495 echo "name: {$group->name}\n";
1496 ```
1497 
1498 ```ruby Ruby
1499 client = Anthropic::Client.new
1500 
1501 rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1502 group = client.beta.organization.rbac_groups.update(rbac_group_id, name: "Platform Engineering")
1503 
1504 puts "id: #{group.id}"
1505 puts "name: #{group.name}"
1506 ```
1507</CodeGroup>
3381508 
3391509### Delete a group
3401510 
from line 1512
3421512 
3431513For complete parameter details and response schemas, see [Delete group](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/delete) in the API reference.
3441514 
345```bash cURL
346curl -X DELETE "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
347 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
348 -H "anthropic-version: 2023-06-01"
349```
1515<CodeGroup>
1516 ```bash cURL
1517 curl -X DELETE "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
1518 -H "x-api-key: $ANTHROPIC_API_KEY" \
1519 -H "anthropic-version: 2023-06-01"
1520 ```
1521 
1522 ```bash CLI
1523 ant beta:organization:rbac-groups delete \
1524 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn
1525 ```
1526 
1527 ```python Python
1528 client = anthropic.Anthropic()
1529 
1530 deleted_group = client.beta.organization.rbac_groups.delete(
1531 "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1532 )
1533 
1534 print(f"id: {deleted_group.id}")
1535 ```
1536 
1537 ```typescript TypeScript
1538 const client = new Anthropic();
1539 
1540 const deletedGroup = await client.beta.organization.rbacGroups.delete(
1541 "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1542 );
1543 
1544 console.log(`id: ${deletedGroup.id}`);
1545 ```
1546 
1547 ```csharp C#
1548 AnthropicClient client = new();
1549 
1550 var deletedGroup = await client.Beta.Organization.RbacGroups.Delete(
1551 "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1552 );
1553 
1554 Console.WriteLine($"id: {deletedGroup.ID}");
1555 ```
1556 
1557 ```go Go
1558 client := anthropic.NewClient()
1559 
1560 deletedGroup, err := client.Beta.Organization.RBACGroups.Delete(context.Background(), "rbac_group_01UvWxYzAbCdEfGhIjKlMn")
1561 if err != nil {
1562 log.Fatal(err)
1563 }
1564 
1565 fmt.Printf("id: %s\n", deletedGroup.ID)
1566 ```
1567 
1568 ```java Java
1569 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1570 
1571 var deletedGroup = client.beta().organization().rbacGroups()
1572 .delete("rbac_group_01UvWxYzAbCdEfGhIjKlMn");
1573 
1574 IO.println("id: " + deletedGroup.id());
1575 ```
1576 
1577 ```php PHP
1578 $client = new Client();
1579 
1580 $deletedGroup = $client->beta->organization->rbacGroups->delete(
1581 rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
1582 );
1583 
1584 echo "id: {$deletedGroup->id}\n";
1585 ```
1586 
1587 ```ruby Ruby
1588 client = Anthropic::Client.new
1589 
1590 rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1591 deleted_group = client.beta.organization.rbac_groups.delete(rbac_group_id)
1592 
1593 puts "id: #{deleted_group.id}"
1594 ```
1595</CodeGroup>
3501596 
3511597```json
3521598{
from line 1607
3611607 
3621608For complete parameter details and response schemas, see [List group members](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/members/list) in the API reference.
3631609 
364```bash cURL
365curl "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members?limit=100" \
366 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
367 -H "anthropic-version: 2023-06-01"
368```
1610<CodeGroup>
1611 ```bash cURL
1612 curl "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members?limit=100" \
1613 -H "x-api-key: $ANTHROPIC_API_KEY" \
1614 -H "anthropic-version: 2023-06-01"
1615 ```
1616 
1617 ```bash CLI
1618 ant beta:organization:rbac-groups:members list \
1619 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
1620 --limit 100
1621 ```
1622 
1623 ```python Python
1624 client = anthropic.Anthropic()
1625 
1626 members = client.beta.organization.rbac_groups.members.list(
1627 "rbac_group_01UvWxYzAbCdEfGhIjKlMn", limit=100
1628 )
1629 
1630 for member in members:
1631 print(f"{member.user_id}: {member.email}")
1632 ```
1633 
1634 ```typescript TypeScript
1635 const client = new Anthropic();
1636 
1637 const members = await client.beta.organization.rbacGroups.members.list(
1638 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1639 { limit: 100 }
1640 );
1641 
1642 for await (const member of members) {
1643 console.log(`${member.user_id}: ${member.email}`);
1644 }
1645 ```
1646 
1647 ```csharp C#
1648 AnthropicClient client = new();
1649 
1650 var page = await client.Beta.Organization.RbacGroups.Members.List(
1651 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1652 new() { Limit = 100 }
1653 );
1654 
1655 await foreach (var member in page.Paginate())
1656 {
1657 Console.WriteLine($"{member.UserID}: {member.Email}");
1658 }
1659 ```
1660 
1661 ```go Go
1662 client := anthropic.NewClient()
1663 
1664 members := client.Beta.Organization.RBACGroups.Members.ListAutoPaging(
1665 context.Background(),
1666 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1667 anthropic.BetaOrganizationRBACGroupMemberListParams{
1668 Limit: anthropic.Int(100),
1669 },
1670 )
1671 
1672 for members.Next() {
1673 member := members.Current()
1674 fmt.Printf("%s: %s\n", member.UserID, member.Email)
1675 }
1676 if err := members.Err(); err != nil {
1677 log.Fatal(err)
1678 }
1679 ```
1680 
1681 ```java Java
1682 import com.anthropic.models.beta.organization.rbacgroups.members.MemberListParams;
1683 
1684 void main() {
1685 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1686 
1687 var params = MemberListParams.builder()
1688 .limit(100)
1689 .build();
1690 var members = client.beta().organization().rbacGroups().members()
1691 .list("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);
1692 
1693 for (var member : members.autoPager()) {
1694 IO.println(member.userId() + ": " + member.email());
1695 }
1696 }
1697 ```
1698 
1699 ```php PHP
1700 $client = new Client();
1701 
1702 $members = $client->beta->organization->rbacGroups->members->list(
1703 rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
1704 limit: 100,
1705 );
1706 
1707 foreach ($members->pagingEachItem() as $member) {
1708 echo "{$member->userID}: {$member->email}\n";
1709 }
1710 ```
1711 
1712 ```ruby Ruby
1713 client = Anthropic::Client.new
1714 
1715 rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1716 members = client.beta.organization.rbac_groups.members.list(rbac_group_id, limit: 100)
1717 
1718 members.auto_paging_each do |member|
1719 puts "#{member.user_id}: #{member.email}"
1720 end
1721 ```
1722</CodeGroup>
3691723 
3701724```json
3711725{
from line 1744
3901744 
3911745For complete parameter details and response schemas, see [Add group member](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/members/add) in the API reference.
3921746 
393```bash cURL
394curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members" \
395 -H "content-type: application/json" \
396 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
397 -H "anthropic-version: 2023-06-01" \
398 -d '{"user_id": "user_01AbCdEfGhIjKlMnOpQrSt"}'
399```
1747<CodeGroup>
1748 ```bash cURL
1749 curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members" \
1750 -H "content-type: application/json" \
1751 -H "x-api-key: $ANTHROPIC_API_KEY" \
1752 -H "anthropic-version: 2023-06-01" \
1753 -d '{"user_id": "user_01AbCdEfGhIjKlMnOpQrSt"}'
1754 ```
1755 
1756 ```bash CLI
1757 ant beta:organization:rbac-groups:members add \
1758 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
1759 --user-id user_01AbCdEfGhIjKlMnOpQrSt
1760 ```
1761 
1762 ```python Python
1763 client = anthropic.Anthropic()
1764 
1765 member = client.beta.organization.rbac_groups.members.add(
1766 "rbac_group_01UvWxYzAbCdEfGhIjKlMn", user_id="user_01AbCdEfGhIjKlMnOpQrSt"
1767 )
1768 
1769 print(f"user_id: {member.user_id}")
1770 print(f"email: {member.email}")
1771 ```
1772 
1773 ```typescript TypeScript
1774 const client = new Anthropic();
1775 
1776 const member = await client.beta.organization.rbacGroups.members.add(
1777 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1778 { user_id: "user_01AbCdEfGhIjKlMnOpQrSt" }
1779 );
1780 
1781 console.log(`user_id: ${member.user_id}`);
1782 console.log(`email: ${member.email}`);
1783 ```
1784 
1785 ```csharp C#
1786 AnthropicClient client = new();
1787 
1788 var member = await client.Beta.Organization.RbacGroups.Members.Add(
1789 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1790 new() { UserID = "user_01AbCdEfGhIjKlMnOpQrSt" }
1791 );
1792 
1793 Console.WriteLine($"user_id: {member.UserID}");
1794 Console.WriteLine($"email: {member.Email}");
1795 ```
1796 
1797 ```go Go
1798 client := anthropic.NewClient()
1799 
1800 member, err := client.Beta.Organization.RBACGroups.Members.Add(
1801 context.Background(),
1802 "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1803 anthropic.BetaOrganizationRBACGroupMemberAddParams{
1804 UserID: "user_01AbCdEfGhIjKlMnOpQrSt",
1805 },
1806 )
1807 if err != nil {
1808 log.Fatal(err)
1809 }
1810 
1811 fmt.Printf("user_id: %s\n", member.UserID)
1812 fmt.Printf("email: %s\n", member.Email)
1813 ```
1814 
1815 ```java Java
1816 import com.anthropic.models.beta.organization.rbacgroups.members.MemberAddParams;
1817 
1818 void main() {
1819 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1820 
1821 var params = MemberAddParams.builder()
1822 .userId("user_01AbCdEfGhIjKlMnOpQrSt")
1823 .build();
1824 var member = client.beta().organization().rbacGroups().members()
1825 .add("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);
1826 
1827 IO.println("user_id: " + member.userId());
1828 IO.println("email: " + member.email());
1829 }
1830 ```
1831 
1832 ```php PHP
1833 $client = new Client();
1834 
1835 $member = $client->beta->organization->rbacGroups->members->add(
1836 rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
1837 userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
1838 );
1839 
1840 echo "user_id: {$member->userID}\n";
1841 echo "email: {$member->email}\n";
1842 ```
1843 
1844 ```ruby Ruby
1845 client = Anthropic::Client.new
1846 
1847 rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1848 member = client.beta.organization.rbac_groups.members.add(
1849 rbac_group_id,
1850 user_id: "user_01AbCdEfGhIjKlMnOpQrSt"
1851 )
1852 
1853 puts "user_id: #{member.user_id}"
1854 puts "email: #{member.email}"
1855 ```
1856</CodeGroup>
4001857 
4011858```json
4021859{
from line 1872
4151872 
4161873For complete parameter details and response schemas, see [Remove group member](https://platform.claude.com/docs/en/api/beta/organization/rbac_groups/members/remove) in the API reference.
4171874 
418```bash cURL
419curl -X DELETE "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members/user_01AbCdEfGhIjKlMnOpQrSt" \
420 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
421 -H "anthropic-version: 2023-06-01"
422```
1875<CodeGroup>
1876 ```bash cURL
1877 curl -X DELETE "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members/user_01AbCdEfGhIjKlMnOpQrSt" \
1878 -H "x-api-key: $ANTHROPIC_API_KEY" \
1879 -H "anthropic-version: 2023-06-01"
1880 ```
1881 
1882 ```bash CLI
1883 ant beta:organization:rbac-groups:members remove \
1884 --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
1885 --user-id user_01AbCdEfGhIjKlMnOpQrSt
1886 ```
1887 
1888 ```python Python
1889 client = anthropic.Anthropic()
1890 
1891 removed_member = client.beta.organization.rbac_groups.members.remove(
1892 "user_01AbCdEfGhIjKlMnOpQrSt", rbac_group_id="rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1893 )
1894 
1895 print(f"user_id: {removed_member.user_id}")
1896 ```
1897 
1898 ```typescript TypeScript
1899 const client = new Anthropic();
1900 
1901 const removedMember = await client.beta.organization.rbacGroups.members.remove(
1902 "user_01AbCdEfGhIjKlMnOpQrSt",
1903 { rbac_group_id: "rbac_group_01UvWxYzAbCdEfGhIjKlMn" }
1904 );
1905 
1906 console.log(`user_id: ${removedMember.user_id}`);
1907 ```
1908 
1909 ```csharp C#
1910 AnthropicClient client = new();
1911 
1912 var removedMember = await client.Beta.Organization.RbacGroups.Members.Remove(
1913 "user_01AbCdEfGhIjKlMnOpQrSt",
1914 new() { RbacGroupID = "rbac_group_01UvWxYzAbCdEfGhIjKlMn" }
1915 );
1916 
1917 Console.WriteLine($"user_id: {removedMember.UserID}");
1918 ```
1919 
1920 ```go Go
1921 client := anthropic.NewClient()
1922 
1923 removedMember, err := client.Beta.Organization.RBACGroups.Members.Remove(
1924 context.Background(),
1925 "user_01AbCdEfGhIjKlMnOpQrSt",
1926 anthropic.BetaOrganizationRBACGroupMemberRemoveParams{
1927 RBACGroupID: "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
1928 },
1929 )
1930 if err != nil {
1931 log.Fatal(err)
1932 }
1933 
1934 fmt.Printf("user_id: %s\n", removedMember.UserID)
1935 ```
1936 
1937 ```java Java
1938 import com.anthropic.models.beta.organization.rbacgroups.members.MemberRemoveParams;
1939 
1940 void main() {
1941 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
1942 
1943 var params = MemberRemoveParams.builder()
1944 .rbacGroupId("rbac_group_01UvWxYzAbCdEfGhIjKlMn")
1945 .build();
1946 var removedMember = client.beta().organization().rbacGroups().members()
1947 .remove("user_01AbCdEfGhIjKlMnOpQrSt", params);
1948 
1949 IO.println("user_id: " + removedMember.userId());
1950 }
1951 ```
1952 
1953 ```php PHP
1954 $client = new Client();
1955 
1956 $removedMember = $client->beta->organization->rbacGroups->members->remove(
1957 userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
1958 rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
1959 );
1960 
1961 echo "user_id: {$removedMember->userID}\n";
1962 ```
1963 
1964 ```ruby Ruby
1965 client = Anthropic::Client.new
1966 
1967 rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
1968 removed_member = client.beta.organization.rbac_groups.members.remove(
1969 "user_01AbCdEfGhIjKlMnOpQrSt",
1970 rbac_group_id: rbac_group_id
1971 )
1972 
1973 puts "user_id: #{removed_member.user_id}"
1974 ```
1975</CodeGroup>
4231976 
4241977```json
4251978{
from line 1995
4421995 
4431996For complete parameter details and response schemas, see [List roles](https://platform.claude.com/docs/en/api/beta/organization/rbac_roles/list) in the API reference.
4441997 
445```bash cURL
446curl "https://api.anthropic.com/v1/organizations/rbac_roles?limit=20" \
447 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
448 -H "anthropic-version: 2023-06-01"
449```
1998<CodeGroup>
1999 ```bash cURL
2000 curl "https://api.anthropic.com/v1/organizations/rbac_roles?limit=20" \
2001 -H "x-api-key: $ANTHROPIC_API_KEY" \
2002 -H "anthropic-version: 2023-06-01"
2003 ```
2004 
2005 ```bash CLI
2006 ant beta:organization:rbac-roles list --limit 20
2007 ```
2008 
2009 ```python Python
2010 client = anthropic.Anthropic()
2011 
2012 roles = client.beta.organization.rbac_roles.list(limit=20)
2013 
2014 for role in roles:
2015 print(f"{role.id}: {role.display_name}")
2016 ```
2017 
2018 ```typescript TypeScript
2019 const client = new Anthropic();
2020 
2021 const roles = await client.beta.organization.rbacRoles.list({ limit: 20 });
2022 
2023 for await (const role of roles) {
2024 console.log(`${role.id}: ${role.display_name}`);
2025 }
2026 ```
2027 
2028 ```csharp C#
2029 AnthropicClient client = new();
2030 
2031 var page = await client.Beta.Organization.RbacRoles.List(new() { Limit = 20 });
2032 
2033 await foreach (var role in page.Paginate())
2034 {
2035 Console.WriteLine($"{role.ID}: {role.DisplayName}");
2036 }
2037 ```
2038 
2039 ```go Go
2040 client := anthropic.NewClient()
2041 
2042 roles := client.Beta.Organization.RBACRoles.ListAutoPaging(context.Background(), anthropic.BetaOrganizationRBACRoleListParams{
2043 Limit: anthropic.Int(20),
2044 })
2045 
2046 for roles.Next() {
2047 role := roles.Current()
2048 fmt.Printf("%s: %s\n", role.ID, role.DisplayName)
2049 }
2050 if err := roles.Err(); err != nil {
2051 log.Fatal(err)
2052 }
2053 ```
2054 
2055 ```java Java
2056 import com.anthropic.models.beta.organization.rbacroles.RbacRoleListParams;
2057 
2058 void main() {
2059 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
2060 
2061 var params = RbacRoleListParams.builder()
2062 .limit(20)
2063 .build();
2064 var roles = client.beta().organization().rbacRoles().list(params);
2065 
2066 for (var role : roles.autoPager()) {
2067 IO.println(role.id() + ": " + role.displayName());
2068 }
2069 }
2070 ```
2071 
2072 ```php PHP
2073 $client = new Client();
2074 
2075 $roles = $client->beta->organization->rbacRoles->list(limit: 20);
2076 
2077 foreach ($roles->pagingEachItem() as $role) {
2078 echo "{$role->id}: {$role->displayName}\n";
2079 }
2080 ```
2081 
2082 ```ruby Ruby
2083 client = Anthropic::Client.new
2084 
2085 roles = client.beta.organization.rbac_roles.list(limit: 20)
2086 
2087 roles.auto_paging_each do |role|
2088 puts "#{role.id}: #{role.display_name}"
2089 end
2090 ```
2091</CodeGroup>
4502092 
4512093```json
4522094{
from line 2113
4712113 
4722114For complete parameter details and response schemas, see [Get role](https://platform.claude.com/docs/en/api/beta/organization/rbac_roles/retrieve) in the API reference.
4732115 
474```bash cURL
475curl "https://api.anthropic.com/v1/organizations/rbac_roles/rbac_role_01CdEfGhIjKlMnOpQrStUv" \
476 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
477 -H "anthropic-version: 2023-06-01"
478```
2116<CodeGroup>
2117 ```bash cURL
2118 curl "https://api.anthropic.com/v1/organizations/rbac_roles/rbac_role_01CdEfGhIjKlMnOpQrStUv" \
2119 -H "x-api-key: $ANTHROPIC_API_KEY" \
2120 -H "anthropic-version: 2023-06-01"
2121 ```
2122 
2123 ```bash CLI
2124 ant beta:organization:rbac-roles retrieve \
2125 --rbac-role-id rbac_role_01CdEfGhIjKlMnOpQrStUv
2126 ```
2127 
2128 ```python Python
2129 client = anthropic.Anthropic()
2130 
2131 role = client.beta.organization.rbac_roles.retrieve("rbac_role_01CdEfGhIjKlMnOpQrStUv")
2132 
2133 print(f"id: {role.id}")
2134 print(f"display_name: {role.display_name}")
2135 ```
2136 
2137 ```typescript TypeScript
2138 const client = new Anthropic();
2139 
2140 const role = await client.beta.organization.rbacRoles.retrieve(
2141 "rbac_role_01CdEfGhIjKlMnOpQrStUv"
2142 );
2143 
2144 console.log(`id: ${role.id}`);
2145 console.log(`display_name: ${role.display_name}`);
2146 ```
2147 
2148 ```csharp C#
2149 AnthropicClient client = new();
2150 
2151 var role = await client.Beta.Organization.RbacRoles.Retrieve("rbac_role_01CdEfGhIjKlMnOpQrStUv");
2152 
2153 Console.WriteLine($"id: {role.ID}");
2154 Console.WriteLine($"display_name: {role.DisplayName}");
2155 ```
2156 
2157 ```go Go
2158 client := anthropic.NewClient()
2159 
2160 role, err := client.Beta.Organization.RBACRoles.Get(context.Background(), "rbac_role_01CdEfGhIjKlMnOpQrStUv")
2161 if err != nil {
2162 log.Fatal(err)
2163 }
2164 
2165 fmt.Printf("id: %s\n", role.ID)
2166 fmt.Printf("display_name: %s\n", role.DisplayName)
2167 ```
2168 
2169 ```java Java
2170 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
2171 
2172 var role = client.beta().organization().rbacRoles()
2173 .retrieve("rbac_role_01CdEfGhIjKlMnOpQrStUv");
2174 
2175 IO.println("id: " + role.id());
2176 IO.println("display_name: " + role.displayName());
2177 ```
2178 
2179 ```php PHP
2180 $client = new Client();
2181 
2182 $role = $client->beta->organization->rbacRoles->retrieve(
2183 rbacRoleID: 'rbac_role_01CdEfGhIjKlMnOpQrStUv',
2184 );
2185 
2186 echo "id: {$role->id}\n";
2187 echo "display_name: {$role->displayName}\n";
2188 ```
2189 
2190 ```ruby Ruby
2191 client = Anthropic::Client.new
2192 
2193 rbac_role_id = "rbac_role_01CdEfGhIjKlMnOpQrStUv"
2194 role = client.beta.organization.rbac_roles.retrieve(rbac_role_id)
2195 
2196 puts "id: #{role.id}"
2197 puts "display_name: #{role.display_name}"
2198 ```
2199</CodeGroup>
4792200 
4802201### List a role's permissions
4812202 
from line 2206
4852206 
4862207For complete parameter details and response schemas, see [List role permissions](https://platform.claude.com/docs/en/api/beta/organization/rbac_roles/permissions/list) in the API reference.
4872208 
488```bash cURL
489curl "https://api.anthropic.com/v1/organizations/rbac_roles/rbac_role_01CdEfGhIjKlMnOpQrStUv/permissions?limit=20" \
490 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
491 -H "anthropic-version: 2023-06-01"
492```
2209<CodeGroup>
2210 ```bash cURL
2211 curl "https://api.anthropic.com/v1/organizations/rbac_roles/rbac_role_01CdEfGhIjKlMnOpQrStUv/permissions?limit=20" \
2212 -H "x-api-key: $ANTHROPIC_API_KEY" \
2213 -H "anthropic-version: 2023-06-01"
2214 ```
2215 
2216 ```bash CLI
2217 ant beta:organization:rbac-roles:permissions list \
2218 --rbac-role-id rbac_role_01CdEfGhIjKlMnOpQrStUv \
2219 --limit 20
2220 ```
2221 
2222 ```python Python
2223 client = anthropic.Anthropic()
2224 
2225 permissions = client.beta.organization.rbac_roles.permissions.list(
2226 "rbac_role_01CdEfGhIjKlMnOpQrStUv", limit=20
2227 )
2228 
2229 for permission in permissions:
2230 print(permission.action)
2231 ```
2232 
2233 ```typescript TypeScript
2234 const client = new Anthropic();
2235 
2236 const permissions = await client.beta.organization.rbacRoles.permissions.list(
2237 "rbac_role_01CdEfGhIjKlMnOpQrStUv",
2238 { limit: 20 }
2239 );
2240 
2241 for await (const permission of permissions) {
2242 console.log(permission.action);
2243 }
2244 ```
2245 
2246 ```csharp C#
2247 AnthropicClient client = new();
2248 
2249 var page = await client.Beta.Organization.RbacRoles.Permissions.List(
2250 "rbac_role_01CdEfGhIjKlMnOpQrStUv",
2251 new() { Limit = 20 }
2252 );
2253 
2254 await foreach (var permission in page.Paginate())
2255 {
2256 Console.WriteLine(permission.Action);
2257 }
2258 ```
2259 
2260 ```go Go
2261 client := anthropic.NewClient()
2262 
2263 permissions := client.Beta.Organization.RBACRoles.Permissions.ListAutoPaging(
2264 context.Background(),
2265 "rbac_role_01CdEfGhIjKlMnOpQrStUv",
2266 anthropic.BetaOrganizationRBACRolePermissionListParams{
2267 Limit: anthropic.Int(20),
2268 },
2269 )
2270 
2271 for permissions.Next() {
2272 permission := permissions.Current()
2273 fmt.Println(permission.Action)
2274 }
2275 if err := permissions.Err(); err != nil {
2276 log.Fatal(err)
2277 }
2278 ```
2279 
2280 ```java Java
2281 import com.anthropic.models.beta.organization.rbacroles.permissions.PermissionListParams;
2282 
2283 void main() {
2284 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
2285 
2286 var params = PermissionListParams.builder()
2287 .limit(20)
2288 .build();
2289 var permissions = client.beta().organization().rbacRoles().permissions()
2290 .list("rbac_role_01CdEfGhIjKlMnOpQrStUv", params);
2291 
2292 for (var permission : permissions.autoPager()) {
2293 IO.println(permission.action());
2294 }
2295 }
2296 ```
2297 
2298 ```php PHP
2299 $client = new Client();
2300 
2301 $permissions = $client->beta->organization->rbacRoles->permissions->list(
2302 rbacRoleID: 'rbac_role_01CdEfGhIjKlMnOpQrStUv',
2303 limit: 20,
2304 );
2305 
2306 foreach ($permissions->pagingEachItem() as $permission) {
2307 echo "{$permission->action}\n";
2308 }
2309 ```
2310 
2311 ```ruby Ruby
2312 client = Anthropic::Client.new
2313 
2314 rbac_role_id = "rbac_role_01CdEfGhIjKlMnOpQrStUv"
2315 permissions = client.beta.organization.rbac_roles.permissions.list(rbac_role_id, limit: 20)
2316 
2317 permissions.auto_paging_each do |permission|
2318 puts permission.action
2319 end
2320 ```
2321</CodeGroup>
4932322 
4942323```json
4952324{
from line 2352
5232352 
52423531. Look up the member by email:
5252354 
526 ```bash cURL
527 curl "https://api.anthropic.com/v1/organizations/[email protected]" \
528 -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
529 -H "anthropic-version: 2023-06-01"
530 ```
2355 <CodeGroup>
2356 ```bash cURL
2357 curl "https://api.anthropic.com/v1/organizations/[email protected]" \
2358 -H "x-api-key: $ANTHROPIC_API_KEY" \
2359 -H "anthropic-version: 2023-06-01"
2360 ```
2361 
2362 ```bash CLI
2363 ant organization:users list --email [email protected]
2364 ```
2365 
2366 ```python Python
2367 client = anthropic.Anthropic()
2368 
2369 users = client.organization.users.list(email="[email protected]")
2370 
2371 for user in users:
2372 print(f"{user.id}: {user.email} ({user.role})")
2373 ```
2374 
2375 ```typescript TypeScript
2376 const client = new Anthropic();
2377 
2378 const users = await client.organization.users.list({ email: "[email protected]" });
2379 
2380 for await (const user of users) {
2381 console.log(`${user.id}: ${user.email} (${user.role})`);
2382 }
2383 ```
2384 
2385 ```csharp C#
2386 AnthropicClient client = new();
2387 
2388 var page = await client.Organization.Users.List(new() { Email = "[email protected]" });
2389 
2390 await foreach (var user in page.Paginate())
2391 {
2392 Console.WriteLine($"{user.ID}: {user.Email} ({user.Role.Raw()})");
2393 }
2394 ```
2395 
2396 ```go Go
2397 client := anthropic.NewClient()
2398 
2399 users := client.Organization.Users.ListAutoPaging(context.Background(), anthropic.OrganizationUserListParams{
2400 Email: anthropic.String("[email protected]"),
2401 })
2402 
2403 for users.Next() {
2404 user := users.Current()
2405 fmt.Printf("%s: %s (%s)\n", user.ID, user.Email, user.Role)
2406 }
2407 if err := users.Err(); err != nil {
2408 log.Fatal(err)
2409 }
2410 ```
2411 
2412 ```java Java
2413 import com.anthropic.models.organization.users.UserListParams;
2414 
2415 void main() {
2416 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
2417 
2418 var params = UserListParams.builder()
2419 .email("[email protected]")
2420 .build();
2421 var users = client.organization().users().list(params);
2422 
2423 for (var user : users.autoPager()) {
2424 IO.println(user.id() + ": " + user.email() + " (" + user.role().asString() + ")");
2425 }
2426 }
2427 ```
2428 
2429 ```php PHP
2430 $client = new Client();
2431 
2432 $users = $client->organization->users->list(email: '[email protected]');
2433 
2434 foreach ($users->pagingEachItem() as $user) {
2435 echo "{$user->id}: {$user->email} ({$user->role})\n";
2436 }
2437 ```
2438 
2439 ```ruby Ruby
2440 client = Anthropic::Client.new
2441 
2442 users = client.organization.users.list(email: "[email protected]")
2443 
2444 users.auto_paging_each do |user|
2445 puts "#{user.id}: #{user.email} (#{user.role})"
2446 end
2447 ```
2448 </CodeGroup>
5312449 
53224502. Remove them with `DELETE /v1/organizations/users/{user_id}`, using the `id` from the response. Their seat, if any, returns to the pool.
5332451 
5342452 

manage-claude/workload-identity-federation Changed · +21 / -9 lines

from line 89
8989 
9090You can construct the client with explicit credentials or with no arguments. With no arguments, the SDK resolves credentials from environment variables or the active profile, as described under [Credential precedence](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#credential-precedence). The zero-argument form is the recommended pattern for production workloads: ship the same container image everywhere and inject `ANTHROPIC_FEDERATION_RULE_ID`, `ANTHROPIC_ORGANIZATION_ID`, `ANTHROPIC_SERVICE_ACCOUNT_ID`, `ANTHROPIC_WORKSPACE_ID`, and `ANTHROPIC_IDENTITY_TOKEN_FILE` per environment.
9191 
92<CodeGroup exclude="shell:CLI">
92<CodeGroup>
9393 ```bash cURL
9494 # 1. Acquire your IdP's JWT (platform-specific; see the per-provider guides).
9595 JWT=$(cat /var/run/secrets/anthropic.com/token)
from line 110
110110 )
111111 
112112 ACCESS_TOKEN=$(jq -r .access_token <<<"$RESPONSE")
113 EXPIRES_IN=$(jq -r .expires_in <<<"$RESPONSE") # seconds; re-exchange before this elapses
113 # The response's expires_in is the token's lifetime in seconds; re-exchange before it elapses.
114114 
115115 # 3. Call the API with the access token in the Authorization: Bearer header.
116116 curl -sS https://api.anthropic.com/v1/messages \
from line 117
117117 -H "authorization: Bearer $ACCESS_TOKEN" \
118118 -H "anthropic-version: 2023-06-01" \
119119 -H "content-type: application/json" \
120 -d @- <<'JSON' | jq -r '.content[] | select(.type == "text") | .text'
121 {
122 "model": "claude-opus-5-5",
123 "max_tokens": 1024,
124 "messages": [{"role": "user", "content": "Hello, Claude"}]
125 }
126 JSON
120 -d '{
121 "model": "claude-opus-5-5",
122 "max_tokens": 1024,
123 "messages": [{"role": "user", "content": "Hello, Claude"}]
124 }'
125 ```
126 
127 ```bash CLI
128 # The CLI exchanges the identity token for an access token itself.
129 export ANTHROPIC_IDENTITY_TOKEN_FILE=/var/run/secrets/anthropic.com/token
130 export ANTHROPIC_FEDERATION_RULE_ID=fdrl_...
131 export ANTHROPIC_ORGANIZATION_ID=00000000-0000-0000-0000-000000000000
132 export ANTHROPIC_SERVICE_ACCOUNT_ID=svac_...
133 export ANTHROPIC_WORKSPACE_ID=wrkspc_...
134 
135 ant messages create \
136 --model claude-opus-5-5 \
137 --max-tokens 1024 \
138 --message '{role: user, content: "Hello, Claude"}'
127139 ```
128140 
129141 ```python Python

managed-agents/agent-setup Changed · +4 / -6 lines

from line 363
363363 -H "anthropic-version: 2023-06-01" \
364364 -H "anthropic-beta: managed-agents-2026-04-01" \
365365 -H "content-type: application/json" \
366 -d @- <<EOF
367 {
368 "version": $AGENT_VERSION,
369 "system": "You are a helpful coding agent. Always write tests."
370 }
371 EOF
366 -d '{
367 "version": '"$AGENT_VERSION"',
368 "system": "You are a helpful coding agent. Always write tests."
369 }'
372370 )
373371 
374372 echo "New version: $(jq -r '.version' <<< "$updated_agent")"

managed-agents/budgets Changed · +8 / -10 lines

from line 23
2323 -H "anthropic-version: 2023-06-01" \
2424 -H "anthropic-beta: managed-agents-2026-04-01" \
2525 -H "content-type: application/json" \
26 -d @- <<EOF
27 {
28 "agent": "$AGENT_ID",
29 "environment_id": "$ENVIRONMENT_ID",
30 "budget": {
31 "type": "limit",
32 "max_list_cost": {"amount": "125", "currency": "USD"}
33 }
34 }
35 EOF
26 -d '{
27 "agent": "'"$AGENT_ID"'",
28 "environment_id": "'"$ENVIRONMENT_ID"'",
29 "budget": {
30 "type": "limit",
31 "max_list_cost": {"amount": "125", "currency": "USD"}
32 }
33 }'
3634 ```
3735 
3836 ```bash CLI

managed-agents/choosing-an-environment New page · 74 lines, new page

## Start with a cloud environment ## Compare the options ## When to choose a self-hosted sandbox ## What a self-hosted sandbox doesn't change ## What you take on and give up with a self-hosted sandbox ## Differences on Claude Platform on AWS ## Switch from a cloud environment to a self-hosted sandbox

A whole new page. There's nothing to diff it against, so here is what it says.

---
title: Choosing an agent environment
url: https://platform.claude.com/docs/en/managed-agents/choosing-an-environment
description: Decide whether Claude Managed Agents tools and code run in an Anthropic-managed cloud environment or a self-hosted sandbox, and see what changes if you switch.
featureMetadata:
  topic:
    title: Managed Agents
    url: https://platform.claude.com/docs/en/managed-agents/overview
  status: beta
  betaHeader: managed-agents-2026-04-01
---

An environment sets where your agent's tools and code run. They run in a sandbox. A sandbox is an isolated workspace, such as a container, where the agent runs commands and works on files. You have two options:

* **Cloud environment:** Anthropic runs the sandbox for you. Each session gets its own fresh Linux container on Anthropic-managed infrastructure, with common languages, databases, and utilities already installed. You choose its network rules and any extra packages to install.
* **Self-hosted sandbox:** You run the sandbox on your own infrastructure. Claude still runs on Anthropic's side and decides which tool to call next. A program that you run, called a worker, carries out the agent's bash and file tool calls on your machines and sends each result back. It can also serve custom tools.

The agent definition is the same whichever you choose. You set the model, prompt, and tools on the [agent](https://platform.claude.com/docs/en/managed-agents/agent-setup), not on the environment.

## Start with a cloud environment

If you're not sure which to choose, or you're new to Claude Managed Agents, start with a [cloud environment](https://platform.claude.com/docs/en/managed-agents/environments), as the [quickstart](https://platform.claude.com/docs/en/managed-agents/quickstart) does. Anthropic runs an isolated container for each session, with common languages and tools already installed, so there is nothing for you to host. Choose a self-hosted sandbox only if tools must run on infrastructure you control.

## Compare the options

The table compares the two options.

|                                     | [Cloud environment](https://platform.claude.com/docs/en/managed-agents/environments) (default)                                                                                                                                                                           | [Self-hosted sandbox](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes)                           |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| Where tools and code run            | An Anthropic-managed sandbox                                                                                                                                                                                                                                             | Your worker, on your infrastructure                                                                                       |
| What reaches Anthropic              | The [conversation history](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#list-past-events), [tool results](https://platform.claude.com/docs/en/managed-agents/tools#available-tools), the sandbox's files and state, skills, and memory stores | The conversation history, tool results, skills, and memory stores. The sandbox's files and processes stay on your worker. |
| What you operate                    | Nothing                                                                                                                                                                                                                                                                  | The worker hosts, their hardening, their network limits, and the environment key your worker authenticates with           |
| Network reach                       | Network rules you set on the environment                                                                                                                                                                                                                                 | Your own network policy                                                                                                   |
| File and GitHub repository mounting | Managed by Anthropic                                                                                                                                                                                                                                                     | Managed by you                                                                                                            |
| Memory stores                       | Mounted by Anthropic at `/mnt/memory/`                                                                                                                                                                                                                                   | Downloaded to `/mnt/memory/` and synced by the worker                                                                     |
| Sandbox lifecycle                   | Managed by Anthropic                                                                                                                                                                                                                                                     | Managed by you                                                                                                            |
| Choose it when                      | The default. You don't need tools to run on your own infrastructure.                                                                                                                                                                                                     | Tools must run on infrastructure you control.                                                                             |

## When to choose a self-hosted sandbox

A self-hosted sandbox fits when the agent needs to do one of the following:

* **Work on data that can't leave your network:** The agent's files and processes stay on your worker. What a tool returns to the model still reaches the Managed Agents service.
* **Reach internal services that aren't publicly routable:** The agent's bash and file tools, and any custom tools your worker serves, run inside your network. Anthropic, not your worker, connects to the agent's MCP servers. A private one might be in front of your internal ticket system or company wiki. To reach it, you can use an [MCP tunnel](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/overview) with either option. MCP tunnels are in research preview and need an access request. See [Self-hosted sandboxes and MCP tunnels](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes#self-hosted-sandboxes-and-mcp-tunnels).
* **Run under your organization's own compliance and audit controls:** Tools run on hosts that you configure, log, and audit.

## What a self-hosted sandbox doesn't change

With either option, the conversation history and tool results go to the Managed Agents service, which Anthropic operates. That is how the model receives the result of each tool call. The web search and web fetch tools also run on Anthropic's side, not in the sandbox. See [Restrict web search and web fetch domains](https://platform.claude.com/docs/en/managed-agents/tools-web-restrictions). Neither option changes the compliance coverage of Managed Agents or how long it keeps conversation history. See [API and data retention](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#feature-eligibility).

## What you take on and give up with a self-hosted sandbox

A self-hosted sandbox makes you the operator of the worker hosts. You harden the sandbox image, control network egress, store and rotate the environment key, and isolate sessions from each other. The [Security model](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-security) page has the detail.

You also give up these cloud environment features:

* [`file` and `github_repository` session resources](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes#session-resources). You [stage input files yourself](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-workers#stage-files-for-a-session), and you are responsible for mounting your own GitHub repository too.
* [Repository skill discovery](https://platform.claude.com/docs/en/managed-agents/skills#load-skills-from-a-github-repository).
* [Environment variable credentials](https://platform.claude.com/docs/en/managed-agents/vaults#add-a-credential) in vaults.
* The [pre-installed runtimes and packages](https://platform.claude.com/docs/en/managed-agents/cloud-sandboxes-reference) of a cloud sandbox. A self-hosted sandbox has whatever your worker provides.

## Differences on Claude Platform on AWS

If you use Claude Managed Agents through Claude Platform on AWS, Anthropic still operates the service. There, a self-hosted sandbox can't use memory stores, workers don't use an environment key, and MCP tunnels aren't available. See [Claude Managed Agents on Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#claude-managed-agents) and [Features not supported](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#features-not-supported).

## Switch from a cloud environment to a self-hosted sandbox

To switch to a self-hosted sandbox, you keep the agent, create a `self_hosted` environment, and reference its ID in new sessions and deployments.

* **What carries over:** The agent definition, the API key or AWS credentials your application uses, your skills, your MCP servers, and your [memory stores](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-memory).
* **What is new:** A `self_hosted` environment, an environment key that you generate in the Claude Console, and a worker that you run. The [self-hosted sandboxes quickstart](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes#quickstart) covers all three.
* **What stops working:** The features listed in [What you take on and give up with a self-hosted sandbox](https://platform.claude.com/docs/en/managed-agents/choosing-an-environment#what-you-take-on-and-give-up-with-a-self-hosted-sandbox).

On Claude Platform on AWS, memory stores don't carry over to a self-hosted sandbox, and the worker doesn't use an environment key. See [Differences on Claude Platform on AWS](https://platform.claude.com/docs/en/managed-agents/choosing-an-environment#differences-on-claude-platform-on-aws).

managed-agents/define-outcomes Changed · +16 / -20 lines

from line 294
294294 -H "x-api-key: $ANTHROPIC_API_KEY" \
295295 -H "anthropic-version: 2023-06-01" \
296296 -H "anthropic-beta: managed-agents-2026-04-01" \
297 --json @- <<EOF
298 {
299 "agent": "$AGENT_ID",
300 "environment_id": "$ENVIRONMENT_ID",
301 "title": "Financial analysis on Costco"
302 }
303 EOF
297 --json '{
298 "agent": "'"$AGENT_ID"'",
299 "environment_id": "'"$ENVIRONMENT_ID"'",
300 "title": "Financial analysis on Costco"
301 }'
304302 )
305303 SESSION_ID=$(jq -r '.id' <<<"$session")
306304 
from line 307
309307 -H "x-api-key: $ANTHROPIC_API_KEY" \
310308 -H "anthropic-version: 2023-06-01" \
311309 -H "anthropic-beta: managed-agents-2026-04-01" \
312 --json @- >/dev/null <<EOF
313 {
314 "events": [
315 {
316 "type": "user.define_outcome",
317 "description": "Build a DCF model for Costco in .xlsx",
318 "rubric": {"type": "text", "content": "# DCF Model Rubric\n..."},
319 "max_iterations": 5
320 }
321 ]
322 }
323 EOF
324 # or: "rubric": {"type": "file", "file_id": "$RUBRIC_ID"}
310 --json '{
311 "events": [
312 {
313 "type": "user.define_outcome",
314 "description": "Build a DCF model for Costco in .xlsx",
315 "rubric": {"type": "text", "content": "# DCF Model Rubric\n..."},
316 "max_iterations": 5
317 }
318 ]
319 }' >/dev/null
320 # or: "rubric": {"type": "file", "file_id": "'"$RUBRIC_ID"'"}
325321 # "max_iterations" is optional; default 3, max 20
326322 ```
327323 

managed-agents/dreams Changed · +15 / -19 lines

from line 36
3636 -H "anthropic-version: 2023-06-01" \
3737 -H "anthropic-beta: managed-agents-2026-04-01,dreaming-2026-04-21" \
3838 -H "content-type: application/json" \
39 --data @- <<EOF
40 {
41 "inputs": [
42 { "type": "memory_store", "memory_store_id": "$store_id" },
43 { "type": "sessions", "session_ids": ["$session_a", "$session_b"] }
44 ],
45 "model": "claude-opus-5-5",
46 "instructions": "Focus on coding-style preferences; ignore one-off debugging notes."
47 }
48 EOF
39 --data '{
40 "inputs": [
41 { "type": "memory_store", "memory_store_id": "'"$store_id"'" },
42 { "type": "sessions", "session_ids": ["'"$session_a"'", "'"$session_b"'"] }
43 ],
44 "model": "claude-opus-5-5",
45 "instructions": "Focus on coding-style preferences; ignore one-off debugging notes."
46 }'
4947 ```
5048 
5149 ```bash CLI
from line 312
314312 -H "anthropic-version: 2023-06-01" \
315313 -H "anthropic-beta: managed-agents-2026-04-01" \
316314 -H "content-type: application/json" \
317 --data @- <<EOF
318 {
319 "agent": "$agent_id",
320 "environment_id": "$environment_id",
321 "resources": [
322 { "type": "memory_store", "memory_store_id": "$output_store_id" }
323 ]
324 }
325 EOF
315 --data '{
316 "agent": "'"$agent_id"'",
317 "environment_id": "'"$environment_id"'",
318 "resources": [
319 { "type": "memory_store", "memory_store_id": "'"$output_store_id"'" }
320 ]
321 }'
326322 ```
327323 
328324 ```bash CLI

managed-agents/environments Changed · +23 / -29 lines

from line 12
1212 
1313Environments define the sandbox configuration where your agent runs. You create an environment once, then reference its ID each time you start a session. Multiple sessions can share the same environment, but each session gets its own isolated sandbox (a fresh Linux container).
1414 
15This page covers `type: cloud` environments. To run sandboxes on your own infrastructure, see [Self-hosted sandboxes](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes).
15This page covers `type: cloud` environments. To run sandboxes on your own infrastructure, see [Self-hosted sandboxes](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes). To choose between the two, see [Choosing an agent environment](https://platform.claude.com/docs/en/managed-agents/choosing-an-environment).
1616 
1717## Create an environment
1818 
from line 23
2323 -H "anthropic-version: 2023-06-01" \
2424 -H "anthropic-beta: managed-agents-2026-04-01" \
2525 -H "content-type: application/json" \
26 --data @- <<'EOF'
27 {
28 "name": "python-dev",
29 "config": {
30 "type": "cloud",
31 "networking": {"type": "limited", "allow_package_managers": true}
32 }
33 }
34 EOF
26 --data '{
27 "name": "python-dev",
28 "config": {
29 "type": "cloud",
30 "networking": {"type": "limited", "allow_package_managers": true}
31 }
32 }'
3533 ```
3634 
3735 <CodeGroupItem>
from line 161
163161 -H "anthropic-version: 2023-06-01" \
164162 -H "anthropic-beta: managed-agents-2026-04-01" \
165163 -H "content-type: application/json" \
166 --data @- <<EOF
167 {
168 "agent": "$AGENT_ID",
169 "environment_id": "$ENVIRONMENT_ID"
170 }
171 EOF
164 --data '{
165 "agent": "'"$AGENT_ID"'",
166 "environment_id": "'"$ENVIRONMENT_ID"'"
167 }'
172168 ```
173169 
174170 ```bash CLI
from line 240
244240 -H "anthropic-version: 2023-06-01" \
245241 -H "anthropic-beta: managed-agents-2026-04-01" \
246242 -H "content-type: application/json" \
247 --data @- <<'EOF'
248 {
249 "name": "data-analysis",
250 "config": {
251 "type": "cloud",
252 "packages": {
253 "pip": ["pandas", "numpy", "scikit-learn"],
254 "npm": ["express"]
255 },
256 "networking": {"type": "limited", "allow_package_managers": true}
257 }
258 }
259 EOF
243 --data '{
244 "name": "data-analysis",
245 "config": {
246 "type": "cloud",
247 "packages": {
248 "pip": ["pandas", "numpy", "scikit-learn"],
249 "npm": ["express"]
250 },
251 "networking": {"type": "limited", "allow_package_managers": true}
252 }
253 }'
260254 ```
261255 
262256 <CodeGroupItem>

managed-agents/event-deltas Changed · +12 / -15 lines

from line 107
107107 
108108The following examples opt in to `agent.message` previews and reconcile them with the buffered event:
109109 
110<CodeGroup>
110<CodeGroup exclude="shell:CLI">
111111 ```bash cURL
112112 # Opt in to agent.message previews via event_deltas, then accumulate manually.
113113 exec {stream}< <(
from line 125
125125 -H "anthropic-version: 2023-06-01" \
126126 -H "anthropic-beta: managed-agents-2026-04-01" \
127127 -H "content-type: application/json" \
128 -d @- >/dev/null <<'EOF'
129 {
130 "events": [
131 {
132 "type": "user.message",
133 "content": [{"type": "text", "text": "In one short sentence, describe what an event delta is."}]
134 }
135 ]
136 }
137 EOF
128 -d '{
129 "events": [
130 {
131 "type": "user.message",
132 "content": [{"type": "text", "text": "In one short sentence, describe what an event delta is."}]
133 }
134 ]
135 }' >/dev/null
138136 
139137 # Accumulate deltas keyed by (message id, content index); the final
140138 # agent.message carries the full text, so it replaces every preview for that id.
from line 173
175173 exec {stream}<&-
176174 ```
177175 
178 ```bash CLI
179 # This workflow does not translate well to a one-off shell command.
180 # Use one of the SDK examples in this code group instead.
181 ```
176 <CodeGroupItem language="CLI">
177 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
178 </CodeGroupItem>
182179 
183180 ```python Python
184181 # Preview snapshots, keyed by event id. accumulate_managed_agents_event folds each

managed-agents/events-and-streaming Changed · +65 / -79 lines

from line 27
2727 
2828Stream events from the session to receive real-time updates as the agent works. A stream delivers only the events emitted after it opens, so open the stream before you send events to avoid a race condition.
2929 
30<CodeGroup>
30<CodeGroup exclude="shell:CLI">
3131 ```bash cURL
3232 # Open the stream first, then send the user message
3333 exec {stream}< <(
from line 46
4646 -H "anthropic-version: 2023-06-01" \
4747 -H "anthropic-beta: managed-agents-2026-04-01" \
4848 -H "content-type: application/json" \
49 -d @- >/dev/null <<'EOF'
50 {
51 "events": [
52 {
53 "type": "user.message",
54 "content": [{"type": "text", "text": "Summarize the repo README"}]
55 }
56 ]
57 }
58 EOF
49 -d '{
50 "events": [
51 {
52 "type": "user.message",
53 "content": [{"type": "text", "text": "Summarize the repo README"}]
54 }
55 ]
56 }' >/dev/null
5957 
6058 while IFS= read -r -u "$stream" event_line; do
6159 [[ $event_line == data:* ]] || continue
from line 74
7674 exec {stream}<&-
7775 ```
7876 
79 ```bash CLI
80 # This workflow does not translate well to a one-off shell command.
81 # Use one of the SDK examples in this code group instead.
82 ```
77 <CodeGroupItem language="CLI">
78 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
79 </CodeGroupItem>
8380 
8481 ```python Python
8582 # Open the stream first, then send the user message
from line 330
3333302. [List the full event history](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#list-past-events) to seed a set of seen event IDs.
3343313. Tail the live stream, skipping any events already returned by the history list.
335332 
336<CodeGroup>
333<CodeGroup exclude="shell:CLI">
337334 ```bash cURL
338335 exec {stream}< <(
339336 curl --fail-with-body -sS -N \
from line 374
377374 exec {stream}<&-
378375 ```
379376 
380 ```bash CLI
381 # This workflow does not translate well to a one-off shell command.
382 # Use one of the SDK examples in this code group instead.
383 ```
377 <CodeGroupItem language="CLI">
378 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
379 </CodeGroupItem>
384380 
385381 ```python Python
386382 with client.beta.sessions.events.stream(session.id) as stream:
from line 593
597593 -H "anthropic-version: 2023-06-01" \
598594 -H "anthropic-beta: managed-agents-2026-04-01" \
599595 -H "content-type: application/json" \
600 -d @- <<'EOF'
601 {
602 "events": [
603 {
604 "type": "user.message",
605 "content": [
606 {"type": "text", "text": "Analyze the performance of the sort function in utils.py"}
607 ]
608 }
609 ]
610 }
611 EOF
596 -d '{
597 "events": [
598 {
599 "type": "user.message",
600 "content": [
601 {"type": "text", "text": "Analyze the performance of the sort function in utils.py"}
602 ]
603 }
604 ]
605 }'
612606 ```
613607 
614608 ```bash CLI
from line 768
774768 
775769The following example answers each call as it arrives:
776770 
777<CodeGroup>
771<CodeGroup exclude="shell:CLI">
778772 ```bash cURL
779773 exec {stream_fd}< <(curl --fail-with-body -sS -N \
780774 "https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream?beta=true" \
from line 805
811805 exec {stream_fd}<&-
812806 ```
813807 
814 ```bash CLI
815 # This workflow does not translate well to a one-off shell command.
816 # Use one of the SDK examples in this code group instead.
817 ```
808 <CodeGroupItem language="CLI">
809 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
810 </CodeGroupItem>
818811 
819812 ```python Python
820813 with client.beta.sessions.events.stream(session.id) as stream:
from line 1031
10381031 
10391032The following example approves every pending call:
10401033 
1041<CodeGroup>
1034<CodeGroup exclude="shell:CLI">
10421035 ```bash cURL
10431036 exec {stream_fd}< <(curl --fail-with-body -sS -N \
10441037 "https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream?beta=true" \
from line 1068
10751068 exec {stream_fd}<&-
10761069 ```
10771070 
1078 ```bash CLI
1079 # This workflow does not translate well to a one-off shell command.
1080 # Use one of the SDK examples in this code group instead.
1081 ```
1071 <CodeGroupItem language="CLI">
1072 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
1073 </CodeGroupItem>
10821074 
10831075 ```python Python
10841076 with client.beta.sessions.events.stream(session.id) as stream:
from line 1276
12841276 -H "anthropic-version: 2023-06-01" \
12851277 -H "anthropic-beta: managed-agents-2026-04-01" \
12861278 -H "content-type: application/json" \
1287 -d @- <<'EOF'
1288 {
1289 "events": [
1290 {
1291 "type": "user.message",
1292 "content": [
1293 {"type": "text", "text": "Now run the tests against the changes you made earlier."}
1294 ]
1295 }
1296 ]
1297 }
1298 EOF
1279 -d '{
1280 "events": [
1281 {
1282 "type": "user.message",
1283 "content": [
1284 {"type": "text", "text": "Now run the tests against the changes you made earlier."}
1285 ]
1286 }
1287 ]
1288 }'
12991289 ```
13001290 
13011291 ```bash CLI
from line 1447
14571447 -H "anthropic-version: 2023-06-01" \
14581448 -H "anthropic-beta: managed-agents-2026-04-01" \
14591449 -H "content-type: application/json" \
1460 -d @- <<'EOF'
1461 {
1462 "events": [
1463 {"type": "user.interrupt"},
1464 {
1465 "type": "user.message",
1466 "content": [
1467 {"type": "text", "text": "Instead, focus on fixing the bug in line 42."}
1468 ]
1469 }
1470 ]
1471 }
1472 EOF
1450 -d '{
1451 "events": [
1452 {"type": "user.interrupt"},
1453 {
1454 "type": "user.message",
1455 "content": [
1456 {"type": "text", "text": "Instead, focus on fixing the bug in line 42."}
1457 ]
1458 }
1459 ]
1460 }'
14731461 ```
14741462 
14751463 ```bash CLI
from line 1808
18201808 -H "anthropic-version: 2023-06-01" \
18211809 -H "anthropic-beta: managed-agents-2026-04-01" \
18221810 -H "content-type: application/json" \
1823 -d @- <<'EOF'
1824 {
1825 "events": [
1826 {
1827 "type": "system.message",
1828 "content": [
1829 {"type": "text", "text": "The user's current timezone is America/New_York."}
1830 ]
1831 }
1832 ]
1833 }
1834 EOF
1811 -d '{
1812 "events": [
1813 {
1814 "type": "system.message",
1815 "content": [
1816 {"type": "text", "text": "The current timezone of the user is America/New_York."}
1817 ]
1818 }
1819 ]
1820 }'
18351821 ```
18361822 
18371823 ```bash CLI

managed-agents/github Changed · +32 / -36 lines

from line 25
2525 -H "anthropic-version: 2023-06-01" \
2626 -H "anthropic-beta: managed-agents-2026-04-01" \
2727 -H "content-type: application/json" \
28 --data @- <<JSON | jq -r '.id'
29 {
30 "name": "Code Reviewer",
31 "model": "claude-opus-5-5",
32 "system": "You are a code review assistant with access to GitHub.",
33 "mcp_servers": [
34 {
35 "type": "url",
36 "name": "github",
37 "url": "https://api.githubcopilot.com/mcp/"
38 }
39 ],
40 "tools": [
41 {"type": "agent_toolset_20260401"},
42 {
43 "type": "mcp_toolset",
44 "mcp_server_name": "github"
45 }
46 ]
47 }
48 JSON
28 --data '{
29 "name": "Code Reviewer",
30 "model": "claude-opus-5-5",
31 "system": "You are a code review assistant with access to GitHub.",
32 "mcp_servers": [
33 {
34 "type": "url",
35 "name": "github",
36 "url": "https://api.githubcopilot.com/mcp/"
37 }
38 ],
39 "tools": [
40 {"type": "agent_toolset_20260401"},
41 {
42 "type": "mcp_toolset",
43 "mcp_server_name": "github"
44 }
45 ]
46 }' | jq -r '.id'
4947 )
5048 ```
5149 
from line 737
739737 -H "anthropic-beta: managed-agents-2026-04-01" \
740738 -H "content-type: application/json" \
741739 -o /dev/null \
742 --data @- <<JSON
743 {
744 "events": [
745 {
746 "type": "user.message",
747 "content": [
748 {
749 "type": "text",
750 "text": "Fix the type error in src/utils.ts, commit it to a new branch, and push it."
751 }
752 ]
753 }
754 ]
755 }
756 JSON
740 --data '{
741 "events": [
742 {
743 "type": "user.message",
744 "content": [
745 {
746 "type": "text",
747 "text": "Fix the type error in src/utils.ts, commit it to a new branch, and push it."
748 }
749 ]
750 }
751 ]
752 }'
757753 ```
758754 
759755 ```bash CLI

managed-agents/mcp-connector Changed · +20 / -24 lines

from line 32
3232 -H "anthropic-version: 2023-06-01" \
3333 -H "anthropic-beta: managed-agents-2026-04-01" \
3434 -H "content-type: application/json" \
35 -d @- <<'EOF'
36 {
37 "name": "GitHub Assistant",
38 "model": "claude-opus-5-5",
39 "mcp_servers": [
40 {
41 "type": "url",
42 "name": "github",
43 "url": "https://api.githubcopilot.com/mcp/"
44 }
45 ],
46 "tools": [
47 {"type": "agent_toolset_20260401"},
48 {"type": "mcp_toolset", "mcp_server_name": "github"}
49 ]
50 }
51 EOF
35 -d '{
36 "name": "GitHub Assistant",
37 "model": "claude-opus-5-5",
38 "mcp_servers": [
39 {
40 "type": "url",
41 "name": "github",
42 "url": "https://api.githubcopilot.com/mcp/"
43 }
44 ],
45 "tools": [
46 {"type": "agent_toolset_20260401"},
47 {"type": "mcp_toolset", "mcp_server_name": "github"}
48 ]
49 }'
5250 )
5351 agent_id=$(jq -r '.id' <<<"$agent_response")
5452 ```
from line 298
300298 -H "anthropic-version: 2023-06-01" \
301299 -H "anthropic-beta: managed-agents-2026-04-01" \
302300 -H "content-type: application/json" \
303 -d @- <<EOF
304 {
305 "agent": "$agent_id",
306 "environment_id": "$environment_id",
307 "vault_ids": ["$vault_id"]
308 }
309 EOF
301 -d '{
302 "agent": "'"$agent_id"'",
303 "environment_id": "'"$environment_id"'",
304 "vault_ids": ["'"$vault_id"'"]
305 }'
310306 )
311307 session_id=$(jq -r '.id' <<<"$session_response")
312308 ```

managed-agents/memory Changed · +16 / -20 lines

from line 225
225225 -H "anthropic-version: 2023-06-01" \
226226 -H "anthropic-beta: managed-agents-2026-04-01" \
227227 -H "content-type: application/json" \
228 --data @- <<EOF
229 {
230 "agent": "$agent_id",
231 "environment_id": "$environment_id",
232 "resources": [
233 {
234 "type": "memory_store",
235 "memory_store_id": "$store_id",
236 "access": "read_write",
237 "instructions": "User preferences and project context. Check before starting any task."
238 }
239 ]
240 }
241 EOF
228 --data '{
229 "agent": "'"$agent_id"'",
230 "environment_id": "'"$environment_id"'",
231 "resources": [
232 {
233 "type": "memory_store",
234 "memory_store_id": "'"$store_id"'",
235 "access": "read_write",
236 "instructions": "User preferences and project context. Check before starting any task."
237 }
238 ]
239 }'
242240 ```
243241 
244242 ```bash CLI
from line 747
749747 -H "anthropic-version: 2023-06-01" \
750748 -H "anthropic-beta: agent-memory-2026-07-22" \
751749 -H "content-type: application/json" \
752 --data @- > /dev/null <<EOF
753 {
754 "content": "CORRECTED: Always use 2-space indentation.",
755 "precondition": {"type": "content_sha256", "content_sha256": "$mem_sha"}
756 }
757 EOF
750 --data '{
751 "content": "CORRECTED: Always use 2-space indentation.",
752 "precondition": {"type": "content_sha256", "content_sha256": "'"$mem_sha"'"}
753 }' > /dev/null
758754 ```
759755 
760756 ```bash CLI

managed-agents/multiagent-orchestration Changed · +44 / -55 lines

from line 116
116116 -H "anthropic-version: 2023-06-01" \
117117 -H "anthropic-beta: managed-agents-2026-04-01" \
118118 -H "content-type: application/json" \
119 -d @- <<EOF
120 {
121 "name": "Engineering Lead",
122 "model": "claude-opus-5-5",
123 "system": "You coordinate engineering work. Delegate code review to the reviewer agent and test writing to the test agent.",
124 "tools": [
125 {
126 "type": "agent_toolset_20260401"
119 -d '{
120 "name": "Engineering Lead",
121 "model": "claude-opus-5-5",
122 "system": "You coordinate engineering work. Delegate code review to the reviewer agent and test writing to the test agent.",
123 "tools": [
124 {
125 "type": "agent_toolset_20260401"
126 }
127 ],
128 "multiagent": {
129 "type": "multiagent_20261001",
130 "subagents": {
131 "type": "enabled",
132 "predefined_agents": [
133 {"type": "agent", "id": "'"$REVIEWER_AGENT_ID"'"},
134 {"type": "agent", "id": "'"$TEST_WRITER_AGENT_ID"'"}
135 ]
136 }
127137 }
128 ],
129 "multiagent": {
130 "type": "multiagent_20261001",
131 "subagents": {
132 "type": "enabled",
133 "predefined_agents": [
134 {"type": "agent", "id": "$REVIEWER_AGENT_ID"},
135 {"type": "agent", "id": "$TEST_WRITER_AGENT_ID"}
136 ]
137 }
138 }
139 }
140 EOF
138 }'
141139 )
142140 ```
143141 
from line 381
383381 -H "anthropic-version: 2023-06-01" \
384382 -H "anthropic-beta: managed-agents-2026-04-01" \
385383 -H "content-type: application/json" \
386 -d @- <<EOF
387 {
388 "agent": "$LEAD_AGENT_ID",
389 "environment_id": "$ENVIRONMENT_ID"
390 }
391 EOF
384 -d '{
385 "agent": "'"$LEAD_AGENT_ID"'",
386 "environment_id": "'"$ENVIRONMENT_ID"'"
387 }'
392388 )
393389 SESSION_ID=$(jq -r '.id' <<< "$session")
394390 ```
from line 466
470466 
471467<CodeGroup defaultLanguage="CLI">
472468 ```bash cURL
473 research_agent_id=$(curl --fail-with-body -sS "$BASE/v1/agents" "${H[@]}" --data @- <<'EOF' | jq -er '.id'
474 {
469 research_agent_id=$(curl --fail-with-body -sS "$BASE/v1/agents" "${H[@]}" --data '{
475470 "name": "researcher",
476471 "model": "claude-haiku-5-5",
477472 "mcp_servers": [{"type": "url", "name": "github", "url": "https://api.githubcopilot.com/mcp/"}],
478473 "tools": [{"type": "mcp_toolset", "mcp_server_name": "github"}]
479 }
480 EOF
474 }' | jq -er '.id'
481475 )
482476 
483 lead_agent_id=$(curl --fail-with-body -sS "$BASE/v1/agents" "${H[@]}" --data @- <<EOF | jq -er '.id'
484 {
477 lead_agent_id=$(curl --fail-with-body -sS "$BASE/v1/agents" "${H[@]}" --data '{
485478 "name": "lead",
486479 "model": "claude-opus-5-5",
487480 "tools": [{"type": "agent_toolset_20260401"}],
from line 482
489482 "type": "multiagent_20261001",
490483 "subagents": {
491484 "type": "enabled",
492 "predefined_agents": [{"type": "agent", "id": "$research_agent_id"}]
485 "predefined_agents": [{"type": "agent", "id": "'"$research_agent_id"'"}]
493486 }
494487 }
495 }
496 EOF
488 }' | jq -er '.id'
497489 )
498490 ```
499491 
from line 782
790782 
791783<CodeGroup>
792784 ```bash cURL
793 session_id=$(curl --fail-with-body -sS "$BASE/v1/sessions" "${H[@]}" --data @- <<EOF | jq -er '.id'
794 {
795 "agent": "$lead_agent_id",
796 "environment_id": "$environment_id",
797 "vault_ids": ["$vault_id"]
798 }
799 EOF
785 session_id=$(curl --fail-with-body -sS "$BASE/v1/sessions" "${H[@]}" --data '{
786 "agent": "'"$lead_agent_id"'",
787 "environment_id": "'"$environment_id"'",
788 "vault_ids": ["'"$vault_id"'"]
789 }' | jq -er '.id'
800790 )
801791 echo "$session_id"
802792 ```
from line 901
911901 -H "anthropic-version: 2023-06-01" \
912902 -H "anthropic-beta: managed-agents-2026-04-01" \
913903 -H "content-type: application/json" \
914 -d @- <<'EOF'
915 {
916 "name": "Contract Reviewer",
917 "model": "claude-opus-5-5",
918 "system": "You review contracts. When you're asked to review more than a few contracts, start a workflow run that reads them in parallel and combines the findings. Review one or two contracts yourself, without a run.",
919 "tools": [{"type": "agent_toolset_20260401"}],
920 "multiagent": {"type": "multiagent_20261001", "workflows": {"type": "enabled"}}
921 }
922 EOF
904 -d '{
905 "name": "Contract Reviewer",
906 "model": "claude-opus-5-5",
907 "system": "You review contracts. When you are asked to review more than a few contracts, start a workflow run that reads them in parallel and combines the findings. Review one or two contracts yourself, without a run.",
908 "tools": [{"type": "agent_toolset_20260401"}],
909 "multiagent": {"type": "multiagent_20261001", "workflows": {"type": "enabled"}}
910 }'
923911 ```
924912 
925913 <CodeGroupItem>
from line 1105
11171105To adapt it, name the tasks in your agent's domain that call for a run, and the small tasks the agent should do itself. You can also guide how a run does the work, as in these examples:
11181106 
11191107* **How to split the work:** "In a run, use one agent per contract. Then have a second agent review every contract, not only the ones where the first agent found something, and look for what the first agent missed. Anything that fails the review gets redone and reviewed again."
1120* **What to do when an agent fails:** "One agent failing must not fail the run. If an agent fails to read a contract, list that contract as not covered."
1108* **What to do when an agent fails:** "One agent failing must not fail the run. If an agent fails to read a contract, list that contract as not covered. When the run ends, tell me which contracts weren't covered."
11211109* **A time limit:** "Give the run a one-hour time limit."
1110* **Plan first:** "Before you start a run, describe its phases and how many agents each one runs. Then wait for my go-ahead." There's no approval step before a run starts, so nothing enforces this.
11221111 
11231112Keep runs to the tasks that need them, because every agent in a run uses tokens.
11241113 

managed-agents/quickstart Changed · +35 / -39 lines

from line 146
146146 -H "anthropic-version: 2023-06-01" \
147147 -H "anthropic-beta: managed-agents-2026-04-01" \
148148 -H "content-type: application/json" \
149 -d @- <<'EOF'
150 {
151 "name": "Coding Assistant",
152 "model": "claude-opus-5-5",
153 "system": "You are a helpful coding assistant. Write clean, well-documented code.",
154 "tools": [
155 {"type": "agent_toolset_20260401"}
156 ]
157 }
158 EOF
149 -d '{
150 "name": "Coding Assistant",
151 "model": "claude-opus-5-5",
152 "system": "You are a helpful coding assistant. Write clean, well-documented code.",
153 "tools": [
154 {"type": "agent_toolset_20260401"}
155 ]
156 }'
159157 )
160158 
161159 AGENT_ID=$(jq -er '.id' <<<"$agent")
from line 383
385383 -H "anthropic-version: 2023-06-01" \
386384 -H "anthropic-beta: managed-agents-2026-04-01" \
387385 -H "content-type: application/json" \
388 -d @- <<'EOF'
389 {
390 "name": "quickstart-env",
391 "config": {
392 "type": "cloud",
393 "networking": {"type": "limited", "allow_package_managers": true}
394 }
395 }
396 EOF
386 -d '{
387 "name": "quickstart-env",
388 "config": {
389 "type": "cloud",
390 "networking": {"type": "limited", "allow_package_managers": true}
391 }
392 }'
397393 )
398394 
399395 ENVIRONMENT_ID=$(jq -er '.id' <<<"$environment")
from line 541
545541 </CodeGroup>
546542 
547543 <Tip>
548 To run the sandbox on your own infrastructure instead of a cloud sandbox, see
544 This quickstart uses a cloud environment. To decide whether to run tools on your own infrastructure with a
549545 
550 [Self-hosted sandboxes](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes)
546 [self-hosted sandbox](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes)
551547 
548 instead, see
549 
550 [Choosing an agent environment](https://platform.claude.com/docs/en/managed-agents/choosing-an-environment)
551 
552552 .
553553 </Tip>
554554 </Step>
from line 564
564564 -H "anthropic-version: 2023-06-01" \
565565 -H "anthropic-beta: managed-agents-2026-04-01" \
566566 -H "content-type: application/json" \
567 -d @- <<EOF
568 {
569 "agent": "$AGENT_ID",
570 "environment_id": "$ENVIRONMENT_ID",
571 "title": "Quickstart session"
572 }
573 EOF
567 -d '{
568 "agent": "'"$AGENT_ID"'",
569 "environment_id": "'"$ENVIRONMENT_ID"'",
570 "title": "Quickstart session"
571 }'
574572 )
575573 
576574 SESSION_ID=$(jq -er '.id' <<<"$session")
from line 665
667665 <Step title="Send a message and stream the response">
668666 Open a stream, send a user event, then process events as they arrive:
669667 
670 <CodeGroup>
671 ```bash cURL
672 # This workflow does not translate well to a one-off shell command.
673 # Use one of the SDK examples in this code group instead.
674 ```
668 <CodeGroup exclude="shell">
669 <CodeGroupItem language="cURL">
670 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
671 </CodeGroupItem>
675672 
676 ```bash CLI
677 # This workflow does not translate well to a one-off shell command.
678 # Use one of the SDK examples in this code group instead.
679 ```
673 <CodeGroupItem language="CLI">
674 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
675 </CodeGroupItem>
680676 
681677 ```python Python
682678 with client.beta.sessions.events.stream(session.id) as stream:

managed-agents/scheduled-deployments Changed · +19 / -23 lines

from line 37
3737 -H "anthropic-version: 2023-06-01" \
3838 -H "anthropic-beta: managed-agents-2026-04-01" \
3939 -H "content-type: application/json" \
40 -d @- <<EOF
41 {
42 "name": "Weekly compliance scan",
43 "agent": "$AGENT_ID",
44 "environment_id": "$ENVIRONMENT_ID",
45 "initial_events": [
46 {"type": "user.message", "content": [{"type": "text", "text": "Run the weekly compliance scan."}]}
47 ],
48 "schedule": {
49 "type": "cron",
50 "expression": "0 20 * * 5",
51 "timezone": "America/New_York"
52 }
53 }
54 EOF
40 -d '{
41 "name": "Weekly compliance scan",
42 "agent": "'"$AGENT_ID"'",
43 "environment_id": "'"$ENVIRONMENT_ID"'",
44 "initial_events": [
45 {"type": "user.message", "content": [{"type": "text", "text": "Run the weekly compliance scan."}]}
46 ],
47 "schedule": {
48 "type": "cron",
49 "expression": "0 20 * * 5",
50 "timezone": "America/New_York"
51 }
52 }'
5553 ```
5654 
5755 <CodeGroupItem>
from line 285
287285 -H "anthropic-version: 2023-06-01" \
288286 -H "anthropic-beta: managed-agents-2026-04-01" \
289287 -H "content-type: application/json" \
290 -d @- <<'EOF'
291 {
292 "budget": {
293 "type": "limit",
294 "max_list_cost": {"amount": "2000", "currency": "USD"}
295 }
296 }
297 EOF
288 -d '{
289 "budget": {
290 "type": "limit",
291 "max_list_cost": {"amount": "2000", "currency": "USD"}
292 }
293 }'
298294 ```
299295 
300296 <CodeGroupItem>
Feedback