This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.
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 1
1---
2title: Batches
3url: https://platform.claude.com/docs/en/api/beta/messages/batches
4---
5
61# Batches
72
83## Create a Message Batch
94
10**post** `/v1/messages/batches`
5**POST** `/v1/messages/batches`
116
127Send a batch of Message creation requests.
138
from line 10
1510
1611Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
1712
18### Header Parameters
13### Headers
1914
2015- `"anthropic-beta": optional array of AnthropicBeta`
2116
from line 92
9792
9893 The user profile ID to attribute the requests in this batch to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header. Applies to every request in the batch; an individual request whose `user_profile_id` body field conflicts with this header is errored.
9994
100### Body Parameters
101
102- `requests: array of object { custom_id, params }`
95### Body parameters
96
97- `requests: array of object`
10398
10499 List of requests for prompt completion. Each is an individual request to create a Message.
105100
101 maxItems: 100000, minItems: 1
102
106103 - `custom_id: string`
107104
108105 Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.
109106
110107 Must be unique for each request within the Message Batch.
111108
112 - `params: object { max_tokens, messages, model, 22 more }`
109 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,64}$
110
111 - `params: object`
113112
114113 Messages API creation parameters for the individual request.
115114
from line 123
124123 Set to `0` to populate the [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.
125124
126125 Different models have different maximum values for this parameter. See [models](https://platform.claude.com/docs/en/about-claude/models/overview) for details.
126
127 minimum: 0
127128
128129 - `messages: array of BetaMessageParam`
129130
from line 183
182183
183184 - `array of BetaContentBlockParam`
184185
185 - `BetaTextBlockParam object { text, type, cache_control, citations }`
186 - `BetaTextBlockParam object`
186187
187188 - `text: string`
188189
190 minLength: 1
191
189192 - `type: "text"`
190193
191 - `"text"`
192
193194 - `cache_control: optional BetaCacheControlEphemeral or null`
194195
195196 Create a cache control breakpoint at this content block.
196197
197198 - `type: "ephemeral"`
198
199 - `"ephemeral"`
200199
201200 - `ttl: optional "5m" or "1h"`
202201
from line 214
215214
216215 - `citations: optional array of BetaTextCitationParam or null`
217216
218 - `BetaCitationCharLocationParam object { cited_text, document_index, document_title, 3 more }`
217 - `BetaCitationCharLocationParam object`
219218
220219 - `cited_text: string`
221220
222221 - `document_index: number`
223222
223 minimum: 0
224
224225 - `document_title: string or null`
225226
227 maxLength: 500, minLength: 1
228
226229 - `end_char_index: number`
227230
228231 - `start_char_index: number`
229232
233 minimum: 0
234
230235 - `type: "char_location"`
231236
232 - `"char_location"`
233
234 - `BetaCitationPageLocationParam object { cited_text, document_index, document_title, 3 more }`
237 - `BetaCitationPageLocationParam object`
235238
236239 - `cited_text: string`
237240
238241 - `document_index: number`
239242
243 minimum: 0
244
240245 - `document_title: string or null`
241246
247 maxLength: 500, minLength: 1
248
242249 - `end_page_number: number`
243250
244251 - `start_page_number: number`
245252
253 minimum: 1
254
246255 - `type: "page_location"`
247256
248 - `"page_location"`
249
250 - `BetaCitationContentBlockLocationParam object { cited_text, document_index, document_title, 3 more }`
257 - `BetaCitationContentBlockLocationParam object`
251258
252259 - `cited_text: string`
253260
from line 264
257264
258265 - `document_index: number`
259266
267 minimum: 0
268
260269 - `document_title: string or null`
261270
271 maxLength: 500, minLength: 1
272
262273 - `end_block_index: number`
263274
264275 Exclusive 0-based end index of the cited block range in the source's `content` array.
from line 280
269280
270281 0-based index of the first cited block in the source's `content` array.
271282
283 minimum: 0
284
272285 - `type: "content_block_location"`
273286
274 - `"content_block_location"`
275
276 - `BetaCitationWebSearchResultLocationParam object { cited_text, encrypted_index, title, 2 more }`
287 - `BetaCitationWebSearchResultLocationParam object`
277288
278289 - `cited_text: string`
279290
from line 292
281292
282293 - `title: string or null`
283294
295 maxLength: 512, minLength: 1
296
284297 - `type: "web_search_result_location"`
285298
286 - `"web_search_result_location"`
287
288299 - `url: string`
289300
290 - `BetaCitationSearchResultLocationParam object { cited_text, end_block_index, search_result_index, 4 more }`
301 minLength: 1
302
303 - `BetaCitationSearchResultLocationParam object`
291304
292305 - `cited_text: string`
293306
from line 320
307320
308321 Counted separately from `document_index`; server-side web search results are not included in this count.
309322
323 minimum: 0
324
310325 - `source: string`
311326
312327 - `start_block_index: number`
313328
314329 0-based index of the first cited block in the source's `content` array.
315330
331 minimum: 0
332
316333 - `title: string or null`
317334
318335 - `type: "search_result_location"`
319336
320 - `"search_result_location"`
321
322 - `BetaImageBlockParam object { source, type, cache_control, transformations }`
337 - `BetaImageBlockParam object`
323338
324339 - `source: BetaBase64ImageSource or BetaURLImageSource or BetaFileImageSource`
325340
326 - `BetaBase64ImageSource object { data, media_type, type }`
341 - `BetaBase64ImageSource object`
327342
328343 - `data: string`
329344
345 format: byte
346
330347 - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"`
331348
332349 - `"image/jpeg"`
from line 356
339356
340357 - `type: "base64"`
341358
342 - `"base64"`
343
344 - `BetaURLImageSource object { type, url }`
359 - `BetaURLImageSource object`
345360
346361 - `type: "url"`
347362
348 - `"url"`
349
350363 - `url: string`
351364
352 - `BetaFileImageSource object { file_id, type }`
365 - `BetaFileImageSource object`
353366
354367 - `file_id: string`
355368
356369 - `type: "file"`
357370
358 - `"file"`
359
360371 - `type: "image"`
361372
362 - `"image"`
363
364373 - `cache_control: optional BetaCacheControlEphemeral or null`
365374
366375 Create a cache control breakpoint at this content block.
from line 386
377386
378387 - `"error"`
379388
380 - `BetaRequestDocumentBlock object { source, type, cache_control, 3 more }`
389 - `BetaRequestDocumentBlock object`
381390
382391 - `source: BetaBase64PDFSource or BetaPlainTextSource or BetaContentBlockSource or 2 more`
383392
384 - `BetaBase64PDFSource object { data, media_type, type }`
393 - `BetaBase64PDFSource object`
385394
386395 - `data: string`
387396
397 format: byte
398
388399 - `media_type: "application/pdf"`
389400
390 - `"application/pdf"`
391
392401 - `type: "base64"`
393402
394 - `"base64"`
395
396 - `BetaPlainTextSource object { data, media_type, type }`
403 - `BetaPlainTextSource object`
397404
398405 - `data: string`
399406
400407 - `media_type: "text/plain"`
401408
402 - `"text/plain"`
403
404409 - `type: "text"`
405410
406 - `"text"`
407
408 - `BetaContentBlockSource object { content, type }`
411 - `BetaContentBlockSource object`
409412
410413 - `content: string or array of BetaContentBlockSourceContent`
411414
from line 416
413416
414417 - `BetaContentBlockSourceContent = array of BetaContentBlockSourceContent`
415418
416 - `BetaTextBlockParam object { text, type, cache_control, citations }`
417
418 - `BetaImageBlockParam object { source, type, cache_control, transformations }`
419 - `BetaTextBlockParam object`
420
421 - `BetaImageBlockParam object`
419422
420423 - `type: "content"`
421424
422 - `"content"`
423
424 - `BetaURLPDFSource object { type, url }`
425 - `BetaURLPDFSource object`
425426
426427 - `type: "url"`
427428
428 - `"url"`
429
430429 - `url: string`
431430
432 - `BetaFileDocumentSource object { file_id, type }`
431 - `BetaFileDocumentSource object`
433432
434433 - `file_id: string`
435434
436435 - `type: "file"`
437436
438 - `"file"`
439
440437 - `type: "document"`
441438
442 - `"document"`
443
444439 - `cache_control: optional BetaCacheControlEphemeral or null`
445440
446441 Create a cache control breakpoint at this content block.
from line 446
451446
452447 - `context: optional string or null`
453448
449 minLength: 1
450
454451 - `title: optional string or null`
455452
456 - `BetaSearchResultBlockParam object { content, source, title, 3 more }`
453 maxLength: 500, minLength: 1
454
455 - `BetaSearchResultBlockParam object`
457456
458457 - `content: array of BetaTextBlockParam`
459458
460459 - `text: string`
461460
461 minLength: 1
462
462463 - `type: "text"`
463464
464465 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 474
473474
474475 - `type: "search_result"`
475476
476 - `"search_result"`
477
478477 - `cache_control: optional BetaCacheControlEphemeral or null`
479478
480479 Create a cache control breakpoint at this content block.
481480
482481 - `citations: optional BetaCitationsConfigParam`
483482
484 - `BetaThinkingBlockParam object { signature, thinking, type }`
483 - `BetaThinkingBlockParam object`
485484
486485 - `signature: string`
487486
from line 494
495494
496495 - `type: "thinking"`
497496
498 - `"thinking"`
499
500 - `BetaRedactedThinkingBlockParam object { data, type }`
497 - `BetaRedactedThinkingBlockParam object`
501498
502499 - `data: string`
503500
from line 502
505502
506503 - `type: "redacted_thinking"`
507504
508 - `"redacted_thinking"`
509
510 - `BetaToolUseBlockParam object { id, input, name, 4 more }`
505 - `BetaToolUseBlockParam object`
511506
512507 - `id: string`
513508
509 pattern: ^[a-zA-Z0-9_-]+$
510
514511 - `input: map[unknown]`
515512
516513 - `name: string`
517514
515 maxLength: 200, minLength: 1
516
518517 - `type: "tool_use"`
519518
520 - `"tool_use"`
521
522519 - `cache_control: optional BetaCacheControlEphemeral or null`
523520
524521 Create a cache control breakpoint at this content block.
from line 524
527524
528525 Tool invocation directly from the model.
529526
530 - `BetaDirectCaller object { type }`
527 - `BetaDirectCaller object`
531528
532529 Tool invocation directly from the model.
533530
534531 - `type: "direct"`
535532
536 - `"direct"`
537
538 - `BetaServerToolCaller object { tool_id, type }`
533 - `BetaServerToolCaller object`
539534
540535 Tool invocation generated by a server-side tool.
541536
542537 - `tool_id: string`
543538
539 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
540
544541 - `type: "code_execution_20250825"`
545542
546 - `"code_execution_20250825"`
547
548 - `BetaServerToolCaller20260120 object { tool_id, type }`
543 - `BetaServerToolCaller20260120 object`
549544
550545 - `tool_id: string`
551546
547 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
548
552549 - `type: "code_execution_20260120"`
553550
554 - `"code_execution_20260120"`
555
556551 - `toolset_name: optional string or null`
557552
558553 For a toolset member tool_use, the toolset family this member belongs to.
559554
560 - `BetaToolResultBlockParam object { tool_use_id, type, cache_control, 3 more }`
555 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
556
557 - `BetaToolResultBlockParam object`
561558
562559 - `tool_use_id: string`
563560
561 pattern: ^[a-zA-Z0-9_-]+$
562
564563 - `type: "tool_result"`
565564
566 - `"tool_result"`
567
568565 - `cache_control: optional BetaCacheControlEphemeral or null`
569566
570567 Create a cache control breakpoint at this content block.
from line 572
575572
576573 - `array of BetaTextBlockParam or BetaImageBlockParam or BetaSearchResultBlockParam or 3 more`
577574
578 - `BetaTextBlockParam object { text, type, cache_control, citations }`
579
580 - `BetaImageBlockParam object { source, type, cache_control, transformations }`
581
582 - `BetaSearchResultBlockParam object { content, source, title, 3 more }`
583
584 - `BetaRequestDocumentBlock object { source, type, cache_control, 3 more }`
585
586 - `BetaToolReferenceBlockParam object { tool_name, type, cache_control }`
575 - `BetaTextBlockParam object`
576
577 - `BetaImageBlockParam object`
578
579 - `BetaSearchResultBlockParam object`
580
581 - `BetaRequestDocumentBlock object`
582
583 - `BetaToolReferenceBlockParam object`
587584
588585 Tool reference block that can be included in tool_result content.
589586
590587 - `tool_name: string`
591588
589 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
590
592591 - `type: "tool_reference"`
593592
594 - `"tool_reference"`
595
596593 - `cache_control: optional BetaCacheControlEphemeral or null`
597594
598595 Create a cache control breakpoint at this content block.
599596
600 - `BetaBrowserStateBlockParam object { tabs, type, cache_control, state_changes }`
597 - `BetaBrowserStateBlockParam object`
601598
602599 The caller's browser state after a browser toolset member call —
603600 the full inventory of open tabs, which tab is active, and any side
from line 608
611608
612609 All tabs open in the browser after this call — the full inventory, not a delta. May be empty. Whenever non-empty, exactly one entry carries `active: true`.
613610
611 maxItems: 100
612
614613 - `tab_id: string`
615614
616615 The caller-assigned identifier for this tab, unique within the inventory.
617616
617 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
618
618619 - `title: string`
619620
620621 The title of the page the tab is showing. May be empty.
621622
623 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
624
622625 - `url: string`
623626
624627 The URL of the page the tab is showing. May be empty.
625628
629 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
630
626631 - `active: optional boolean`
627632
628633 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
629634
630635 - `type: "browser_state"`
631636
632 - `"browser_state"`
633
634637 - `cache_control: optional BetaCacheControlEphemeral or null`
635638
636639 Create a cache control breakpoint at this content block.
from line 642
639642
640643 Tabs opened and download state changes during this call. "Nothing to report" is expressed by omitting the field, never by an empty list.
641644
642 - `BetaBrowserStateChangeTabOpened object { tab_id, type }`
645 maxItems: 200, minItems: 1
646
647 - `BetaBrowserStateChangeTabOpened object`
643648
644649 A tab this call's execution opened that remains open at its end —
645650 the creation delta of the `tabs` inventory, not an event log.
from line 658
653658
654659 The `tab_id` of the opened tab, present in `tabs`.
655660
661 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
662
656663 - `type: "tab_opened"`
657664
658 - `"tab_opened"`
659
660 - `BetaBrowserStateChangeDownloadStarted object { download_id, type, url }`
665 - `BetaBrowserStateChangeDownloadStarted object`
661666
662667 A file download that started during this call.
663668
from line 670
665670
666671 The caller-assigned identifier for this download, stable across the state changes reporting it.
667672
673 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
674
668675 - `type: "download_started"`
669676
670 - `"download_started"`
671
672677 - `url: string`
673678
674679 The final post-redirect URL the download was served from.
675680
676 - `BetaBrowserStateChangeDownloadCompleted object { download_id, type, url, 2 more }`
681 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
682
683 - `BetaBrowserStateChangeDownloadCompleted object`
677684
678685 A file download that finished during this call, reported with the
679686 same `download_id` as its `download_started` — or without a prior
from line 691
684691
685692 The caller-assigned identifier for this download, stable across the state changes reporting it.
686693
694 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
695
687696 - `type: "download_completed"`
688697
689 - `"download_completed"`
690
691698 - `url: string`
692699
693700 The final post-redirect URL the download was served from.
694701
702 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
703
695704 - `path: optional string or null`
696705
697706 Where the executor saved the file, on the executor's filesystem. Only included when another tool in the same environment can read the file at that path.
698707
708 pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$, maxLength: 4096
709
699710 - `size_bytes: optional number or null`
700711
701712 The completed download's size.
702713
703 - `BetaBrowserStateChangeDownloadFailed object { download_id, type, url, error }`
714 minimum: 0
715
716 - `BetaBrowserStateChangeDownloadFailed object`
704717
705718 A file download that failed — or was cancelled — during this call.
706719
from line 721
708721
709722 The caller-assigned identifier for this download, stable across the state changes reporting it.
710723
724 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
725
711726 - `type: "download_failed"`
712727
713 - `"download_failed"`
714
715728 - `url: string`
716729
717730 The final post-redirect URL the download was served from.
718731
732 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
733
719734 - `error: optional string or null`
720735
721736 The failure or cancellation detail, when known.
722737
738 pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$, maxLength: 4096
739
723740 - `is_error: optional boolean`
724741
725742 - `toolset_name: optional string or null`
726743
727744 For a toolset member tool_result, the toolset family of the paired tool_use.
728745
729 - `BetaServerToolUseBlockParam object { id, input, name, 3 more }`
746 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
747
748 - `BetaServerToolUseBlockParam object`
730749
731750 - `id: string`
732751
752 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
753
733754 - `input: map[unknown]`
734755
735756 - `name: "advisor" or "web_search" or "web_fetch" or 5 more`
from line 773
752773
753774 - `type: "server_tool_use"`
754775
755 - `"server_tool_use"`
756
757776 - `cache_control: optional BetaCacheControlEphemeral or null`
758777
759778 Create a cache control breakpoint at this content block.
from line 781
762781
763782 Tool invocation directly from the model.
764783
765 - `BetaDirectCaller object { type }`
784 - `BetaDirectCaller object`
766785
767786 Tool invocation directly from the model.
768787
769 - `BetaServerToolCaller object { tool_id, type }`
788 - `BetaServerToolCaller object`
770789
771790 Tool invocation generated by a server-side tool.
772791
773 - `BetaServerToolCaller20260120 object { tool_id, type }`
774
775 - `BetaWebSearchToolResultBlockParam object { content, tool_use_id, type, 2 more }`
792 - `BetaServerToolCaller20260120 object`
793
794 - `BetaWebSearchToolResultBlockParam object`
776795
777796 - `content: BetaWebSearchToolResultBlockParamContent`
778797
from line 803
784803
785804 - `type: "web_search_result"`
786805
787 - `"web_search_result"`
788
789806 - `url: string`
790807
791808 - `page_age: optional string or null`
792809
793 - `BetaWebSearchToolRequestError object { error_code, type }`
810 - `BetaWebSearchToolRequestError object`
794811
795812 - `error_code: BetaWebSearchToolResultErrorCode`
796813
from line 825
808825
809826 - `type: "web_search_tool_result_error"`
810827
811 - `"web_search_tool_result_error"`
812
813828 - `tool_use_id: string`
814829
830 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
831
815832 - `type: "web_search_tool_result"`
816833
817 - `"web_search_tool_result"`
818
819834 - `cache_control: optional BetaCacheControlEphemeral or null`
820835
821836 Create a cache control breakpoint at this content block.
from line 839
824839
825840 Tool invocation directly from the model.
826841
827 - `BetaDirectCaller object { type }`
842 - `BetaDirectCaller object`
828843
829844 Tool invocation directly from the model.
830845
831 - `BetaServerToolCaller object { tool_id, type }`
846 - `BetaServerToolCaller object`
832847
833848 Tool invocation generated by a server-side tool.
834849
835 - `BetaServerToolCaller20260120 object { tool_id, type }`
836
837 - `BetaWebFetchToolResultBlockParam object { content, tool_use_id, type, 2 more }`
850 - `BetaServerToolCaller20260120 object`
851
852 - `BetaWebFetchToolResultBlockParam object`
838853
839854 - `content: BetaWebFetchToolResultErrorBlockParam or BetaWebFetchBlockParam`
840855
841 - `BetaWebFetchToolResultErrorBlockParam object { error_code, type }`
856 - `BetaWebFetchToolResultErrorBlockParam object`
842857
843858 - `error_code: BetaWebFetchToolResultErrorCode`
844859
from line 877
862877
863878 - `type: "web_fetch_tool_result_error"`
864879
865 - `"web_fetch_tool_result_error"`
866
867 - `BetaWebFetchBlockParam object { content, type, url, retrieved_at }`
880 - `BetaWebFetchBlockParam object`
868881
869882 - `content: BetaRequestDocumentBlock`
870883
871884 - `type: "web_fetch_result"`
872885
873 - `"web_fetch_result"`
874
875886 - `url: string`
876887
877888 Fetched content URL
from line 893
882893
883894 - `tool_use_id: string`
884895
896 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
897
885898 - `type: "web_fetch_tool_result"`
886899
887 - `"web_fetch_tool_result"`
888
889900 - `cache_control: optional BetaCacheControlEphemeral or null`
890901
891902 Create a cache control breakpoint at this content block.
from line 905
894905
895906 Tool invocation directly from the model.
896907
897 - `BetaDirectCaller object { type }`
908 - `BetaDirectCaller object`
898909
899910 Tool invocation directly from the model.
900911
901 - `BetaServerToolCaller object { tool_id, type }`
912 - `BetaServerToolCaller object`
902913
903914 Tool invocation generated by a server-side tool.
904915
905 - `BetaServerToolCaller20260120 object { tool_id, type }`
906
907 - `BetaAdvisorToolResultBlockParam object { content, tool_use_id, type, cache_control }`
916 - `BetaServerToolCaller20260120 object`
917
918 - `BetaAdvisorToolResultBlockParam object`
908919
909920 - `content: BetaAdvisorToolResultErrorParam or BetaAdvisorResultBlockParam or BetaAdvisorRedactedResultBlockParam`
910921
911 - `BetaAdvisorToolResultErrorParam object { error_code, type }`
922 - `BetaAdvisorToolResultErrorParam object`
912923
913924 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
914925
from line 939
928939
929940 - `type: "advisor_tool_result_error"`
930941
931 - `"advisor_tool_result_error"`
932
933 - `BetaAdvisorResultBlockParam object { text, type, stop_reason }`
942 - `BetaAdvisorResultBlockParam object`
934943
935944 - `text: string`
936945
937946 - `type: "advisor_result"`
938947
939 - `"advisor_result"`
940
941948 - `stop_reason: optional string or null`
942949
943 - `BetaAdvisorRedactedResultBlockParam object { encrypted_content, type, stop_reason }`
950 - `BetaAdvisorRedactedResultBlockParam object`
944951
945952 - `encrypted_content: string`
946953
from line 955
948955
949956 - `type: "advisor_redacted_result"`
950957
951 - `"advisor_redacted_result"`
952
953958 - `stop_reason: optional string or null`
954959
955960 - `tool_use_id: string`
956961
962 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
963
957964 - `type: "advisor_tool_result"`
958965
959 - `"advisor_tool_result"`
960
961966 - `cache_control: optional BetaCacheControlEphemeral or null`
962967
963968 Create a cache control breakpoint at this content block.
964969
965 - `BetaCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
970 - `BetaCodeExecutionToolResultBlockParam object`
966971
967972 - `content: BetaCodeExecutionToolResultBlockParamContent`
968973
969974 Code execution result with encrypted stdout for PFC + web_search results.
970975
971 - `BetaCodeExecutionToolResultErrorParam object { error_code, type }`
976 - `BetaCodeExecutionToolResultErrorParam object`
972977
973978 - `error_code: BetaCodeExecutionToolResultErrorCode`
974979
from line 987
982987
983988 - `type: "code_execution_tool_result_error"`
984989
985 - `"code_execution_tool_result_error"`
986
987 - `BetaCodeExecutionResultBlockParam object { content, return_code, stderr, 2 more }`
990 - `BetaCodeExecutionResultBlockParam object`
988991
989992 - `content: array of BetaCodeExecutionOutputBlockParam`
990993
from line 995
992995
993996 - `type: "code_execution_output"`
994997
995 - `"code_execution_output"`
996
997998 - `return_code: number`
998999
9991000 - `stderr: string`
from line 1003
10021003
10031004 - `type: "code_execution_result"`
10041005
1005 - `"code_execution_result"`
1006
1007 - `BetaEncryptedCodeExecutionResultBlockParam object { content, encrypted_stdout, return_code, 2 more }`
1006 - `BetaEncryptedCodeExecutionResultBlockParam object`
10081007
10091008 Code execution result with encrypted stdout for PFC + web_search results.
10101009
from line 1021
10221021
10231022 - `type: "encrypted_code_execution_result"`
10241023
1025 - `"encrypted_code_execution_result"`
1026
10271024 - `tool_use_id: string`
10281025
1026 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1027
10291028 - `type: "code_execution_tool_result"`
10301029
1031 - `"code_execution_tool_result"`
1032
10331030 - `cache_control: optional BetaCacheControlEphemeral or null`
10341031
10351032 Create a cache control breakpoint at this content block.
10361033
1037 - `BetaBashCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1034 - `BetaBashCodeExecutionToolResultBlockParam object`
10381035
10391036 - `content: BetaBashCodeExecutionToolResultErrorParam or BetaBashCodeExecutionResultBlockParam`
10401037
1041 - `BetaBashCodeExecutionToolResultErrorParam object { error_code, type }`
1038 - `BetaBashCodeExecutionToolResultErrorParam object`
10421039
10431040 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
10441041
from line 1051
10541051
10551052 - `type: "bash_code_execution_tool_result_error"`
10561053
1057 - `"bash_code_execution_tool_result_error"`
1058
1059 - `BetaBashCodeExecutionResultBlockParam object { content, return_code, stderr, 2 more }`
1054 - `BetaBashCodeExecutionResultBlockParam object`
10601055
10611056 - `content: array of BetaBashCodeExecutionOutputBlockParam`
10621057
from line 1059
10641059
10651060 - `type: "bash_code_execution_output"`
10661061
1067 - `"bash_code_execution_output"`
1068
10691062 - `return_code: number`
10701063
10711064 - `stderr: string`
from line 1067
10741067
10751068 - `type: "bash_code_execution_result"`
10761069
1077 - `"bash_code_execution_result"`
1078
10791070 - `tool_use_id: string`
10801071
1072 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1073
10811074 - `type: "bash_code_execution_tool_result"`
10821075
1083 - `"bash_code_execution_tool_result"`
1084
10851076 - `cache_control: optional BetaCacheControlEphemeral or null`
10861077
10871078 Create a cache control breakpoint at this content block.
10881079
1089 - `BetaTextEditorCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1080 - `BetaTextEditorCodeExecutionToolResultBlockParam object`
10901081
10911082 - `content: BetaTextEditorCodeExecutionToolResultErrorParam or BetaTextEditorCodeExecutionViewResultBlockParam or BetaTextEditorCodeExecutionCreateResultBlockParam or BetaTextEditorCodeExecutionStrReplaceResultBlockParam`
10921083
1093 - `BetaTextEditorCodeExecutionToolResultErrorParam object { error_code, type, error_message }`
1084 - `BetaTextEditorCodeExecutionToolResultErrorParam object`
10941085
10951086 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
10961087
from line 1097
11061097
11071098 - `type: "text_editor_code_execution_tool_result_error"`
11081099
1109 - `"text_editor_code_execution_tool_result_error"`
1110
11111100 - `error_message: optional string or null`
11121101
1113 - `BetaTextEditorCodeExecutionViewResultBlockParam object { content, file_type, type, 3 more }`
1102 - `BetaTextEditorCodeExecutionViewResultBlockParam object`
11141103
11151104 - `content: string`
11161105
from line 1113
11241113
11251114 - `type: "text_editor_code_execution_view_result"`
11261115
1127 - `"text_editor_code_execution_view_result"`
1128
11291116 - `num_lines: optional number or null`
11301117
11311118 - `start_line: optional number or null`
11321119
11331120 - `total_lines: optional number or null`
11341121
1135 - `BetaTextEditorCodeExecutionCreateResultBlockParam object { is_file_update, type }`
1122 - `BetaTextEditorCodeExecutionCreateResultBlockParam object`
11361123
11371124 - `is_file_update: boolean`
11381125
11391126 - `type: "text_editor_code_execution_create_result"`
11401127
1141 - `"text_editor_code_execution_create_result"`
1142
1143 - `BetaTextEditorCodeExecutionStrReplaceResultBlockParam object { type, lines, new_lines, 3 more }`
1128 - `BetaTextEditorCodeExecutionStrReplaceResultBlockParam object`
11441129
11451130 - `type: "text_editor_code_execution_str_replace_result"`
11461131
1147 - `"text_editor_code_execution_str_replace_result"`
1148
11491132 - `lines: optional array of string or null`
11501133
11511134 - `new_lines: optional number or null`
from line 1141
11581141
11591142 - `tool_use_id: string`
11601143
1144 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1145
11611146 - `type: "text_editor_code_execution_tool_result"`
11621147
1163 - `"text_editor_code_execution_tool_result"`
1164
11651148 - `cache_control: optional BetaCacheControlEphemeral or null`
11661149
11671150 Create a cache control breakpoint at this content block.
11681151
1169 - `BetaToolSearchToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1152 - `BetaToolSearchToolResultBlockParam object`
11701153
11711154 - `content: BetaToolSearchToolResultErrorParam or BetaToolSearchToolSearchResultBlockParam`
11721155
1173 - `BetaToolSearchToolResultErrorParam object { error_code, type, error_message }`
1156 - `BetaToolSearchToolResultErrorParam object`
11741157
11751158 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
11761159
from line 1167
11841167
11851168 - `type: "tool_search_tool_result_error"`
11861169
1187 - `"tool_search_tool_result_error"`
1188
11891170 - `error_message: optional string or null`
11901171
1191 - `BetaToolSearchToolSearchResultBlockParam object { tool_references, type }`
1172 - `BetaToolSearchToolSearchResultBlockParam object`
11921173
11931174 - `tool_references: array of BetaToolReferenceBlockParam`
11941175
11951176 - `tool_name: string`
11961177
1178 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
1179
11971180 - `type: "tool_reference"`
11981181
11991182 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 1185
12021185
12031186 - `type: "tool_search_tool_search_result"`
12041187
1205 - `"tool_search_tool_search_result"`
1206
12071188 - `tool_use_id: string`
12081189
1190 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1191
12091192 - `type: "tool_search_tool_result"`
12101193
1211 - `"tool_search_tool_result"`
1212
12131194 - `cache_control: optional BetaCacheControlEphemeral or null`
12141195
12151196 Create a cache control breakpoint at this content block.
12161197
1217 - `BetaMCPToolUseBlockParam object { id, input, name, 3 more }`
1198 - `BetaMCPToolUseBlockParam object`
12181199
12191200 - `id: string`
12201201
1202 pattern: ^[a-zA-Z0-9_-]+$
1203
12211204 - `input: map[unknown]`
12221205
12231206 - `name: string`
from line 1211
12281211
12291212 - `type: "mcp_tool_use"`
12301213
1231 - `"mcp_tool_use"`
1232
12331214 - `cache_control: optional BetaCacheControlEphemeral or null`
12341215
12351216 Create a cache control breakpoint at this content block.
12361217
1237 - `BetaRequestMCPToolResultBlockParam object { tool_use_id, type, cache_control, 2 more }`
1218 - `BetaRequestMCPToolResultBlockParam object`
12381219
12391220 - `tool_use_id: string`
12401221
1222 pattern: ^[a-zA-Z0-9_-]+$
1223
12411224 - `type: "mcp_tool_result"`
12421225
1243 - `"mcp_tool_result"`
1244
12451226 - `cache_control: optional BetaCacheControlEphemeral or null`
12461227
12471228 Create a cache control breakpoint at this content block.
from line 1235
12541235
12551236 - `text: string`
12561237
1238 minLength: 1
1239
12571240 - `type: "text"`
12581241
12591242 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 1247
12641247
12651248 - `is_error: optional boolean`
12661249
1267 - `BetaContainerUploadBlockParam object { file_id, type, cache_control }`
1250 - `BetaContainerUploadBlockParam object`
12681251
12691252 A content block that represents a file to be uploaded to the container
12701253 Files uploaded via this block will be available in the container's input directory.
from line 1256
12731256
12741257 - `type: "container_upload"`
12751258
1276 - `"container_upload"`
1277
12781259 - `cache_control: optional BetaCacheControlEphemeral or null`
12791260
12801261 Create a cache control breakpoint at this content block.
12811262
1282 - `BetaCompactionBlockParam object { type, cache_control, content, encrypted_content }`
1263 - `BetaCompactionBlockParam object`
12831264
12841265 A compaction block containing summary of previous context.
12851266
from line 1272
12911272
12921273 - `type: "compaction"`
12931274
1294 - `"compaction"`
1295
12961275 - `cache_control: optional BetaCacheControlEphemeral or null`
12971276
12981277 Create a cache control breakpoint at this content block.
from line 1284
13051284
13061285 Opaque metadata from prior compaction, to be round-tripped verbatim
13071286
1308 - `BetaRequestToolAdditionBlock object { tool, type, cache_control }`
1287 - `BetaRequestToolAdditionBlock object`
13091288
13101289 Mid-conversation directive to surface a declared tool.
13111290
from line 1299
13201299 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
13211300 `mcp_toolset_reference` for those.
13221301
1323 - `BetaToolChangeToolReference object { name, type }`
1302 - `BetaToolChangeToolReference object`
13241303
13251304 Reference to a single tool the caller declared directly in
13261305 `tools[]`. Does not accept the composed `{server}_{name}` form the
from line 1308
13291308
13301309 - `name: string`
13311310
1311 pattern: ^[a-zA-Z0-9_-]{1,128}$
1312
13321313 - `type: "tool_reference"`
13331314
1334 - `"tool_reference"`
1335
1336 - `BetaToolChangeMCPToolReference object { name, server_name, type }`
1315 - `BetaToolChangeMCPToolReference object`
13371316
13381317 Reference to a single MCP tool by its server and remote name — the
13391318 same `server_name`/`name` pair `mcp_tool_use` carries.
from line 1323
13441323
13451324 - `type: "mcp_tool_reference"`
13461325
1347 - `"mcp_tool_reference"`
1348
1349 - `BetaToolChangeMCPToolsetReference object { server_name, type }`
1326 - `BetaToolChangeMCPToolsetReference object`
13501327
13511328 Reference to every tool in the named MCP server's toolset.
13521329
from line 1331
13541331
13551332 - `type: "mcp_toolset_reference"`
13561333
1357 - `"mcp_toolset_reference"`
1358
13591334 - `type: "tool_addition"`
13601335
1361 - `"tool_addition"`
1362
13631336 - `cache_control: optional BetaCacheControlEphemeral or null`
13641337
13651338 Create a cache control breakpoint at this content block.
13661339
1367 - `BetaRequestToolRemovalBlock object { tool, type, cache_control }`
1340 - `BetaRequestToolRemovalBlock object`
13681341
13691342 Mid-conversation directive to withdraw a tool.
13701343
from line 1352
13791352 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
13801353 `mcp_toolset_reference` for those.
13811354
1382 - `BetaToolChangeToolReference object { name, type }`
1355 - `BetaToolChangeToolReference object`
13831356
13841357 Reference to a single tool the caller declared directly in
13851358 `tools[]`. Does not accept the composed `{server}_{name}` form the
13861359 server assigns to MCP-resolved tools — use `mcp_tool_reference` or
13871360 `mcp_toolset_reference` for those.
13881361
1389 - `BetaToolChangeMCPToolReference object { name, server_name, type }`
1362 - `BetaToolChangeMCPToolReference object`
13901363
13911364 Reference to a single MCP tool by its server and remote name — the
13921365 same `server_name`/`name` pair `mcp_tool_use` carries.
13931366
1394 - `BetaToolChangeMCPToolsetReference object { server_name, type }`
1367 - `BetaToolChangeMCPToolsetReference object`
13951368
13961369 Reference to every tool in the named MCP server's toolset.
13971370
13981371 - `type: "tool_removal"`
13991372
1400 - `"tool_removal"`
1401
14021373 - `cache_control: optional BetaCacheControlEphemeral or null`
14031374
14041375 Create a cache control breakpoint at this content block.
14051376
1406 - `BetaFallbackBlockParam object { from, to, type, trigger }`
1377 - `BetaFallbackBlockParam object`
14071378
14081379 A `fallback` block echoed back from a prior response.
14091380
from line 1474
15031474
15041475 - `type: "fallback"`
15051476
1506 - `"fallback"`
1507
15081477 - `trigger: optional unknown`
15091478
15101479 The response block's `trigger`, echoed verbatim. Accepted and ignored by the server; any object or `null` is allowed.
from line 1500
15311500
15321501 Container identifier for reuse across requests.
15331502
1534 - `BetaContainerParams object { id, skills }`
1503 - `BetaContainerParams object`
15351504
15361505 Container parameters with skills to be loaded.
15371506
from line 1512
15431512
15441513 List of skills to load in the container
15451514
1515 maxItems: 20
1516
15461517 - `skill_id: string`
15471518
15481519 Skill ID
15491520
1521 maxLength: 64, minLength: 1
1522
15501523 - `type: "anthropic" or "custom"`
15511524
15521525 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 1532
15591532
15601533 Skill version or 'latest' for most recent version
15611534
1535 maxLength: 64, minLength: 1
1536
15621537 - `string`
15631538
15641539 - `context_management: optional BetaContextManagementConfig or null`
from line 1546
15711546
15721547 List of context management edits to apply
15731548
1574 - `BetaClearToolUses20250919Edit object { type, clear_at_least, clear_tool_inputs, 3 more }`
1549 minItems: 0
1550
1551 - `BetaClearToolUses20250919Edit object`
15751552
15761553 - `type: "clear_tool_uses_20250919"`
15771554
1578 - `"clear_tool_uses_20250919"`
1579
15801555 - `clear_at_least: optional BetaInputTokensClearAtLeast or null`
15811556
15821557 Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed.
15831558
15841559 - `type: "input_tokens"`
15851560
1586 - `"input_tokens"`
1587
15881561 - `value: number`
15891562
1563 minimum: 0
1564
15901565 - `clear_tool_inputs: optional boolean or array of string or null`
15911566
15921567 Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
from line 1580
16051580
16061581 - `type: "tool_uses"`
16071582
1608 - `"tool_uses"`
1609
16101583 - `value: number`
16111584
1585 minimum: 0
1586
16121587 - `trigger: optional BetaInputTokensTrigger or BetaToolUsesTrigger`
16131588
16141589 Condition that triggers the context management strategy
16151590
1616 - `BetaInputTokensTrigger object { type, value }`
1591 - `BetaInputTokensTrigger object`
16171592
16181593 - `type: "input_tokens"`
16191594
1620 - `"input_tokens"`
1621
16221595 - `value: number`
16231596
1624 - `BetaToolUsesTrigger object { type, value }`
1597 minimum: 1
1598
1599 - `BetaToolUsesTrigger object`
16251600
16261601 - `type: "tool_uses"`
16271602
1628 - `"tool_uses"`
1629
16301603 - `value: number`
16311604
1632 - `BetaClearThinking20251015Edit object { type, keep }`
1605 minimum: 1
1606
1607 - `BetaClearThinking20251015Edit object`
16331608
16341609 - `type: "clear_thinking_20251015"`
16351610
1636 - `"clear_thinking_20251015"`
1637
16381611 - `keep: optional BetaThinkingTurns or BetaAllThinkingTurns or "all"`
16391612
16401613 Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
16411614
1642 - `BetaThinkingTurns object { type, value }`
1615 - `BetaThinkingTurns object`
16431616
16441617 - `type: "thinking_turns"`
16451618
1646 - `"thinking_turns"`
1647
16481619 - `value: number`
16491620
1650 - `BetaAllThinkingTurns object { type }`
1621 minimum: 1
1622
1623 - `BetaAllThinkingTurns object`
16511624
16521625 - `type: "all"`
16531626
1654 - `"all"`
1655
16561627 - `"all"`
16571628
1658 - `"all"`
1659
1660 - `BetaCompact20260112Edit object { type, instructions, pause_after_compaction, trigger }`
1629 - `BetaCompact20260112Edit object`
16611630
16621631 Automatically compact older context when reaching the configured trigger threshold.
16631632
16641633 - `type: "compact_20260112"`
1665
1666 - `"compact_20260112"`
16671634
16681635 - `instructions: optional string or null`
16691636
from line 1652
16851652 - `previous_message_id: optional string or null`
16861653
16871654 The `id` (`msg_...`) from this client's previous /v1/messages response. The server compares that request's prompt fingerprint against this one and returns `diagnostics.cache_miss_reason` when the prompt-cache prefix could not be reused. Pass `null` on the first turn to opt in without a prior message to compare.
1655
1656 maxLength: 256
16881657
16891658 - `fallback_credit_token: optional string or BetaFallbackCreditTokenParam or null`
16901659
from line 1680
17111680
17121681 - `string`
17131682
1714 - `BetaFallbackCreditTokenParam object { token, mode }`
1683 - `BetaFallbackCreditTokenParam object`
17151684
17161685 Object form of `fallback_credit_token`: the token plus a redemption
17171686 mode.
from line 1694
17251694
17261695 The opaque `fallback_credit_token` from a prior refusal's `stop_details` — the same string the bare-string form carries.
17271696
1697 maxLength: 2048, minLength: 1
1698
17281699 - `mode: optional "strict" or "best_effort"`
17291700
17301701 How a failing token affects the retry. `strict` (the default, and the bare-string behavior): a failing redemption is a 400 and the retry is not served. `best_effort`: the retry is served either way — a token-layer failure no longer rejects the request; the retry proceeds at normal price and the outcome is reported on the response's `usage.fallback_credit`. Two failures stay hard in both modes: a malformed token, and combining `fallback_credit_token` with `fallbacks`.
from line 1744
17731744
17741745 - `type: "json_schema"`
17751746
1776 - `"json_schema"`
1777
17781747 - `task_budget: optional BetaTokenTaskBudget or null`
17791748
17801749 User-configurable total token budget across contexts.
from line 1752
17831752
17841753 Total token budget across all contexts in the session.
17851754
1755 minimum: 1024
1756
17861757 - `type: "tokens"`
17871758
17881759 The budget type. Currently only 'tokens' is supported.
17891760
1790 - `"tokens"`
1791
17921761 - `remaining: optional number or null`
17931762
17941763 Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.
17951764
1765 minimum: 0
1766
17961767 - `speed: optional "standard" or "fast" or null`
17971768
17981769 Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
from line 1774
18031774
18041775 - `thinking: optional BetaThinkingConfigEnabled or BetaThinkingConfigDisabled or BetaThinkingConfigAdaptive or null`
18051776
1806 - `BetaThinkingConfigEnabled object { budget_tokens, type, display }`
1777 - `BetaThinkingConfigEnabled object`
18071778
18081779 - `budget_tokens: number`
18091780
from line 1784
18131784
18141785 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
18151786
1787 minimum: 1024
1788
18161789 - `type: "enabled"`
18171790
1818 - `"enabled"`
1819
18201791 - `display: optional "summarized" or "omitted" or null`
18211792
18221793 Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
from line 1796
18251796
18261797 - `"omitted"`
18271798
1828 - `BetaThinkingConfigDisabled object { type }`
1799 - `BetaThinkingConfigDisabled object`
18291800
18301801 - `type: "disabled"`
18311802
1832 - `"disabled"`
1833
1834 - `BetaThinkingConfigAdaptive object { type, display }`
1803 - `BetaThinkingConfigAdaptive object`
18351804
18361805 - `type: "adaptive"`
18371806
1838 - `"adaptive"`
1839
18401807 - `display: optional "summarized" or "omitted" or null`
18411808
18421809 Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
from line 1814
18471814
18481815 - `Default = "default"`
18491816
1850 - `"default"`
1851
18521817 - `inference_geo: optional string or null`
18531818
18541819 Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used.
from line 1822
18571822
18581823 MCP servers to be utilized in this request
18591824
1825 maxItems: 20
1826
18601827 - `name: string`
18611828
18621829 - `type: "url"`
18631830
1864 - `"url"`
1865
18661831 - `url: string`
18671832
18681833 - `authorization_token: optional string or null`
from line 1848
18831848
18841849 This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
18851850
1851 maxLength: 512
1852
18861853 - `output_config: optional BetaOutputConfig`
18871854
18881855 Configuration options for the model's output, such as the output format.
18891856
1890 - `output_format: optional BetaJSONOutputFormat or null`
1891
1892 Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
1893
1894 A schema to specify Claude's output format in responses. This parameter will be removed in a future release.
1895
18961857 - `service_tier: optional "auto" or "standard_only"`
18971858
18981859 Determines whether to use priority capacity (if available) or standard capacity for this request.
from line 1898
19371898
19381899 - `text: string`
19391900
1901 minLength: 1
1902
19401903 - `type: "text"`
19411904
19421905 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 1908
19451908
19461909 - `citations: optional array of BetaTextCitationParam or null`
19471910
1948 - `temperature: optional number`
1949
1950 Amount of randomness injected into the response.
1951
1952 Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
1953
1954 Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
1955
19561911 - `thinking: optional BetaThinkingConfigParam`
19571912
19581913 Configuration for enabling Claude's extended thinking.
from line 1916
19611916
19621917 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
19631918
1964 - `BetaThinkingConfigEnabled object { budget_tokens, type, display }`
1965
1966 - `BetaThinkingConfigDisabled object { type }`
1967
1968 - `BetaThinkingConfigAdaptive object { type, display }`
1919 - `BetaThinkingConfigEnabled object`
1920
1921 - `BetaThinkingConfigDisabled object`
1922
1923 - `BetaThinkingConfigAdaptive object`
19691924
19701925 - `tool_choice: optional BetaToolChoice`
19711926
19721927 How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
19731928
1974 - `BetaToolChoiceAuto object { type, disable_parallel_tool_use }`
1929 - `BetaToolChoiceAuto object`
19751930
19761931 The model will automatically decide whether to use tools.
19771932
19781933 - `type: "auto"`
19791934
1980 - `"auto"`
1981
19821935 - `disable_parallel_tool_use: optional boolean`
19831936
19841937 Whether to disable parallel tool use.
19851938
19861939 Defaults to `false`. If set to `true`, the model will output at most one tool use.
19871940
1988 - `BetaToolChoiceAny object { type, disable_parallel_tool_use }`
1941 - `BetaToolChoiceAny object`
19891942
19901943 The model will use any available tools.
19911944
19921945 - `type: "any"`
19931946
1994 - `"any"`
1995
19961947 - `disable_parallel_tool_use: optional boolean`
19971948
19981949 Whether to disable parallel tool use.
19991950
20001951 Defaults to `false`. If set to `true`, the model will output exactly one tool use.
20011952
2002 - `BetaToolChoiceTool object { name, type, disable_parallel_tool_use }`
1953 - `BetaToolChoiceTool object`
20031954
20041955 The model will use the specified tool with `tool_choice.name`.
20051956
from line 1960
20091960
20101961 - `type: "tool"`
20111962
2012 - `"tool"`
2013
20141963 - `disable_parallel_tool_use: optional boolean`
20151964
20161965 Whether to disable parallel tool use.
20171966
20181967 Defaults to `false`. If set to `true`, the model will output exactly one tool use.
20191968
2020 - `BetaToolChoiceNone object { type }`
1969 - `BetaToolChoiceNone object`
20211970
20221971 The model will not be allowed to use tools.
20231972
20241973 - `type: "none"`
2025
2026 - `"none"`
20271974
20281975 - `tools: optional array of BetaToolUnion`
20291976
from line 2036
20892036
20902037 See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
20912038
2092 - `BetaTool object { input_schema, name, allowed_callers, 7 more }`
2093
2094 - `input_schema: object { type, properties, required }`
2039 - `BetaTool object`
2040
2041 - `input_schema: object`
20952042
20962043 [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
20972044
from line 2046
20992046
21002047 - `type: "object"`
21012048
2102 - `"object"`
2103
21042049 - `properties: optional map[unknown] or null`
21052050
21062051 - `required: optional array of string or null`
from line 2056
21112056
21122057 This is how the tool will be called by the model and in `tool_use` blocks.
21132058
2059 maxLength: 128, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,128}$
2060
21142061 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21152062
21162063 - `"direct"`
from line 2094
21472094
21482095 - `type: optional "custom" or null`
21492096
2150 - `"custom"`
2151
2152 - `BetaToolBash20241022 object { name, type, allowed_callers, 4 more }`
2097 - `BetaToolBash20241022 object`
21532098
21542099 - `name: "bash"`
21552100
from line 2102
21572102
21582103 This is how the tool will be called by the model and in `tool_use` blocks.
21592104
2160 - `"bash"`
2161
21622105 - `type: "bash_20241022"`
21632106
2164 - `"bash_20241022"`
2165
21662107 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21672108
21682109 - `"direct"`
from line 2128
21872128
21882129 When true, guarantees schema validation on tool names and inputs
21892130
2190 - `BetaToolBash20250124 object { name, type, allowed_callers, 4 more }`
2131 - `BetaToolBash20250124 object`
21912132
21922133 - `name: "bash"`
21932134
from line 2136
21952136
21962137 This is how the tool will be called by the model and in `tool_use` blocks.
21972138
2198 - `"bash"`
2199
22002139 - `type: "bash_20250124"`
22012140
2202 - `"bash_20250124"`
2203
22042141 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
22052142
22062143 - `"direct"`
from line 2162
22252162
22262163 When true, guarantees schema validation on tool names and inputs
22272164
2228 - `BetaCodeExecutionTool20250522 object { name, type, allowed_callers, 3 more }`
2165 - `BetaCodeExecutionTool20250522 object`
22292166
22302167 - `name: "code_execution"`
22312168
from line 2170
22332170
22342171 This is how the tool will be called by the model and in `tool_use` blocks.
22352172
2236 - `"code_execution"`
2237
22382173 - `type: "code_execution_20250522"`
22392174
2240 - `"code_execution_20250522"`
2241
22422175 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
22432176
22442177 - `"direct"`
from line 2194
22612194
22622195 When true, guarantees schema validation on tool names and inputs
22632196
2264 - `BetaCodeExecutionTool20250825 object { name, type, allowed_callers, 3 more }`
2197 - `BetaCodeExecutionTool20250825 object`
22652198
22662199 - `name: "code_execution"`
22672200
from line 2202
22692202
22702203 This is how the tool will be called by the model and in `tool_use` blocks.
22712204
2272 - `"code_execution"`
2273
22742205 - `type: "code_execution_20250825"`
22752206
2207 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2208
2209 - `"direct"`
2210
22762211 - `"code_execution_20250825"`
22772212
2213 - `"code_execution_20260120"`
2214
2215 - `"code_execution_20260521"`
2216
2217 - `cache_control: optional BetaCacheControlEphemeral or null`
2218
2219 Create a cache control breakpoint at this content block.
2220
2221 - `defer_loading: optional boolean`
2222
2223 If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
2224
2225 - `strict: optional boolean`
2226
2227 When true, guarantees schema validation on tool names and inputs
2228
2229 - `BetaCodeExecutionTool20260120 object`
2230
2231 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
2232
2233 - `name: "code_execution"`
2234
2235 Name of the tool.
2236
2237 This is how the tool will be called by the model and in `tool_use` blocks.
2238
2239 - `type: "code_execution_20260120"`
2240
22782241 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
22792242
22802243 - `"direct"`
from line 2260
22972260
22982261 When true, guarantees schema validation on tool names and inputs
22992262
2300 - `BetaCodeExecutionTool20260120 object { name, type, allowed_callers, 3 more }`
2301
2302 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
2263 - `BetaCodeExecutionTool20260521 object`
2264
2265 Code execution tool with REPL state persistence.
23032266
23042267 - `name: "code_execution"`
23052268
from line 2270
23072270
23082271 This is how the tool will be called by the model and in `tool_use` blocks.
23092272
2310 - `"code_execution"`
2311
2312 - `type: "code_execution_20260120"`
2273 - `type: "code_execution_20260521"`
2274
2275 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2276
2277 - `"direct"`
2278
2279 - `"code_execution_20250825"`
23132280
23142281 - `"code_execution_20260120"`
23152282
2316 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2317
2318 - `"direct"`
2319
2320 - `"code_execution_20250825"`
2321
2322 - `"code_execution_20260120"`
2323
23242283 - `"code_execution_20260521"`
23252284
23262285 - `cache_control: optional BetaCacheControlEphemeral or null`
from line 2294
23352294
23362295 When true, guarantees schema validation on tool names and inputs
23372296
2338 - `BetaCodeExecutionTool20260521 object { name, type, allowed_callers, 3 more }`
2339
2340 Code execution tool with REPL state persistence.
2341
2342 - `name: "code_execution"`
2343
2344 Name of the tool.
2345
2346 This is how the tool will be called by the model and in `tool_use` blocks.
2347
2348 - `"code_execution"`
2349
2350 - `type: "code_execution_20260521"`
2351
2352 - `"code_execution_20260521"`
2353
2354 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
2355
2356 - `"direct"`
2357
2358 - `"code_execution_20250825"`
2359
2360 - `"code_execution_20260120"`
2361
2362 - `"code_execution_20260521"`
2363
2364 - `cache_control: optional BetaCacheControlEphemeral or null`
2365
2366 Create a cache control breakpoint at this content block.
2367
2368 - `defer_loading: optional boolean`
2369
2370 If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
2371
2372 - `strict: optional boolean`
2373
2374 When true, guarantees schema validation on tool names and inputs
2375
2376 - `BetaBrowserToolset20260801 object { type, allowed_callers, cache_control, configs }`
2297 - `BetaBrowserToolset20260801 object`
23772298
23782299 The browser toolset: a single `tools[]` entry (carrying no
23792300 `name`) that declares the browser tool family. The model is served
from line 2302
23812302 from its schema.
23822303
23832304 - `type: "browser_toolset_20260801"`
2384
2385 - `"browser_toolset_20260801"`
23862305
23872306 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
23882307
from line 2698
27792698
27802699 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
27812700
2782 - `BetaToolComputerUse20241022 object { display_height_px, display_width_px, name, 7 more }`
2701 - `BetaToolComputerUse20241022 object`
27832702
27842703 - `display_height_px: number`
27852704
27862705 The height of the display in pixels.
27872706
2707 minimum: 1
2708
27882709 - `display_width_px: number`
27892710
27902711 The width of the display in pixels.
27912712
2713 minimum: 1
2714
27922715 - `name: "computer"`
27932716
27942717 Name of the tool.
27952718
27962719 This is how the tool will be called by the model and in `tool_use` blocks.
27972720
2798 - `"computer"`
2799
28002721 - `type: "computer_20241022"`
28012722
2802 - `"computer_20241022"`
2803
28042723 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28052724
28062725 - `"direct"`
from line 2742
28232742
28242743 The X11 display number (e.g. 0, 1) for the display.
28252744
2745 minimum: 0
2746
28262747 - `input_examples: optional array of map[unknown]`
28272748
28282749 - `strict: optional boolean`
28292750
28302751 When true, guarantees schema validation on tool names and inputs
28312752
2832 - `BetaMemoryTool20250818 object { name, type, allowed_callers, 4 more }`
2753 - `BetaMemoryTool20250818 object`
28332754
28342755 - `name: "memory"`
28352756
from line 2758
28372758
28382759 This is how the tool will be called by the model and in `tool_use` blocks.
28392760
2840 - `"memory"`
2841
28422761 - `type: "memory_20250818"`
28432762
2844 - `"memory_20250818"`
2845
28462763 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28472764
28482765 - `"direct"`
from line 2784
28672784
28682785 When true, guarantees schema validation on tool names and inputs
28692786
2870 - `BetaToolComputerUse20250124 object { display_height_px, display_width_px, name, 7 more }`
2787 - `BetaToolComputerUse20250124 object`
28712788
28722789 - `display_height_px: number`
28732790
28742791 The height of the display in pixels.
28752792
2793 minimum: 1
2794
28762795 - `display_width_px: number`
28772796
28782797 The width of the display in pixels.
28792798
2799 minimum: 1
2800
28802801 - `name: "computer"`
28812802
28822803 Name of the tool.
28832804
28842805 This is how the tool will be called by the model and in `tool_use` blocks.
28852806
2886 - `"computer"`
2887
28882807 - `type: "computer_20250124"`
28892808
2890 - `"computer_20250124"`
2891
28922809 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28932810
28942811 - `"direct"`
from line 2828
29112828
29122829 The X11 display number (e.g. 0, 1) for the display.
29132830
2831 minimum: 0
2832
29142833 - `input_examples: optional array of map[unknown]`
29152834
29162835 - `strict: optional boolean`
29172836
29182837 When true, guarantees schema validation on tool names and inputs
29192838
2920 - `BetaToolTextEditor20241022 object { name, type, allowed_callers, 4 more }`
2839 - `BetaToolTextEditor20241022 object`
29212840
29222841 - `name: "str_replace_editor"`
29232842
from line 2844
29252844
29262845 This is how the tool will be called by the model and in `tool_use` blocks.
29272846
2928 - `"str_replace_editor"`
2929
29302847 - `type: "text_editor_20241022"`
29312848
2932 - `"text_editor_20241022"`
2933
29342849 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
29352850
29362851 - `"direct"`
from line 2870
29552870
29562871 When true, guarantees schema validation on tool names and inputs
29572872
2958 - `BetaToolComputerUse20251124 object { display_height_px, display_width_px, name, 8 more }`
2873 - `BetaToolComputerUse20251124 object`
29592874
29602875 - `display_height_px: number`
29612876
29622877 The height of the display in pixels.
29632878
2879 minimum: 1
2880
29642881 - `display_width_px: number`
29652882
29662883 The width of the display in pixels.
29672884
2885 minimum: 1
2886
29682887 - `name: "computer"`
29692888
29702889 Name of the tool.
29712890
29722891 This is how the tool will be called by the model and in `tool_use` blocks.
29732892
2974 - `"computer"`
2975
29762893 - `type: "computer_20251124"`
29772894
2978 - `"computer_20251124"`
2979
29802895 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
29812896
29822897 - `"direct"`
from line 2914
29992914
30002915 The X11 display number (e.g. 0, 1) for the display.
30012916
2917 minimum: 0
2918
30022919 - `enable_zoom: optional boolean`
30032920
30042921 Whether to enable an action to take a zoomed-in screenshot of the screen.
from line 2926
30092926
30102927 When true, guarantees schema validation on tool names and inputs
30112928
3012 - `BetaComputerToolset20260801 object { type, allowed_callers, cache_control, configs }`
2929 - `BetaComputerToolset20260801 object`
30132930
30142931 The computer toolset: a single `tools[]` entry (carrying no
30152932 `name`) that declares the computer tool family. The model is
from line 2939
30222939
30232940 - `type: "computer_toolset_20260801"`
30242941
3025 - `"computer_toolset_20260801"`
3026
30272942 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
30282943
30292944 - `"direct"`
from line 3166
32513166
32523167 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
32533168
3254 - `BetaToolTextEditor20250124 object { name, type, allowed_callers, 4 more }`
3169 - `BetaToolTextEditor20250124 object`
32553170
32563171 - `name: "str_replace_editor"`
32573172
from line 3174
32593174
32603175 This is how the tool will be called by the model and in `tool_use` blocks.
32613176
3262 - `"str_replace_editor"`
3263
32643177 - `type: "text_editor_20250124"`
32653178
3266 - `"text_editor_20250124"`
3267
32683179 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
32693180
32703181 - `"direct"`
from line 3200
32893200
32903201 When true, guarantees schema validation on tool names and inputs
32913202
3292 - `BetaToolTextEditor20250429 object { name, type, allowed_callers, 4 more }`
3203 - `BetaToolTextEditor20250429 object`
32933204
32943205 - `name: "str_replace_based_edit_tool"`
32953206
from line 3208
32973208
32983209 This is how the tool will be called by the model and in `tool_use` blocks.
32993210
3300 - `"str_replace_based_edit_tool"`
3301
33023211 - `type: "text_editor_20250429"`
33033212
3304 - `"text_editor_20250429"`
3305
33063213 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33073214
33083215 - `"direct"`
from line 3234
33273234
33283235 When true, guarantees schema validation on tool names and inputs
33293236
3330 - `BetaToolTextEditor20250728 object { name, type, allowed_callers, 5 more }`
3237 - `BetaToolTextEditor20250728 object`
33313238
33323239 - `name: "str_replace_based_edit_tool"`
33333240
from line 3242
33353242
33363243 This is how the tool will be called by the model and in `tool_use` blocks.
33373244
3338 - `"str_replace_based_edit_tool"`
3339
33403245 - `type: "text_editor_20250728"`
33413246
3342 - `"text_editor_20250728"`
3343
33443247 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33453248
33463249 - `"direct"`
from line 3268
33653268
33663269 Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
33673270
3271 minimum: 1
3272
33683273 - `strict: optional boolean`
33693274
33703275 When true, guarantees schema validation on tool names and inputs
33713276
3372 - `BetaWebSearchTool20250305 object { name, type, allowed_callers, 7 more }`
3277 - `BetaWebSearchTool20250305 object`
33733278
33743279 - `name: "web_search"`
33753280
from line 3282
33773282
33783283 This is how the tool will be called by the model and in `tool_use` blocks.
33793284
3380 - `"web_search"`
3381
33823285 - `type: "web_search_20250305"`
33833286
3384 - `"web_search_20250305"`
3385
33863287 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
33873288
33883289 - `"direct"`
from line 3314
34133314
34143315 Maximum number of times the tool can be used in the API request.
34153316
3317 exclusiveMinimum: 0
3318
34163319 - `strict: optional boolean`
34173320
34183321 When true, guarantees schema validation on tool names and inputs
from line 3326
34233326
34243327 - `type: "approximate"`
34253328
3426 - `"approximate"`
3427
34283329 - `city: optional string or null`
34293330
34303331 The city of the user.
34313332
3333 maxLength: 255, minLength: 1
3334
34323335 - `country: optional string or null`
34333336
34343337 The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
34353338
3339 maxLength: 2, minLength: 2
3340
34363341 - `region: optional string or null`
34373342
34383343 The region of the user.
34393344
3345 maxLength: 255, minLength: 1
3346
34403347 - `timezone: optional string or null`
34413348
34423349 The [IANA timezone](https://nodatime.org/TimeZones) of the user.
34433350
3444 - `BetaWebFetchTool20250910 object { name, type, allowed_callers, 8 more }`
3351 maxLength: 255, minLength: 1
3352
3353 - `BetaWebFetchTool20250910 object`
34453354
34463355 - `name: "web_fetch"`
34473356
from line 3358
34493358
34503359 This is how the tool will be called by the model and in `tool_use` blocks.
34513360
3452 - `"web_fetch"`
3453
34543361 - `type: "web_fetch_20250910"`
34553362
3456 - `"web_fetch_20250910"`
3457
34583363 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
34593364
34603365 - `"direct"`
from line 3394
34893394
34903395 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
34913396
3397 exclusiveMinimum: 0
3398
34923399 - `max_uses: optional number or null`
34933400
34943401 Maximum number of times the tool can be used in the API request.
34953402
3403 exclusiveMinimum: 0
3404
34963405 - `strict: optional boolean`
34973406
34983407 When true, guarantees schema validation on tool names and inputs
34993408
3500 - `BetaWebSearchTool20260209 object { name, type, allowed_callers, 7 more }`
3409 - `BetaWebSearchTool20260209 object`
35013410
35023411 - `name: "web_search"`
35033412
from line 3414
35053414
35063415 This is how the tool will be called by the model and in `tool_use` blocks.
35073416
3508 - `"web_search"`
3509
35103417 - `type: "web_search_20260209"`
35113418
3512 - `"web_search_20260209"`
3513
35143419 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
35153420
35163421 - `"direct"`
from line 3446
35413446
35423447 Maximum number of times the tool can be used in the API request.
35433448
3449 exclusiveMinimum: 0
3450
35443451 - `strict: optional boolean`
35453452
35463453 When true, guarantees schema validation on tool names and inputs
from line 3456
35493456
35503457 Parameters for the user's location. Used to provide more relevant search results.
35513458
3552 - `BetaWebFetchTool20260209 object { name, type, allowed_callers, 8 more }`
3459 - `BetaWebFetchTool20260209 object`
35533460
35543461 - `name: "web_fetch"`
35553462
from line 3464
35573464
35583465 This is how the tool will be called by the model and in `tool_use` blocks.
35593466
3560 - `"web_fetch"`
3561
35623467 - `type: "web_fetch_20260209"`
35633468
3564 - `"web_fetch_20260209"`
3565
35663469 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
35673470
35683471 - `"direct"`
from line 3500
35973500
35983501 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
35993502
3503 exclusiveMinimum: 0
3504
36003505 - `max_uses: optional number or null`
36013506
36023507 Maximum number of times the tool can be used in the API request.
36033508
3509 exclusiveMinimum: 0
3510
36043511 - `strict: optional boolean`
36053512
36063513 When true, guarantees schema validation on tool names and inputs
36073514
3608 - `BetaWebFetchTool20260309 object { name, type, allowed_callers, 9 more }`
3515 - `BetaWebFetchTool20260309 object`
36093516
36103517 Web fetch tool with use_cache parameter for bypassing cached content.
36113518
from line 3522
36153522
36163523 This is how the tool will be called by the model and in `tool_use` blocks.
36173524
3618 - `"web_fetch"`
3619
36203525 - `type: "web_fetch_20260309"`
36213526
3622 - `"web_fetch_20260309"`
3623
36243527 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
36253528
36263529 - `"direct"`
from line 3558
36553558
36563559 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
36573560
3561 exclusiveMinimum: 0
3562
36583563 - `max_uses: optional number or null`
36593564
36603565 Maximum number of times the tool can be used in the API request.
36613566
3567 exclusiveMinimum: 0
3568
36623569 - `strict: optional boolean`
36633570
36643571 When true, guarantees schema validation on tool names and inputs
from line 3574
36673574
36683575 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
36693576
3670 - `BetaWebSearchTool20260318 object { name, type, allowed_callers, 8 more }`
3577 - `BetaWebSearchTool20260318 object`
36713578
36723579 - `name: "web_search"`
36733580
from line 3582
36753582
36763583 This is how the tool will be called by the model and in `tool_use` blocks.
36773584
3678 - `"web_search"`
3679
36803585 - `type: "web_search_20260318"`
36813586
3682 - `"web_search_20260318"`
3683
36843587 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
36853588
36863589 - `"direct"`
from line 3614
37113614
37123615 Maximum number of times the tool can be used in the API request.
37133616
3617 exclusiveMinimum: 0
3618
37143619 - `response_inclusion: optional "full" or "excluded"`
37153620
37163621 How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
from line 3632
37273632
37283633 Parameters for the user's location. Used to provide more relevant search results.
37293634
3730 - `BetaWebFetchTool20260318 object { name, type, allowed_callers, 10 more }`
3635 - `BetaWebFetchTool20260318 object`
37313636
37323637 - `name: "web_fetch"`
37333638
from line 3640
37353640
37363641 This is how the tool will be called by the model and in `tool_use` blocks.
37373642
3738 - `"web_fetch"`
3739
37403643 - `type: "web_fetch_20260318"`
37413644
3742 - `"web_fetch_20260318"`
3743
37443645 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
37453646
37463647 - `"direct"`
from line 3676
37753676
37763677 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
37773678
3679 exclusiveMinimum: 0
3680
37783681 - `max_uses: optional number or null`
37793682
37803683 Maximum number of times the tool can be used in the API request.
37813684
3685 exclusiveMinimum: 0
3686
37823687 - `response_inclusion: optional "full" or "excluded"`
37833688
37843689 How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
from line 3700
37953700
37963701 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
37973702
3798 - `BetaAdvisorTool20260301 object { model, name, type, 7 more }`
3703 - `BetaAdvisorTool20260301 object`
37993704
38003705 - `model: Model`
38013706
from line 3714
38093714
38103715 This is how the tool will be called by the model and in `tool_use` blocks.
38113716
3812 - `"advisor"`
3813
38143717 - `type: "advisor_20260301"`
38153718
3816 - `"advisor_20260301"`
3817
38183719 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
38193720
38203721 - `"direct"`
from line 3742
38413742
38423743 Bounds the advisor's total output (thinking + text) per call. When the advisor hits this cap, the returned advisor_result or advisor_redacted_result block carries stop_reason='max_tokens', and a truncation note is appended to the advice text the worker model sees (inside the encrypted blob in redacted mode). When set, the server also emits a remaining-tokens budget block in the advisor's prompt so the advisor self-shapes toward the cap. When omitted, the advisor model's default output cap applies and no budget block is emitted.
38433744
3745 minimum: 1024
3746
38443747 - `max_uses: optional number or null`
38453748
38463749 Maximum number of times the tool can be used in the API request.
38473750
3751 exclusiveMinimum: 0
3752
38483753 - `strict: optional boolean`
38493754
38503755 When true, guarantees schema validation on tool names and inputs
38513756
3852 - `BetaToolSearchToolBm25_20251119 object { name, type, allowed_callers, 3 more }`
3757 - `BetaToolSearchToolBm25_20251119 object`
38533758
38543759 - `name: "tool_search_tool_bm25"`
38553760
from line 3762
38573762
38583763 This is how the tool will be called by the model and in `tool_use` blocks.
38593764
3765 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
3766
3767 - `"tool_search_tool_bm25_20251119"`
3768
38603769 - `"tool_search_tool_bm25"`
38613770
3862 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
3863
3864 - `"tool_search_tool_bm25_20251119"`
3865
3866 - `"tool_search_tool_bm25"`
3867
38683771 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
38693772
38703773 - `"direct"`
from line 3790
38873790
38883791 When true, guarantees schema validation on tool names and inputs
38893792
3890 - `BetaToolSearchToolRegex20251119 object { name, type, allowed_callers, 3 more }`
3793 - `BetaToolSearchToolRegex20251119 object`
38913794
38923795 - `name: "tool_search_tool_regex"`
38933796
from line 3798
38953798
38963799 This is how the tool will be called by the model and in `tool_use` blocks.
38973800
3801 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
3802
3803 - `"tool_search_tool_regex_20251119"`
3804
38983805 - `"tool_search_tool_regex"`
38993806
3900 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
3901
3902 - `"tool_search_tool_regex_20251119"`
3903
3904 - `"tool_search_tool_regex"`
3905
39063807 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
39073808
39083809 - `"direct"`
from line 3826
39253826
39263827 When true, guarantees schema validation on tool names and inputs
39273828
3928 - `BetaMCPToolset object { mcp_server_name, type, cache_control, 2 more }`
3829 - `BetaMCPToolset object`
39293830
39303831 Configuration for a group of tools from an MCP server.
39313832
from line 3837
39363837
39373838 Name of the MCP server to configure tools for
39383839
3840 maxLength: 255, minLength: 1
3841
39393842 - `type: "mcp_toolset"`
39403843
3941 - `"mcp_toolset"`
3942
39433844 - `cache_control: optional BetaCacheControlEphemeral or null`
39443845
39453846 Create a cache control breakpoint at this content block.
from line 3861
39603861
39613862 - `enabled: optional boolean`
39623863
3864 - `output_format: optional BetaJSONOutputFormat or null`
3865
3866 **Deprecated**
3867
3868 Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
3869
3870 A schema to specify Claude's output format in responses. This parameter will be removed in a future release.
3871
3872 - `temperature: optional number`
3873
3874 **Deprecated**: Deprecated. Models released after Claude Opus 4.6 do not support setting temperature. A value of 1.0 of will be accepted for backwards compatibility, all other values will be rejected with a 400 error.
3875
3876 Amount of randomness injected into the response.
3877
3878 Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
3879
3880 Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
3881
3882 maximum: 1, minimum: 0
3883
39633884 - `top_k: optional number`
39643885
3886 **Deprecated**: Deprecated. Models released after Claude Opus 4.6 do not accept top_k; any value will be rejected with a 400 error.
3887
39653888 Only sample from the top K options for each subsequent token.
39663889
39673890 Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
39683891
39693892 Recommended for advanced use cases only.
39703893
3894 minimum: 0
3895
39713896 - `top_p: optional number`
39723897
3898 **Deprecated**: Deprecated. Models released after Claude Opus 4.6 do not support setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all other values will be rejected with a 400 error.
3899
39733900 Use nucleus sampling.
39743901
39753902 In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.
39763903
39773904 Recommended for advanced use cases only.
39783905
3906 maximum: 1, minimum: 0
3907
39793908### Returns
39803909
3981- `BetaMessageBatch object { id, archived_at, cancel_initiated_at, 7 more }`
3910- `BetaMessageBatch object`
39823911
39833912 - `id: string`
39843913
from line 3919
39903919
39913920 RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
39923921
3922 format: date-time
3923
39933924 - `cancel_initiated_at: string or null`
39943925
39953926 RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
39963927
3928 format: date-time
3929
39973930 - `created_at: string`
39983931
39993932 RFC 3339 datetime string representing the time at which the Message Batch was created.
40003933
3934 format: date-time
3935
40013936 - `ended_at: string or null`
40023937
40033938 RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
40043939
40053940 Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
40063941
3942 format: date-time
3943
40073944 - `expires_at: string`
40083945
40093946 RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
40103947
3948 format: date-time
3949
40113950 - `processing_status: "in_progress" or "canceling" or "ended"`
40123951
40133952 Processing status of the Message Batch.
from line 3969
40303969
40313970 This is zero until processing of the entire Message Batch has ended.
40323971
3972 default: 0
3973
40333974 - `errored: number`
40343975
40353976 Number of requests in the Message Batch that encountered an error.
40363977
40373978 This is zero until processing of the entire Message Batch has ended.
40383979
3980 default: 0
3981
40393982 - `expired: number`
40403983
40413984 Number of requests in the Message Batch that have expired.
40423985
40433986 This is zero until processing of the entire Message Batch has ended.
40443987
3988 default: 0
3989
40453990 - `processing: number`
40463991
40473992 Number of requests in the Message Batch that are processing.
40483993
3994 default: 0
3995
40493996 - `succeeded: number`
40503997
40513998 Number of requests in the Message Batch that have completed successfully.
40523999
40534000 This is zero until processing of the entire Message Batch has ended.
40544001
4002 default: 0
4003
40554004 - `results_url: string or null`
40564005
40574006 URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
from line 4013
40644013
40654014 For Message Batches, this is always `"message_batch"`.
40664015
4067 - `"message_batch"`
4016 default: message_batch
40684017
40694018### Example
40704019
4071```http
4020```bash
40724021curl https://api.anthropic.com/v1/messages/batches \
40734022 -H 'Content-Type: application/json' \
40744023 -H 'anthropic-version: 2023-06-01' \
from line 4042
40934042 }'
40944043```
40954044
4096#### Response
4045#### Response (200)
40974046
40984047```json
40994048{
from line 4067
41184067
41194068## Retrieve a Message Batch
41204069
4121**get** `/v1/messages/batches/{message_batch_id}`
4070**GET** `/v1/messages/batches/{message_batch_id}`
41224071
41234072This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response.
41244073
41254074Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
41264075
4127### Path Parameters
4076### Path parameters
41284077
41294078- `message_batch_id: string`
41304079
41314080 ID of the Message Batch.
41324081
4133### Header Parameters
4082### Headers
41344083
41354084- `"anthropic-beta": optional array of AnthropicBeta`
41364085
from line 4159
42104159
42114160### Returns
42124161
4213- `BetaMessageBatch object { id, archived_at, cancel_initiated_at, 7 more }`
4162- `BetaMessageBatch object`
42144163
42154164 - `id: string`
42164165
from line 4171
42224171
42234172 RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
42244173
4174 format: date-time
4175
42254176 - `cancel_initiated_at: string or null`
42264177
42274178 RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
42284179
4180 format: date-time
4181
42294182 - `created_at: string`
42304183
42314184 RFC 3339 datetime string representing the time at which the Message Batch was created.
42324185
4186 format: date-time
4187
42334188 - `ended_at: string or null`
42344189
42354190 RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
42364191
42374192 Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
42384193
4194 format: date-time
4195
42394196 - `expires_at: string`
42404197
42414198 RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
42424199
4200 format: date-time
4201
42434202 - `processing_status: "in_progress" or "canceling" or "ended"`
42444203
42454204 Processing status of the Message Batch.
from line 4221
42624221
42634222 This is zero until processing of the entire Message Batch has ended.
42644223
4224 default: 0
4225
42654226 - `errored: number`
42664227
42674228 Number of requests in the Message Batch that encountered an error.
42684229
42694230 This is zero until processing of the entire Message Batch has ended.
42704231
4232 default: 0
4233
42714234 - `expired: number`
42724235
42734236 Number of requests in the Message Batch that have expired.
42744237
42754238 This is zero until processing of the entire Message Batch has ended.
42764239
4240 default: 0
4241
42774242 - `processing: number`
42784243
42794244 Number of requests in the Message Batch that are processing.
42804245
4246 default: 0
4247
42814248 - `succeeded: number`
42824249
42834250 Number of requests in the Message Batch that have completed successfully.
42844251
42854252 This is zero until processing of the entire Message Batch has ended.
42864253
4254 default: 0
4255
42874256 - `results_url: string or null`
42884257
42894258 URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
from line 4265
42964265
42974266 For Message Batches, this is always `"message_batch"`.
42984267
4299 - `"message_batch"`
4268 default: message_batch
43004269
43014270### Example
43024271
4303```http
4272```bash
43044273curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID \
43054274 -H 'anthropic-version: 2023-06-01' \
43064275 -H 'anthropic-beta: message-batches-2024-09-24' \
43074276 -H "X-Api-Key: $ANTHROPIC_API_KEY"
43084277```
43094278
4310#### Response
4279#### Response (200)
43114280
43124281```json
43134282{
from line 4301
43324301
43334302## List Message Batches
43344303
4335**get** `/v1/messages/batches`
4304**GET** `/v1/messages/batches`
43364305
43374306List all Message Batches within a Workspace. Most recently created batches are returned first.
43384307
43394308Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
43404309
4341### Query Parameters
4310### Query parameters
43424311
43434312- `after_id: optional string`
43444313
from line 4323
43544323
43554324 Defaults to `20`. Ranges from `1` to `1000`.
43564325
4357### Header Parameters
4326 default: 20, maximum: 1000, minimum: 1
4327
4328### Headers
43584329
43594330- `"anthropic-beta": optional array of AnthropicBeta`
43604331
from line 4417
44464417
44474418 RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
44484419
4420 format: date-time
4421
44494422 - `cancel_initiated_at: string or null`
44504423
44514424 RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
44524425
4426 format: date-time
4427
44534428 - `created_at: string`
44544429
44554430 RFC 3339 datetime string representing the time at which the Message Batch was created.
44564431
4432 format: date-time
4433
44574434 - `ended_at: string or null`
44584435
44594436 RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
44604437
44614438 Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
44624439
4440 format: date-time
4441
44634442 - `expires_at: string`
44644443
44654444 RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
44664445
4446 format: date-time
4447
44674448 - `processing_status: "in_progress" or "canceling" or "ended"`
44684449
44694450 Processing status of the Message Batch.
from line 4467
44864467
44874468 This is zero until processing of the entire Message Batch has ended.
44884469
4470 default: 0
4471
44894472 - `errored: number`
44904473
44914474 Number of requests in the Message Batch that encountered an error.
44924475
44934476 This is zero until processing of the entire Message Batch has ended.
44944477
4478 default: 0
4479
44954480 - `expired: number`
44964481
44974482 Number of requests in the Message Batch that have expired.
44984483
44994484 This is zero until processing of the entire Message Batch has ended.
45004485
4486 default: 0
4487
45014488 - `processing: number`
45024489
45034490 Number of requests in the Message Batch that are processing.
45044491
4492 default: 0
4493
45054494 - `succeeded: number`
45064495
45074496 Number of requests in the Message Batch that have completed successfully.
45084497
45094498 This is zero until processing of the entire Message Batch has ended.
45104499
4500 default: 0
4501
45114502 - `results_url: string or null`
45124503
45134504 URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
from line 4511
45204511
45214512 For Message Batches, this is always `"message_batch"`.
45224513
4523 - `"message_batch"`
4514 default: message_batch
45244515
45254516- `first_id: string or null`
45264517
from line 4527
45364527
45374528### Example
45384529
4539```http
4530```bash
45404531curl https://api.anthropic.com/v1/messages/batches \
45414532 -H 'anthropic-version: 2023-06-01' \
45424533 -H 'anthropic-beta: message-batches-2024-09-24' \
45434534 -H "X-Api-Key: $ANTHROPIC_API_KEY"
45444535```
45454536
4546#### Response
4537#### Response (200)
45474538
45484539```json
45494540{
from line 4566
45754566
45764567## Cancel a Message Batch
45774568
4578**post** `/v1/messages/batches/{message_batch_id}/cancel`
4569**POST** `/v1/messages/batches/{message_batch_id}/cancel`
45794570
45804571Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
45814572
from line 4574
45834574
45844575Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
45854576
4586### Path Parameters
4577### Path parameters
45874578
45884579- `message_batch_id: string`
45894580
45904581 ID of the Message Batch.
45914582
4592### Header Parameters
4583### Headers
45934584
45944585- `"anthropic-beta": optional array of AnthropicBeta`
45954586
from line 4660
46694660
46704661### Returns
46714662
4672- `BetaMessageBatch object { id, archived_at, cancel_initiated_at, 7 more }`
4663- `BetaMessageBatch object`
46734664
46744665 - `id: string`
46754666
from line 4672
46814672
46824673 RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
46834674
4675 format: date-time
4676
46844677 - `cancel_initiated_at: string or null`
46854678
46864679 RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
46874680
4681 format: date-time
4682
46884683 - `created_at: string`
46894684
46904685 RFC 3339 datetime string representing the time at which the Message Batch was created.
46914686
4687 format: date-time
4688
46924689 - `ended_at: string or null`
46934690
46944691 RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
46954692
46964693 Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
46974694
4695 format: date-time
4696
46984697 - `expires_at: string`
46994698
47004699 RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
47014700
4701 format: date-time
4702
47024703 - `processing_status: "in_progress" or "canceling" or "ended"`
47034704
47044705 Processing status of the Message Batch.
from line 4722
47214722
47224723 This is zero until processing of the entire Message Batch has ended.
47234724
4725 default: 0
4726
47244727 - `errored: number`
47254728
47264729 Number of requests in the Message Batch that encountered an error.
47274730
47284731 This is zero until processing of the entire Message Batch has ended.
47294732
4733 default: 0
4734
47304735 - `expired: number`
47314736
47324737 Number of requests in the Message Batch that have expired.
47334738
47344739 This is zero until processing of the entire Message Batch has ended.
47354740
4741 default: 0
4742
47364743 - `processing: number`
47374744
47384745 Number of requests in the Message Batch that are processing.
47394746
4747 default: 0
4748
47404749 - `succeeded: number`
47414750
47424751 Number of requests in the Message Batch that have completed successfully.
47434752
47444753 This is zero until processing of the entire Message Batch has ended.
47454754
4755 default: 0
4756
47464757 - `results_url: string or null`
47474758
47484759 URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
from line 4766
47554766
47564767 For Message Batches, this is always `"message_batch"`.
47574768
4758 - `"message_batch"`
4769 default: message_batch
47594770
47604771### Example
47614772
4762```http
4773```bash
47634774curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/cancel \
47644775 -X POST \
47654776 -H 'anthropic-version: 2023-06-01' \
from line 4778
47674778 -H "X-Api-Key: $ANTHROPIC_API_KEY"
47684779```
47694780
4770#### Response
4781#### Response (200)
47714782
47724783```json
47734784{
from line 4803
47924803
47934804## Delete a Message Batch
47944805
4795**delete** `/v1/messages/batches/{message_batch_id}`
4806**DELETE** `/v1/messages/batches/{message_batch_id}`
47964807
47974808Delete a Message Batch.
47984809
from line 4811
48004811
48014812Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
48024813
4803### Path Parameters
4814### Path parameters
48044815
48054816- `message_batch_id: string`
48064817
48074818 ID of the Message Batch.
48084819
4809### Header Parameters
4820### Headers
48104821
48114822- `"anthropic-beta": optional array of AnthropicBeta`
48124823
from line 4897
48864897
48874898### Returns
48884899
4889- `BetaDeletedMessageBatch object { id, type }`
4900- `BetaDeletedMessageBatch object`
48904901
48914902 - `id: string`
48924903
from line 4909
48984909
48994910 For Message Batches, this is always `"message_batch_deleted"`.
49004911
4901 - `"message_batch_deleted"`
4912 default: message_batch_deleted
49024913
49034914### Example
49044915
4905```http
4916```bash
49064917curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID \
49074918 -X DELETE \
49084919 -H 'anthropic-version: 2023-06-01' \
from line 4921
49104921 -H "X-Api-Key: $ANTHROPIC_API_KEY"
49114922```
49124923
4913#### Response
4924#### Response (200)
49144925
49154926```json
49164927{
from line 4932
49214932
49224933## Retrieve Message Batch results
49234934
4924**get** `/v1/messages/batches/{message_batch_id}/results`
4935**GET** `/v1/messages/batches/{message_batch_id}/results`
49254936
49264937Streams the results of a Message Batch as a `.jsonl` file.
49274938
from line 4940
49294940
49304941Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
49314942
4932### Path Parameters
4943### Path parameters
49334944
49344945- `message_batch_id: string`
49354946
49364947 ID of the Message Batch.
49374948
4938### Header Parameters
4949### Headers
49394950
49404951- `"anthropic-beta": optional array of AnthropicBeta`
49414952
from line 5026
50155026
50165027### Returns
50175028
5018- `BetaMessageBatchIndividualResponse object { custom_id, result }`
5029- `BetaMessageBatchIndividualResponse object`
50195030
50205031 This is a single line in the response `.jsonl` file and does not represent the response as a whole.
50215032
from line 5042
50315042
50325043 Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
50335044
5034 - `BetaMessageBatchSucceededResult object { message, type }`
5045 - `BetaMessageBatchSucceededResult object`
50355046
50365047 - `message: BetaMessage`
50375048
from line 5064
50535064
50545065 The time at which the container will expire.
50555066
5067 format: date-time
5068
50565069 - `skills: array of BetaSkill or null`
50575070
50585071 Skills loaded in the container
from line 5074
50615074
50625075 Skill ID
50635076
5077 maxLength: 64, minLength: 1
5078
50645079 - `type: "anthropic" or "custom"`
50655080
50665081 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 5087
50725087 - `version: string`
50735088
50745089 The resolved version: a skill version ID for custom skills.
5090
5091 maxLength: 64, minLength: 1
50755092
50765093 - `content: array of BetaContentBlock`
50775094
from line 5119
51025119 [{"type": "text", "text": "B)"}]
51035120 ```
51045121
5105 - `BetaTextBlock object { citations, text, type }`
5122 - `BetaTextBlock object`
51065123
51075124 - `citations: array of BetaTextCitation or null`
51085125
from line 5127
51105127
51115128 The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
51125129
5113 - `BetaCitationCharLocation object { cited_text, document_index, document_title, 4 more }`
5130 - `BetaCitationCharLocation object`
51145131
51155132 - `cited_text: string`
51165133
51175134 - `document_index: number`
51185135
5136 minimum: 0
5137
51195138 - `document_title: string or null`
51205139
51215140 - `end_char_index: number`
from line 5143
51245143
51255144 - `start_char_index: number`
51265145
5146 minimum: 0
5147
51275148 - `type: "char_location"`
51285149
5129 - `"char_location"`
5130
5131 - `BetaCitationPageLocation object { cited_text, document_index, document_title, 4 more }`
5150 default: char_location
5151
5152 - `BetaCitationPageLocation object`
51325153
51335154 - `cited_text: string`
51345155
51355156 - `document_index: number`
51365157
5158 minimum: 0
5159
51375160 - `document_title: string or null`
51385161
51395162 - `end_page_number: number`
from line 5165
51425165
51435166 - `start_page_number: number`
51445167
5168 minimum: 1
5169
51455170 - `type: "page_location"`
51465171
5147 - `"page_location"`
5148
5149 - `BetaCitationContentBlockLocation object { cited_text, document_index, document_title, 4 more }`
5172 default: page_location
5173
5174 - `BetaCitationContentBlockLocation object`
51505175
51515176 - `cited_text: string`
51525177
from line 5181
51565181
51575182 - `document_index: number`
51585183
5184 minimum: 0
5185
51595186 - `document_title: string or null`
51605187
51615188 - `end_block_index: number`
from line 5197
51705197
51715198 0-based index of the first cited block in the source's `content` array.
51725199
5200 minimum: 0
5201
51735202 - `type: "content_block_location"`
51745203
5175 - `"content_block_location"`
5176
5177 - `BetaCitationsWebSearchResultLocation object { cited_text, encrypted_index, title, 2 more }`
5204 default: content_block_location
5205
5206 - `BetaCitationsWebSearchResultLocation object`
51785207
51795208 - `cited_text: string`
51805209
from line 5211
51825211
51835212 - `title: string or null`
51845213
5214 maxLength: 512
5215
51855216 - `type: "web_search_result_location"`
51865217
5187 - `"web_search_result_location"`
5218 default: web_search_result_location
51885219
51895220 - `url: string`
51905221
5191 - `BetaCitationSearchResultLocation object { cited_text, end_block_index, search_result_index, 4 more }`
5222 - `BetaCitationSearchResultLocation object`
51925223
51935224 - `cited_text: string`
51945225
from line 5239
52085239
52095240 Counted separately from `document_index`; server-side web search results are not included in this count.
52105241
5242 minimum: 0
5243
52115244 - `source: string`
52125245
52135246 - `start_block_index: number`
52145247
52155248 0-based index of the first cited block in the source's `content` array.
52165249
5250 minimum: 0
5251
52175252 - `title: string or null`
52185253
52195254 - `type: "search_result_location"`
52205255
5221 - `"search_result_location"`
5256 default: search_result_location
52225257
52235258 - `text: string`
52245259
5260 maxLength: 5000000, minLength: 0
5261
52255262 - `type: "text"`
52265263
5227 - `"text"`
5228
5229 - `BetaThinkingBlock object { signature, thinking, type }`
5264 default: text
5265
5266 - `BetaThinkingBlock object`
52305267
52315268 - `signature: string`
52325269
from line 5279
52425279
52435280 - `type: "thinking"`
52445281
5245 - `"thinking"`
5246
5247 - `BetaRedactedThinkingBlock object { data, type }`
5282 default: thinking
5283
5284 - `BetaRedactedThinkingBlock object`
52485285
52495286 - `data: string`
52505287
from line 5293
52565293
52575294 - `type: "redacted_thinking"`
52585295
5259 - `"redacted_thinking"`
5260
5261 - `BetaToolUseBlock object { id, input, name, 3 more }`
5296 default: redacted_thinking
5297
5298 - `BetaToolUseBlock object`
52625299
52635300 - `id: string`
52645301
5302 pattern: ^[a-zA-Z0-9_-]+$
5303
52655304 - `input: map[unknown]`
52665305
52675306 - `name: string`
52685307
5308 minLength: 1
5309
52695310 - `type: "tool_use"`
52705311
5271 - `"tool_use"`
5312 default: tool_use
52725313
52735314 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
52745315
52755316 Tool invocation directly from the model.
52765317
5277 - `BetaDirectCaller object { type }`
5318 - `BetaDirectCaller object`
52785319
52795320 Tool invocation directly from the model.
52805321
52815322 - `type: "direct"`
52825323
5283 - `"direct"`
5284
5285 - `BetaServerToolCaller object { tool_id, type }`
5324 - `BetaServerToolCaller object`
52865325
52875326 Tool invocation generated by a server-side tool.
52885327
52895328 - `tool_id: string`
52905329
5330 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5331
52915332 - `type: "code_execution_20250825"`
52925333
5293 - `"code_execution_20250825"`
5294
5295 - `BetaServerToolCaller20260120 object { tool_id, type }`
5334 - `BetaServerToolCaller20260120 object`
52965335
52975336 - `tool_id: string`
52985337
5338 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5339
52995340 - `type: "code_execution_20260120"`
53005341
5301 - `"code_execution_20260120"`
5302
53035342 - `toolset_name: optional string or null`
53045343
53055344 For a toolset member tool_use, the toolset family.
53065345
5307 - `BetaServerToolUseBlock object { id, input, name, 2 more }`
5346 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
5347
5348 - `BetaServerToolUseBlock object`
53085349
53095350 - `id: string`
53105351
5352 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5353
53115354 - `input: map[unknown]`
53125355
53135356 - `name: "advisor" or "web_search" or "web_fetch" or 5 more`
from line 5373
53305373
53315374 - `type: "server_tool_use"`
53325375
5333 - `"server_tool_use"`
5376 default: server_tool_use
53345377
53355378 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
53365379
53375380 Tool invocation directly from the model.
53385381
5339 - `BetaDirectCaller object { type }`
5382 - `BetaDirectCaller object`
53405383
53415384 Tool invocation directly from the model.
53425385
5343 - `BetaServerToolCaller object { tool_id, type }`
5386 - `BetaServerToolCaller object`
53445387
53455388 Tool invocation generated by a server-side tool.
53465389
5347 - `BetaServerToolCaller20260120 object { tool_id, type }`
5348
5349 - `BetaWebSearchToolResultBlock object { content, tool_use_id, type, caller }`
5390 - `BetaServerToolCaller20260120 object`
5391
5392 - `BetaWebSearchToolResultBlock object`
53505393
53515394 - `content: BetaWebSearchToolResultBlockContent`
53525395
5353 - `BetaWebSearchToolResultError object { error_code, type }`
5396 - `BetaWebSearchToolResultError object`
53545397
53555398 - `error_code: BetaWebSearchToolResultErrorCode`
53565399
from line 5411
53685411
53695412 - `type: "web_search_tool_result_error"`
53705413
5371 - `"web_search_tool_result_error"`
5414 default: web_search_tool_result_error
53725415
53735416 - `array of BetaWebSearchResultBlock`
53745417
from line 5423
53805423
53815424 - `type: "web_search_result"`
53825425
5383 - `"web_search_result"`
5426 default: web_search_result
53845427
53855428 - `url: string`
53865429
53875430 - `tool_use_id: string`
53885431
5432 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5433
53895434 - `type: "web_search_tool_result"`
53905435
5391 - `"web_search_tool_result"`
5436 default: web_search_tool_result
53925437
53935438 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
53945439
53955440 Tool invocation directly from the model.
53965441
5397 - `BetaDirectCaller object { type }`
5442 - `BetaDirectCaller object`
53985443
53995444 Tool invocation directly from the model.
54005445
5401 - `BetaServerToolCaller object { tool_id, type }`
5446 - `BetaServerToolCaller object`
54025447
54035448 Tool invocation generated by a server-side tool.
54045449
5405 - `BetaServerToolCaller20260120 object { tool_id, type }`
5406
5407 - `BetaWebFetchToolResultBlock object { content, tool_use_id, type, caller }`
5450 - `BetaServerToolCaller20260120 object`
5451
5452 - `BetaWebFetchToolResultBlock object`
54085453
54095454 - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock`
54105455
5411 - `BetaWebFetchToolResultErrorBlock object { error_code, type }`
5456 - `BetaWebFetchToolResultErrorBlock object`
54125457
54135458 - `error_code: BetaWebFetchToolResultErrorCode`
54145459
from line 5477
54325477
54335478 - `type: "web_fetch_tool_result_error"`
54345479
5435 - `"web_fetch_tool_result_error"`
5436
5437 - `BetaWebFetchBlock object { content, retrieved_at, type, url }`
5480 default: web_fetch_tool_result_error
5481
5482 - `BetaWebFetchBlock object`
54385483
54395484 - `content: BetaDocumentBlock`
54405485
from line 5489
54445489
54455490 - `enabled: boolean`
54465491
5492 default: false
5493
54475494 - `source: BetaBase64PDFSource or BetaPlainTextSource`
54485495
5449 - `BetaBase64PDFSource object { data, media_type, type }`
5496 - `BetaBase64PDFSource object`
54505497
54515498 - `data: string`
54525499
5500 format: byte
5501
54535502 - `media_type: "application/pdf"`
54545503
5455 - `"application/pdf"`
5456
54575504 - `type: "base64"`
54585505
5459 - `"base64"`
5460
5461 - `BetaPlainTextSource object { data, media_type, type }`
5506 - `BetaPlainTextSource object`
54625507
54635508 - `data: string`
54645509
54655510 - `media_type: "text/plain"`
54665511
5467 - `"text/plain"`
5468
54695512 - `type: "text"`
54705513
5471 - `"text"`
5472
54735514 - `title: string or null`
54745515
54755516 The title of the document
54765517
54775518 - `type: "document"`
54785519
5479 - `"document"`
5520 default: document
54805521
54815522 - `retrieved_at: string or null`
54825523
from line 5525
54845525
54855526 - `type: "web_fetch_result"`
54865527
5487 - `"web_fetch_result"`
5528 default: web_fetch_result
54885529
54895530 - `url: string`
54905531
from line 5533
54925533
54935534 - `tool_use_id: string`
54945535
5536 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5537
54955538 - `type: "web_fetch_tool_result"`
54965539
5497 - `"web_fetch_tool_result"`
5540 default: web_fetch_tool_result
54985541
54995542 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
55005543
55015544 Tool invocation directly from the model.
55025545
5503 - `BetaDirectCaller object { type }`
5546 - `BetaDirectCaller object`
55045547
55055548 Tool invocation directly from the model.
55065549
5507 - `BetaServerToolCaller object { tool_id, type }`
5550 - `BetaServerToolCaller object`
55085551
55095552 Tool invocation generated by a server-side tool.
55105553
5511 - `BetaServerToolCaller20260120 object { tool_id, type }`
5512
5513 - `BetaAdvisorToolResultBlock object { content, tool_use_id, type }`
5554 - `BetaServerToolCaller20260120 object`
5555
5556 - `BetaAdvisorToolResultBlock object`
55145557
55155558 - `content: BetaAdvisorToolResultError or BetaAdvisorResultBlock or BetaAdvisorRedactedResultBlock`
55165559
5517 - `BetaAdvisorToolResultError object { error_code, type }`
5560 - `BetaAdvisorToolResultError object`
55185561
55195562 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
55205563
from line 5577
55345577
55355578 - `type: "advisor_tool_result_error"`
55365579
5537 - `"advisor_tool_result_error"`
5538
5539 - `BetaAdvisorResultBlock object { stop_reason, text, type }`
5580 default: advisor_tool_result_error
5581
5582 - `BetaAdvisorResultBlock object`
55405583
55415584 - `stop_reason: string or null`
55425585
from line 5589
55465589
55475590 - `type: "advisor_result"`
55485591
5549 - `"advisor_result"`
5550
5551 - `BetaAdvisorRedactedResultBlock object { encrypted_content, stop_reason, type }`
5592 default: advisor_result
5593
5594 - `BetaAdvisorRedactedResultBlock object`
55525595
55535596 - `encrypted_content: string`
55545597
from line 5603
55605603
55615604 - `type: "advisor_redacted_result"`
55625605
5563 - `"advisor_redacted_result"`
5606 default: advisor_redacted_result
55645607
55655608 - `tool_use_id: string`
55665609
5610 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5611
55675612 - `type: "advisor_tool_result"`
55685613
5569 - `"advisor_tool_result"`
5570
5571 - `BetaCodeExecutionToolResultBlock object { content, tool_use_id, type }`
5614 default: advisor_tool_result
5615
5616 - `BetaCodeExecutionToolResultBlock object`
55725617
55735618 - `content: BetaCodeExecutionToolResultBlockContent`
55745619
55755620 Code execution result with encrypted stdout for PFC + web_search results.
55765621
5577 - `BetaCodeExecutionToolResultError object { error_code, type }`
5622 - `BetaCodeExecutionToolResultError object`
55785623
55795624 - `error_code: BetaCodeExecutionToolResultErrorCode`
55805625
from line 5633
55885633
55895634 - `type: "code_execution_tool_result_error"`
55905635
5591 - `"code_execution_tool_result_error"`
5592
5593 - `BetaCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
5636 default: code_execution_tool_result_error
5637
5638 - `BetaCodeExecutionResultBlock object`
55945639
55955640 - `content: array of BetaCodeExecutionOutputBlock`
55965641
from line 5643
55985643
55995644 - `type: "code_execution_output"`
56005645
5601 - `"code_execution_output"`
5646 default: code_execution_output
56025647
56035648 - `return_code: number`
56045649
from line 5653
56085653
56095654 - `type: "code_execution_result"`
56105655
5611 - `"code_execution_result"`
5612
5613 - `BetaEncryptedCodeExecutionResultBlock object { content, encrypted_stdout, return_code, 2 more }`
5656 default: code_execution_result
5657
5658 - `BetaEncryptedCodeExecutionResultBlock object`
56145659
56155660 Code execution result with encrypted stdout for PFC + web_search results.
56165661
from line 5665
56205665
56215666 - `type: "code_execution_output"`
56225667
5668 default: code_execution_output
5669
56235670 - `encrypted_stdout: string`
56245671
56255672 - `return_code: number`
from line 5675
56285675
56295676 - `type: "encrypted_code_execution_result"`
56305677
5631 - `"encrypted_code_execution_result"`
5678 default: encrypted_code_execution_result
56325679
56335680 - `tool_use_id: string`
56345681
5682 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5683
56355684 - `type: "code_execution_tool_result"`
56365685
5637 - `"code_execution_tool_result"`
5638
5639 - `BetaBashCodeExecutionToolResultBlock object { content, tool_use_id, type }`
5686 default: code_execution_tool_result
5687
5688 - `BetaBashCodeExecutionToolResultBlock object`
56405689
56415690 - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock`
56425691
5643 - `BetaBashCodeExecutionToolResultError object { error_code, type }`
5692 - `BetaBashCodeExecutionToolResultError object`
56445693
56455694 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
56465695
from line 5705
56565705
56575706 - `type: "bash_code_execution_tool_result_error"`
56585707
5659 - `"bash_code_execution_tool_result_error"`
5660
5661 - `BetaBashCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
5708 default: bash_code_execution_tool_result_error
5709
5710 - `BetaBashCodeExecutionResultBlock object`
56625711
56635712 - `content: array of BetaBashCodeExecutionOutputBlock`
56645713
from line 5715
56665715
56675716 - `type: "bash_code_execution_output"`
56685717
5669 - `"bash_code_execution_output"`
5718 default: bash_code_execution_output
56705719
56715720 - `return_code: number`
56725721
from line 5725
56765725
56775726 - `type: "bash_code_execution_result"`
56785727
5679 - `"bash_code_execution_result"`
5728 default: bash_code_execution_result
56805729
56815730 - `tool_use_id: string`
56825731
5732 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5733
56835734 - `type: "bash_code_execution_tool_result"`
56845735
5685 - `"bash_code_execution_tool_result"`
5686
5687 - `BetaTextEditorCodeExecutionToolResultBlock object { content, tool_use_id, type }`
5736 default: bash_code_execution_tool_result
5737
5738 - `BetaTextEditorCodeExecutionToolResultBlock object`
56885739
56895740 - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock`
56905741
5691 - `BetaTextEditorCodeExecutionToolResultError object { error_code, error_message, type }`
5742 - `BetaTextEditorCodeExecutionToolResultError object`
56925743
56935744 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
56945745
from line 5757
57065757
57075758 - `type: "text_editor_code_execution_tool_result_error"`
57085759
5709 - `"text_editor_code_execution_tool_result_error"`
5710
5711 - `BetaTextEditorCodeExecutionViewResultBlock object { content, file_type, num_lines, 3 more }`
5760 default: text_editor_code_execution_tool_result_error
5761
5762 - `BetaTextEditorCodeExecutionViewResultBlock object`
57125763
57135764 - `content: string`
57145765
from line 5779
57285779
57295780 - `type: "text_editor_code_execution_view_result"`
57305781
5731 - `"text_editor_code_execution_view_result"`
5732
5733 - `BetaTextEditorCodeExecutionCreateResultBlock object { is_file_update, type }`
5782 default: text_editor_code_execution_view_result
5783
5784 - `BetaTextEditorCodeExecutionCreateResultBlock object`
57345785
57355786 - `is_file_update: boolean`
57365787
57375788 - `type: "text_editor_code_execution_create_result"`
57385789
5739 - `"text_editor_code_execution_create_result"`
5740
5741 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object { lines, new_lines, new_start, 3 more }`
5790 default: text_editor_code_execution_create_result
5791
5792 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object`
57425793
57435794 - `lines: array of string or null`
57445795
from line 5803
57525803
57535804 - `type: "text_editor_code_execution_str_replace_result"`
57545805
5755 - `"text_editor_code_execution_str_replace_result"`
5806 default: text_editor_code_execution_str_replace_result
57565807
57575808 - `tool_use_id: string`
57585809
5810 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5811
57595812 - `type: "text_editor_code_execution_tool_result"`
57605813
5761 - `"text_editor_code_execution_tool_result"`
5762
5763 - `BetaToolSearchToolResultBlock object { content, tool_use_id, type }`
5814 default: text_editor_code_execution_tool_result
5815
5816 - `BetaToolSearchToolResultBlock object`
57645817
57655818 - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock`
57665819
5767 - `BetaToolSearchToolResultError object { error_code, error_message, type }`
5820 - `BetaToolSearchToolResultError object`
57685821
57695822 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
57705823
from line 5833
57805833
57815834 - `type: "tool_search_tool_result_error"`
57825835
5783 - `"tool_search_tool_result_error"`
5784
5785 - `BetaToolSearchToolSearchResultBlock object { tool_references, type }`
5836 default: tool_search_tool_result_error
5837
5838 - `BetaToolSearchToolSearchResultBlock object`
57865839
57875840 - `tool_references: array of BetaToolReferenceBlock`
57885841
57895842 - `tool_name: string`
57905843
5844 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
5845
57915846 - `type: "tool_reference"`
57925847
5793 - `"tool_reference"`
5848 default: tool_reference
57945849
57955850 - `type: "tool_search_tool_search_result"`
57965851
5797 - `"tool_search_tool_search_result"`
5852 default: tool_search_tool_search_result
57985853
57995854 - `tool_use_id: string`
58005855
5856 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
5857
58015858 - `type: "tool_search_tool_result"`
58025859
5803 - `"tool_search_tool_result"`
5804
5805 - `BetaMCPToolUseBlock object { id, input, name, 2 more }`
5860 default: tool_search_tool_result
5861
5862 - `BetaMCPToolUseBlock object`
58065863
58075864 - `id: string`
58085865
5866 pattern: ^[a-zA-Z0-9_-]+$
5867
58095868 - `input: map[unknown]`
58105869
58115870 - `name: string`
from line 5877
58185877
58195878 - `type: "mcp_tool_use"`
58205879
5821 - `"mcp_tool_use"`
5822
5823 - `BetaMCPToolResultBlock object { content, is_error, tool_use_id, type }`
5880 default: mcp_tool_use
5881
5882 - `BetaMCPToolResultBlock object`
58245883
58255884 - `content: string or array of BetaTextBlock`
58265885
from line 5895
58365895
58375896 - `text: string`
58385897
5898 maxLength: 5000000, minLength: 0
5899
58395900 - `type: "text"`
58405901
5902 default: text
5903
58415904 - `is_error: boolean`
58425905
5906 default: false
5907
58435908 - `tool_use_id: string`
58445909
5910 pattern: ^[a-zA-Z0-9_-]+$
5911
58455912 - `type: "mcp_tool_result"`
58465913
5847 - `"mcp_tool_result"`
5848
5849 - `BetaContainerUploadBlock object { file_id, type }`
5914 default: mcp_tool_result
5915
5916 - `BetaContainerUploadBlock object`
58505917
58515918 Response model for a file uploaded to the container.
58525919
from line 5921
58545921
58555922 - `type: "container_upload"`
58565923
5857 - `"container_upload"`
5858
5859 - `BetaCompactionBlock object { content, encrypted_content, type }`
5924 default: container_upload
5925
5926 - `BetaCompactionBlock object`
58605927
58615928 A compaction block returned when autocompact is triggered.
58625929
from line 5941
58745941
58755942 - `type: "compaction"`
58765943
5877 - `"compaction"`
5878
5879 - `BetaFallbackBlock object { from, to, trigger, type }`
5944 default: compaction
5945
5946 - `BetaFallbackBlock object`
58805947
58815948 Marks the point in `content` where one model's output gives way to the next.
58825949
from line 6069
60026069
60036070 - `type: "refusal"`
60046071
6005 - `"refusal"`
6072 default: refusal
60066073
60076074 - `type: "fallback"`
60086075
6009 - `"fallback"`
6076 default: fallback
60106077
60116078 - `context_management: BetaContextManagementResponse or null`
60126079
from line 6085
60186085
60196086 List of context management edits that were applied.
60206087
6021 - `BetaClearToolUses20250919EditResponse object { cleared_input_tokens, cleared_tool_uses, type }`
6088 - `BetaClearToolUses20250919EditResponse object`
60226089
60236090 - `cleared_input_tokens: number`
60246091
60256092 Number of input tokens cleared by this edit.
60266093
6094 minimum: 0
6095
60276096 - `cleared_tool_uses: number`
60286097
60296098 Number of tool uses that were cleared.
60306099
6100 minimum: 0
6101
60316102 - `type: "clear_tool_uses_20250919"`
60326103
60336104 The type of context management edit applied.
60346105
6035 - `"clear_tool_uses_20250919"`
6036
6037 - `BetaClearThinking20251015EditResponse object { cleared_input_tokens, cleared_thinking_turns, type }`
6106 default: clear_tool_uses_20250919
6107
6108 - `BetaClearThinking20251015EditResponse object`
60386109
60396110 - `cleared_input_tokens: number`
60406111
60416112 Number of input tokens cleared by this edit.
60426113
6114 minimum: 0
6115
60436116 - `cleared_thinking_turns: number`
60446117
60456118 Number of thinking turns that were cleared.
60466119
6120 minimum: 0
6121
60476122 - `type: "clear_thinking_20251015"`
60486123
60496124 The type of context management edit applied.
60506125
6051 - `"clear_thinking_20251015"`
6126 default: clear_thinking_20251015
60526127
60536128 - `diagnostics: BetaDiagnostics or null`
60546129
from line 6134
60596134
60606135 Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.
60616136
6062 - `BetaCacheMissModelChanged object { cache_missed_input_tokens, type }`
6137 - `BetaCacheMissModelChanged object`
60636138
60646139 - `cache_missed_input_tokens: number`
60656140
from line 6142
60676142
60686143 - `type: "model_changed"`
60696144
6070 - `"model_changed"`
6071
6072 - `BetaCacheMissSystemChanged object { cache_missed_input_tokens, type }`
6145 default: model_changed
6146
6147 - `BetaCacheMissSystemChanged object`
60736148
60746149 - `cache_missed_input_tokens: number`
60756150
from line 6152
60776152
60786153 - `type: "system_changed"`
60796154
6080 - `"system_changed"`
6081
6082 - `BetaCacheMissToolsChanged object { cache_missed_input_tokens, type }`
6155 default: system_changed
6156
6157 - `BetaCacheMissToolsChanged object`
60836158
60846159 - `cache_missed_input_tokens: number`
60856160
from line 6162
60876162
60886163 - `type: "tools_changed"`
60896164
6090 - `"tools_changed"`
6091
6092 - `BetaCacheMissMessagesChanged object { cache_missed_input_tokens, type }`
6165 default: tools_changed
6166
6167 - `BetaCacheMissMessagesChanged object`
60936168
60946169 - `cache_missed_input_tokens: number`
60956170
from line 6172
60976172
60986173 - `type: "messages_changed"`
60996174
6100 - `"messages_changed"`
6101
6102 - `BetaCacheMissPreviousMessageNotFound object { type }`
6175 default: messages_changed
6176
6177 - `BetaCacheMissPreviousMessageNotFound object`
61036178
61046179 - `type: "previous_message_not_found"`
61056180
6106 - `"previous_message_not_found"`
6107
6108 - `BetaCacheMissUnavailable object { type }`
6181 default: previous_message_not_found
6182
6183 - `BetaCacheMissUnavailable object`
61096184
61106185 - `type: "unavailable"`
61116186
6112 - `"unavailable"`
6187 default: unavailable
61136188
61146189 - `model: Model`
61156190
from line 6198
61236198
61246199 This will always be `"assistant"`.
61256200
6126 - `"assistant"`
6201 default: assistant
61276202
61286203 - `stop_details: BetaRefusalStopDetails or null`
61296204
from line 6285
62106285
62116286 - `type: "refusal"`
62126287
6213 - `"refusal"`
6288 default: refusal
62146289
62156290 - `stop_reason: BetaStopReason or null`
62166291
from line 6331
62566331
62576332 For Messages, this is always `"message"`.
62586333
6259 - `"message"`
6334 default: message
62606335
62616336 - `usage: BetaUsage`
62626337
from line 6353
62786353
62796354 The number of input tokens used to create the 1 hour cache entry.
62806355
6356 default: 0, minimum: 0
6357
62816358 - `ephemeral_5m_input_tokens: number`
62826359
62836360 The number of input tokens used to create the 5 minute cache entry.
62846361
6362 default: 0, minimum: 0
6363
62856364 - `cache_creation_input_tokens: number or null`
62866365
62876366 The number of input tokens used to create the cache entry.
62886367
6368 minimum: 0
6369
62896370 - `cache_read_input_tokens: number or null`
62906371
62916372 The number of input tokens read from the cache.
6373
6374 minimum: 0
62926375
62936376 - `fallback_credit: BetaFallbackCreditUsage or null`
62946377
from line 6386
63036386 resulting shift is zero because there was nothing to move. `not_applied`:
63046387 no reprice was applied; the arm's `reason` says why.
63056388
6306 - `BetaFallbackCreditRedeemed object { type }`
6389 - `BetaFallbackCreditRedeemed object`
63076390
63086391 The reprice was applied: the retry is billed as if the conversation
63096392 had been on the retry model all along.
63106393
63116394 - `type: "redeemed"`
63126395
6313 - `"redeemed"`
6314
6315 - `BetaFallbackCreditNotApplied object { reason, type, remove_to_redeem }`
6396 default: redeemed
6397
6398 - `BetaFallbackCreditNotApplied object`
63166399
63176400 No reprice was applied; `reason` says why.
63186401
from line 6432
63496432
63506433 - `type: "not_applied"`
63516434
6352 - `"not_applied"`
6435 default: not_applied
63536436
63546437 - `remove_to_redeem: optional array of string or null`
63556438
from line 6453
63706453
63716454 The number of input tokens which were used.
63726455
6456 minimum: 0
6457
63736458 - `iterations: BetaIterationsUsage or null`
63746459
63756460 Per-iteration token usage breakdown.
from line 6465
63806465 - Calculate the true context window size from the last iteration
63816466 - Understand token accumulation across server-side tool use loops
63826467
6383 - `BetaMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
6468 - `BetaMessageIterationUsage object`
63846469
63856470 Token usage for a sampling iteration.
63866471
from line 6477
63926477
63936478 The number of input tokens used to create the cache entry.
63946479
6480 default: 0, minimum: 0
6481
63956482 - `cache_read_input_tokens: number`
63966483
63976484 The number of input tokens read from the cache.
63986485
6486 default: 0, minimum: 0
6487
63996488 - `input_tokens: number`
64006489
64016490 The number of input tokens which were used.
64026491
6492 minimum: 0
6493
64036494 - `model: Model`
64046495
64056496 The model that will complete your prompt.
from line 6501
64106501
64116502 The number of output tokens which were used.
64126503
6504 minimum: 0
6505
64136506 - `type: "message"`
64146507
64156508 Usage for a sampling iteration
64166509
6417 - `"message"`
6418
6419 - `BetaCompactionIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }`
6510 default: message
6511
6512 - `BetaCompactionIterationUsage object`
64206513
64216514 Token usage for a compaction iteration.
64226515
from line 6521
64286521
64296522 The number of input tokens used to create the cache entry.
64306523
6524 default: 0, minimum: 0
6525
64316526 - `cache_read_input_tokens: number`
64326527
64336528 The number of input tokens read from the cache.
64346529
6530 default: 0, minimum: 0
6531
64356532 - `input_tokens: number`
64366533
64376534 The number of input tokens which were used.
64386535
6536 minimum: 0
6537
64396538 - `output_tokens: number`
64406539
64416540 The number of output tokens which were used.
64426541
6542 minimum: 0
6543
64436544 - `type: "compaction"`
64446545
64456546 Usage for a compaction iteration
64466547
6447 - `"compaction"`
6448
6449 - `BetaAdvisorMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
6548 default: compaction
6549
6550 - `BetaAdvisorMessageIterationUsage object`
64506551
64516552 Token usage for an advisor sub-inference iteration.
64526553
from line 6559
64586559
64596560 The number of input tokens used to create the cache entry.
64606561
6562 default: 0, minimum: 0
6563
64616564 - `cache_read_input_tokens: number`
64626565
64636566 The number of input tokens read from the cache.
64646567
6568 default: 0, minimum: 0
6569
64656570 - `input_tokens: number`
64666571
64676572 The number of input tokens which were used.
64686573
6574 minimum: 0
6575
64696576 - `model: Model`
64706577
64716578 The model that will complete your prompt.
from line 6583
64766583
64776584 The number of output tokens which were used.
64786585
6586 minimum: 0
6587
64796588 - `type: "advisor_message"`
64806589
64816590 Usage for an advisor sub-inference iteration
64826591
6483 - `"advisor_message"`
6484
6485 - `BetaFallbackMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
6592 default: advisor_message
6593
6594 - `BetaFallbackMessageIterationUsage object`
64866595
64876596 Token usage for the fallback-model attempt of a server-side fallback request.
64886597
from line 6608
64996608
65006609 The number of input tokens used to create the cache entry.
65016610
6611 default: 0, minimum: 0
6612
65026613 - `cache_read_input_tokens: number`
65036614
65046615 The number of input tokens read from the cache.
65056616
6617 default: 0, minimum: 0
6618
65066619 - `input_tokens: number`
65076620
65086621 The number of input tokens which were used.
65096622
6623 minimum: 0
6624
65106625 - `model: Model`
65116626
65126627 The model that will complete your prompt.
from line 6632
65176632
65186633 The number of output tokens which were used.
65196634
6635 minimum: 0
6636
65206637 - `type: "fallback_message"`
65216638
65226639 Usage for the fallback-model attempt that served the response
65236640
6524 - `"fallback_message"`
6641 default: fallback_message
65256642
65266643 - `output_tokens: number`
65276644
65286645 The number of output tokens which were used.
6646
6647 minimum: 0
65296648
65306649 - `output_tokens_details: BetaOutputTokensDetails or null`
65316650
from line 6666
65476666 generation count by a small number of tokens. Always ≤ `output_tokens`;
65486667 `output_tokens - thinking_tokens` approximates the non-reasoning output.
65496668
6669 default: 0, minimum: 0
6670
65506671 - `server_tool_use: BetaServerToolUsage or null`
65516672
65526673 The number of server tool requests.
from line 6676
65556676
65566677 The number of web fetch tool requests.
65576678
6679 default: 0, minimum: 0
6680
65586681 - `web_search_requests: number`
65596682
65606683 The number of web search tool requests.
65616684
6685 default: 0, minimum: 0
6686
65626687 - `service_tier: "standard" or "priority" or "batch" or null`
65636688
65646689 If the request used the priority, standard, or batch tier.
from line 6704
65796704
65806705 - `type: "succeeded"`
65816706
6582 - `"succeeded"`
6583
6584 - `BetaMessageBatchErroredResult object { error, type }`
6707 default: succeeded
6708
6709 - `BetaMessageBatchErroredResult object`
65856710
65866711 - `error: BetaErrorResponse`
65876712
65886713 - `error: BetaError`
65896714
6590 - `BetaInvalidRequestError object { message, type }`
6715 - `BetaInvalidRequestError object`
65916716
65926717 - `message: string`
65936718
6719 default: Invalid request
6720
65946721 - `type: "invalid_request_error"`
65956722
6596 - `"invalid_request_error"`
6597
6598 - `BetaAuthenticationError object { message, type }`
6723 default: invalid_request_error
6724
6725 - `BetaAuthenticationError object`
65996726
66006727 - `message: string`
66016728
6729 default: Authentication error
6730
66026731 - `type: "authentication_error"`
66036732
6604 - `"authentication_error"`
6605
6606 - `BetaBillingError object { message, type }`
6733 default: authentication_error
6734
6735 - `BetaBillingError object`
66076736
66086737 - `message: string`
66096738
6739 default: Billing error
6740
66106741 - `type: "billing_error"`
66116742
6612 - `"billing_error"`
6613
6614 - `BetaPermissionError object { message, type }`
6743 default: billing_error
6744
6745 - `BetaPermissionError object`
66156746
66166747 - `message: string`
66176748
6749 default: Permission denied
6750
66186751 - `type: "permission_error"`
66196752
6620 - `"permission_error"`
6621
6622 - `BetaNotFoundError object { message, type }`
6753 default: permission_error
6754
6755 - `BetaNotFoundError object`
66236756
66246757 - `message: string`
66256758
6759 default: Not found
6760
66266761 - `type: "not_found_error"`
66276762
6628 - `"not_found_error"`
6629
6630 - `BetaRateLimitError object { message, type }`
6763 default: not_found_error
6764
6765 - `BetaRateLimitError object`
66316766
66326767 - `message: string`
66336768
6769 default: Rate limited
6770
66346771 - `type: "rate_limit_error"`
66356772
6636 - `"rate_limit_error"`
6637
6638 - `BetaGatewayTimeoutError object { message, type }`
6773 default: rate_limit_error
6774
6775 - `BetaGatewayTimeoutError object`
66396776
66406777 - `message: string`
66416778
6779 default: Request timeout
6780
66426781 - `type: "timeout_error"`
66436782
6644 - `"timeout_error"`
6645
6646 - `BetaAPIError object { message, type }`
6783 default: timeout_error
6784
6785 - `BetaAPIError object`
66476786
66486787 - `message: string`
66496788
6789 default: Internal server error
6790
66506791 - `type: "api_error"`
66516792
6652 - `"api_error"`
6653
6654 - `BetaOverloadedError object { message, type }`
6793 default: api_error
6794
6795 - `BetaOverloadedError object`
66556796
66566797 - `message: string`
66576798
6799 default: Overloaded
6800
66586801 - `type: "overloaded_error"`
66596802
6660 - `"overloaded_error"`
6803 default: overloaded_error
66616804
66626805 - `request_id: string or null`
66636806
66646807 - `type: "error"`
66656808
6666 - `"error"`
6809 default: error
66676810
66686811 - `type: "errored"`
66696812
6670 - `"errored"`
6671
6672 - `BetaMessageBatchCanceledResult object { type }`
6813 default: errored
6814
6815 - `BetaMessageBatchCanceledResult object`
66736816
66746817 - `type: "canceled"`
66756818
6676 - `"canceled"`
6677
6678 - `BetaMessageBatchExpiredResult object { type }`
6819 default: canceled
6820
6821 - `BetaMessageBatchExpiredResult object`
66796822
66806823 - `type: "expired"`
66816824
6682 - `"expired"`
6825 default: expired
66836826
66846827### Example
66856828
6686```http
6829```bash
66876830curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results \
66886831 -H 'anthropic-version: 2023-06-01' \
66896832 -H 'anthropic-beta: message-batches-2024-09-24' \
66906833 -H "X-Api-Key: $ANTHROPIC_API_KEY"
66916834```
66926835
6693## Domain Types
6836## Domain types
66946837
66956838### Beta Deleted Message Batch
66966839
6697- `BetaDeletedMessageBatch object { id, type }`
6840- `BetaDeletedMessageBatch object`
66986841
66996842 - `id: string`
67006843
from line 6849
67066849
67076850 For Message Batches, this is always `"message_batch_deleted"`.
67086851
6709 - `"message_batch_deleted"`
6852 default: message_batch_deleted
67106853
67116854### Beta Message Batch
67126855
6713- `BetaMessageBatch object { id, archived_at, cancel_initiated_at, 7 more }`
6856- `BetaMessageBatch object`
67146857
67156858 - `id: string`
67166859
from line 6865
67226865
67236866 RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
67246867
6868 format: date-time
6869
67256870 - `cancel_initiated_at: string or null`
67266871
67276872 RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
67286873
6874 format: date-time
6875
67296876 - `created_at: string`
67306877
67316878 RFC 3339 datetime string representing the time at which the Message Batch was created.
67326879
6880 format: date-time
6881
67336882 - `ended_at: string or null`
67346883
67356884 RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.
67366885
67376886 Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
67386887
6888 format: date-time
6889
67396890 - `expires_at: string`
67406891
67416892 RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
67426893
6894 format: date-time
6895
67436896 - `processing_status: "in_progress" or "canceling" or "ended"`
67446897
67456898 Processing status of the Message Batch.
from line 6915
67626915
67636916 This is zero until processing of the entire Message Batch has ended.
67646917
6918 default: 0
6919
67656920 - `errored: number`
67666921
67676922 Number of requests in the Message Batch that encountered an error.
67686923
67696924 This is zero until processing of the entire Message Batch has ended.
67706925
6926 default: 0
6927
67716928 - `expired: number`
67726929
67736930 Number of requests in the Message Batch that have expired.
67746931
67756932 This is zero until processing of the entire Message Batch has ended.
67766933
6934 default: 0
6935
67776936 - `processing: number`
67786937
67796938 Number of requests in the Message Batch that are processing.
67806939
6940 default: 0
6941
67816942 - `succeeded: number`
67826943
67836944 Number of requests in the Message Batch that have completed successfully.
67846945
67856946 This is zero until processing of the entire Message Batch has ended.
67866947
6948 default: 0
6949
67876950 - `results_url: string or null`
67886951
67896952 URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
from line 6959
67966959
67976960 For Message Batches, this is always `"message_batch"`.
67986961
6799 - `"message_batch"`
6962 default: message_batch
68006963
68016964### Beta Message Batch Canceled Result
68026965
6803- `BetaMessageBatchCanceledResult object { type }`
6966- `BetaMessageBatchCanceledResult object`
68046967
68056968 - `type: "canceled"`
68066969
6807 - `"canceled"`
6970 default: canceled
68086971
68096972### Beta Message Batch Errored Result
68106973
6811- `BetaMessageBatchErroredResult object { error, type }`
6974- `BetaMessageBatchErroredResult object`
68126975
68136976 - `error: BetaErrorResponse`
68146977
68156978 - `error: BetaError`
68166979
6817 - `BetaInvalidRequestError object { message, type }`
6980 - `BetaInvalidRequestError object`
68186981
68196982 - `message: string`
68206983
6984 default: Invalid request
6985
68216986 - `type: "invalid_request_error"`
68226987
6823 - `"invalid_request_error"`
6824
6825 - `BetaAuthenticationError object { message, type }`
6988 default: invalid_request_error
6989
6990 - `BetaAuthenticationError object`
68266991
68276992 - `message: string`
68286993
6994 default: Authentication error
6995
68296996 - `type: "authentication_error"`
68306997
6831 - `"authentication_error"`
6832
6833 - `BetaBillingError object { message, type }`
6998 default: authentication_error
6999
7000 - `BetaBillingError object`
68347001
68357002 - `message: string`
68367003
7004 default: Billing error
7005
68377006 - `type: "billing_error"`
68387007
6839 - `"billing_error"`
6840
6841 - `BetaPermissionError object { message, type }`
7008 default: billing_error
7009
7010 - `BetaPermissionError object`
68427011
68437012 - `message: string`
68447013
7014 default: Permission denied
7015
68457016 - `type: "permission_error"`
68467017
6847 - `"permission_error"`
6848
6849 - `BetaNotFoundError object { message, type }`
7018 default: permission_error
7019
7020 - `BetaNotFoundError object`
68507021
68517022 - `message: string`
68527023
7024 default: Not found
7025
68537026 - `type: "not_found_error"`
68547027
6855 - `"not_found_error"`
6856
6857 - `BetaRateLimitError object { message, type }`
7028 default: not_found_error
7029
7030 - `BetaRateLimitError object`
68587031
68597032 - `message: string`
68607033
7034 default: Rate limited
7035
68617036 - `type: "rate_limit_error"`
68627037
6863 - `"rate_limit_error"`
6864
6865 - `BetaGatewayTimeoutError object { message, type }`
7038 default: rate_limit_error
7039
7040 - `BetaGatewayTimeoutError object`
68667041
68677042 - `message: string`
68687043
7044 default: Request timeout
7045
68697046 - `type: "timeout_error"`
68707047
6871 - `"timeout_error"`
6872
6873 - `BetaAPIError object { message, type }`
7048 default: timeout_error
7049
7050 - `BetaAPIError object`
68747051
68757052 - `message: string`
68767053
7054 default: Internal server error
7055
68777056 - `type: "api_error"`
68787057
6879 - `"api_error"`
6880
6881 - `BetaOverloadedError object { message, type }`
7058 default: api_error
7059
7060 - `BetaOverloadedError object`
68827061
68837062 - `message: string`
68847063
7064 default: Overloaded
7065
68857066 - `type: "overloaded_error"`
68867067
6887 - `"overloaded_error"`
7068 default: overloaded_error
68887069
68897070 - `request_id: string or null`
68907071
68917072 - `type: "error"`
68927073
6893 - `"error"`
7074 default: error
68947075
68957076 - `type: "errored"`
68967077
6897 - `"errored"`
7078 default: errored
68987079
68997080### Beta Message Batch Expired Result
69007081
6901- `BetaMessageBatchExpiredResult object { type }`
7082- `BetaMessageBatchExpiredResult object`
69027083
69037084 - `type: "expired"`
69047085
6905 - `"expired"`
7086 default: expired
69067087
69077088### Beta Message Batch Individual Response
69087089
6909- `BetaMessageBatchIndividualResponse object { custom_id, result }`
7090- `BetaMessageBatchIndividualResponse object`
69107091
69117092 This is a single line in the response `.jsonl` file and does not represent the response as a whole.
69127093
from line 7103
69227103
69237104 Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
69247105
6925 - `BetaMessageBatchSucceededResult object { message, type }`
7106 - `BetaMessageBatchSucceededResult object`
69267107
69277108 - `message: BetaMessage`
69287109
from line 7125
69447125
69457126 The time at which the container will expire.
69467127
7128 format: date-time
7129
69477130 - `skills: array of BetaSkill or null`
69487131
69497132 Skills loaded in the container
from line 7135
69527135
69537136 Skill ID
69547137
7138 maxLength: 64, minLength: 1
7139
69557140 - `type: "anthropic" or "custom"`
69567141
69577142 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 7148
69637148 - `version: string`
69647149
69657150 The resolved version: a skill version ID for custom skills.
7151
7152 maxLength: 64, minLength: 1
69667153
69677154 - `content: array of BetaContentBlock`
69687155
from line 7180
69937180 [{"type": "text", "text": "B)"}]
69947181 ```
69957182
6996 - `BetaTextBlock object { citations, text, type }`
7183 - `BetaTextBlock object`
69977184
69987185 - `citations: array of BetaTextCitation or null`
69997186
from line 7188
70017188
70027189 The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
70037190
7004 - `BetaCitationCharLocation object { cited_text, document_index, document_title, 4 more }`
7191 - `BetaCitationCharLocation object`
70057192
70067193 - `cited_text: string`
70077194
70087195 - `document_index: number`
70097196
7197 minimum: 0
7198
70107199 - `document_title: string or null`
70117200
70127201 - `end_char_index: number`
from line 7204
70157204
70167205 - `start_char_index: number`
70177206
7207 minimum: 0
7208
70187209 - `type: "char_location"`
70197210
7020 - `"char_location"`
7021
7022 - `BetaCitationPageLocation object { cited_text, document_index, document_title, 4 more }`
7211 default: char_location
7212
7213 - `BetaCitationPageLocation object`
70237214
70247215 - `cited_text: string`
70257216
70267217 - `document_index: number`
70277218
7219 minimum: 0
7220
70287221 - `document_title: string or null`
70297222
70307223 - `end_page_number: number`
from line 7226
70337226
70347227 - `start_page_number: number`
70357228
7229 minimum: 1
7230
70367231 - `type: "page_location"`
70377232
7038 - `"page_location"`
7039
7040 - `BetaCitationContentBlockLocation object { cited_text, document_index, document_title, 4 more }`
7233 default: page_location
7234
7235 - `BetaCitationContentBlockLocation object`
70417236
70427237 - `cited_text: string`
70437238
from line 7242
70477242
70487243 - `document_index: number`
70497244
7245 minimum: 0
7246
70507247 - `document_title: string or null`
70517248
70527249 - `end_block_index: number`
from line 7258
70617258
70627259 0-based index of the first cited block in the source's `content` array.
70637260
7261 minimum: 0
7262
70647263 - `type: "content_block_location"`
70657264
7066 - `"content_block_location"`
7067
7068 - `BetaCitationsWebSearchResultLocation object { cited_text, encrypted_index, title, 2 more }`
7265 default: content_block_location
7266
7267 - `BetaCitationsWebSearchResultLocation object`
70697268
70707269 - `cited_text: string`
70717270
from line 7272
70737272
70747273 - `title: string or null`
70757274
7275 maxLength: 512
7276
70767277 - `type: "web_search_result_location"`
70777278
7078 - `"web_search_result_location"`
7279 default: web_search_result_location
70797280
70807281 - `url: string`
70817282
7082 - `BetaCitationSearchResultLocation object { cited_text, end_block_index, search_result_index, 4 more }`
7283 - `BetaCitationSearchResultLocation object`
70837284
70847285 - `cited_text: string`
70857286
from line 7300
70997300
71007301 Counted separately from `document_index`; server-side web search results are not included in this count.
71017302
7303 minimum: 0
7304
71027305 - `source: string`
71037306
71047307 - `start_block_index: number`
71057308
71067309 0-based index of the first cited block in the source's `content` array.
71077310
7311 minimum: 0
7312
71087313 - `title: string or null`
71097314
71107315 - `type: "search_result_location"`
71117316
7112 - `"search_result_location"`
7317 default: search_result_location
71137318
71147319 - `text: string`
71157320
7321 maxLength: 5000000, minLength: 0
7322
71167323 - `type: "text"`
71177324
7118 - `"text"`
7119
7120 - `BetaThinkingBlock object { signature, thinking, type }`
7325 default: text
7326
7327 - `BetaThinkingBlock object`
71217328
71227329 - `signature: string`
71237330
from line 7340
71337340
71347341 - `type: "thinking"`
71357342
7136 - `"thinking"`
7137
7138 - `BetaRedactedThinkingBlock object { data, type }`
7343 default: thinking
7344
7345 - `BetaRedactedThinkingBlock object`
71397346
71407347 - `data: string`
71417348
from line 7354
71477354
71487355 - `type: "redacted_thinking"`
71497356
7150 - `"redacted_thinking"`
7151
7152 - `BetaToolUseBlock object { id, input, name, 3 more }`
7357 default: redacted_thinking
7358
7359 - `BetaToolUseBlock object`
71537360
71547361 - `id: string`
71557362
7363 pattern: ^[a-zA-Z0-9_-]+$
7364
71567365 - `input: map[unknown]`
71577366
71587367 - `name: string`
71597368
7369 minLength: 1
7370
71607371 - `type: "tool_use"`
71617372
7162 - `"tool_use"`
7373 default: tool_use
71637374
71647375 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
71657376
71667377 Tool invocation directly from the model.
71677378
7168 - `BetaDirectCaller object { type }`
7379 - `BetaDirectCaller object`
71697380
71707381 Tool invocation directly from the model.
71717382
71727383 - `type: "direct"`
71737384
7174 - `"direct"`
7175
7176 - `BetaServerToolCaller object { tool_id, type }`
7385 - `BetaServerToolCaller object`
71777386
71787387 Tool invocation generated by a server-side tool.
71797388
71807389 - `tool_id: string`
71817390
7391 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7392
71827393 - `type: "code_execution_20250825"`
71837394
7184 - `"code_execution_20250825"`
7185
7186 - `BetaServerToolCaller20260120 object { tool_id, type }`
7395 - `BetaServerToolCaller20260120 object`
71877396
71887397 - `tool_id: string`
71897398
7399 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7400
71907401 - `type: "code_execution_20260120"`
71917402
7192 - `"code_execution_20260120"`
7193
71947403 - `toolset_name: optional string or null`
71957404
71967405 For a toolset member tool_use, the toolset family.
71977406
7198 - `BetaServerToolUseBlock object { id, input, name, 2 more }`
7407 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
7408
7409 - `BetaServerToolUseBlock object`
71997410
72007411 - `id: string`
72017412
7413 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7414
72027415 - `input: map[unknown]`
72037416
72047417 - `name: "advisor" or "web_search" or "web_fetch" or 5 more`
from line 7434
72217434
72227435 - `type: "server_tool_use"`
72237436
7224 - `"server_tool_use"`
7437 default: server_tool_use
72257438
72267439 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
72277440
72287441 Tool invocation directly from the model.
72297442
7230 - `BetaDirectCaller object { type }`
7443 - `BetaDirectCaller object`
72317444
72327445 Tool invocation directly from the model.
72337446
7234 - `BetaServerToolCaller object { tool_id, type }`
7447 - `BetaServerToolCaller object`
72357448
72367449 Tool invocation generated by a server-side tool.
72377450
7238 - `BetaServerToolCaller20260120 object { tool_id, type }`
7239
7240 - `BetaWebSearchToolResultBlock object { content, tool_use_id, type, caller }`
7451 - `BetaServerToolCaller20260120 object`
7452
7453 - `BetaWebSearchToolResultBlock object`
72417454
72427455 - `content: BetaWebSearchToolResultBlockContent`
72437456
7244 - `BetaWebSearchToolResultError object { error_code, type }`
7457 - `BetaWebSearchToolResultError object`
72457458
72467459 - `error_code: BetaWebSearchToolResultErrorCode`
72477460
from line 7472
72597472
72607473 - `type: "web_search_tool_result_error"`
72617474
7262 - `"web_search_tool_result_error"`
7475 default: web_search_tool_result_error
72637476
72647477 - `array of BetaWebSearchResultBlock`
72657478
from line 7484
72717484
72727485 - `type: "web_search_result"`
72737486
7274 - `"web_search_result"`
7487 default: web_search_result
72757488
72767489 - `url: string`
72777490
72787491 - `tool_use_id: string`
72797492
7493 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7494
72807495 - `type: "web_search_tool_result"`
72817496
7282 - `"web_search_tool_result"`
7497 default: web_search_tool_result
72837498
72847499 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
72857500
72867501 Tool invocation directly from the model.
72877502
7288 - `BetaDirectCaller object { type }`
7503 - `BetaDirectCaller object`
72897504
72907505 Tool invocation directly from the model.
72917506
7292 - `BetaServerToolCaller object { tool_id, type }`
7507 - `BetaServerToolCaller object`
72937508
72947509 Tool invocation generated by a server-side tool.
72957510
7296 - `BetaServerToolCaller20260120 object { tool_id, type }`
7297
7298 - `BetaWebFetchToolResultBlock object { content, tool_use_id, type, caller }`
7511 - `BetaServerToolCaller20260120 object`
7512
7513 - `BetaWebFetchToolResultBlock object`
72997514
73007515 - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock`
73017516
7302 - `BetaWebFetchToolResultErrorBlock object { error_code, type }`
7517 - `BetaWebFetchToolResultErrorBlock object`
73037518
73047519 - `error_code: BetaWebFetchToolResultErrorCode`
73057520
from line 7538
73237538
73247539 - `type: "web_fetch_tool_result_error"`
73257540
7326 - `"web_fetch_tool_result_error"`
7327
7328 - `BetaWebFetchBlock object { content, retrieved_at, type, url }`
7541 default: web_fetch_tool_result_error
7542
7543 - `BetaWebFetchBlock object`
73297544
73307545 - `content: BetaDocumentBlock`
73317546
from line 7550
73357550
73367551 - `enabled: boolean`
73377552
7553 default: false
7554
73387555 - `source: BetaBase64PDFSource or BetaPlainTextSource`
73397556
7340 - `BetaBase64PDFSource object { data, media_type, type }`
7557 - `BetaBase64PDFSource object`
73417558
73427559 - `data: string`
73437560
7561 format: byte
7562
73447563 - `media_type: "application/pdf"`
73457564
7346 - `"application/pdf"`
7347
73487565 - `type: "base64"`
73497566
7350 - `"base64"`
7351
7352 - `BetaPlainTextSource object { data, media_type, type }`
7567 - `BetaPlainTextSource object`
73537568
73547569 - `data: string`
73557570
73567571 - `media_type: "text/plain"`
73577572
7358 - `"text/plain"`
7359
73607573 - `type: "text"`
73617574
7362 - `"text"`
7363
73647575 - `title: string or null`
73657576
73667577 The title of the document
73677578
73687579 - `type: "document"`
73697580
7370 - `"document"`
7581 default: document
73717582
73727583 - `retrieved_at: string or null`
73737584
from line 7586
73757586
73767587 - `type: "web_fetch_result"`
73777588
7378 - `"web_fetch_result"`
7589 default: web_fetch_result
73797590
73807591 - `url: string`
73817592
from line 7594
73837594
73847595 - `tool_use_id: string`
73857596
7597 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7598
73867599 - `type: "web_fetch_tool_result"`
73877600
7388 - `"web_fetch_tool_result"`
7601 default: web_fetch_tool_result
73897602
73907603 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
73917604
73927605 Tool invocation directly from the model.
73937606
7394 - `BetaDirectCaller object { type }`
7607 - `BetaDirectCaller object`
73957608
73967609 Tool invocation directly from the model.
73977610
7398 - `BetaServerToolCaller object { tool_id, type }`
7611 - `BetaServerToolCaller object`
73997612
74007613 Tool invocation generated by a server-side tool.
74017614
7402 - `BetaServerToolCaller20260120 object { tool_id, type }`
7403
7404 - `BetaAdvisorToolResultBlock object { content, tool_use_id, type }`
7615 - `BetaServerToolCaller20260120 object`
7616
7617 - `BetaAdvisorToolResultBlock object`
74057618
74067619 - `content: BetaAdvisorToolResultError or BetaAdvisorResultBlock or BetaAdvisorRedactedResultBlock`
74077620
7408 - `BetaAdvisorToolResultError object { error_code, type }`
7621 - `BetaAdvisorToolResultError object`
74097622
74107623 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
74117624
from line 7638
74257638
74267639 - `type: "advisor_tool_result_error"`
74277640
7428 - `"advisor_tool_result_error"`
7429
7430 - `BetaAdvisorResultBlock object { stop_reason, text, type }`
7641 default: advisor_tool_result_error
7642
7643 - `BetaAdvisorResultBlock object`
74317644
74327645 - `stop_reason: string or null`
74337646
from line 7650
74377650
74387651 - `type: "advisor_result"`
74397652
7440 - `"advisor_result"`
7441
7442 - `BetaAdvisorRedactedResultBlock object { encrypted_content, stop_reason, type }`
7653 default: advisor_result
7654
7655 - `BetaAdvisorRedactedResultBlock object`
74437656
74447657 - `encrypted_content: string`
74457658
from line 7664
74517664
74527665 - `type: "advisor_redacted_result"`
74537666
7454 - `"advisor_redacted_result"`
7667 default: advisor_redacted_result
74557668
74567669 - `tool_use_id: string`
74577670
7671 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7672
74587673 - `type: "advisor_tool_result"`
74597674
7460 - `"advisor_tool_result"`
7461
7462 - `BetaCodeExecutionToolResultBlock object { content, tool_use_id, type }`
7675 default: advisor_tool_result
7676
7677 - `BetaCodeExecutionToolResultBlock object`
74637678
74647679 - `content: BetaCodeExecutionToolResultBlockContent`
74657680
74667681 Code execution result with encrypted stdout for PFC + web_search results.
74677682
7468 - `BetaCodeExecutionToolResultError object { error_code, type }`
7683 - `BetaCodeExecutionToolResultError object`
74697684
74707685 - `error_code: BetaCodeExecutionToolResultErrorCode`
74717686
from line 7694
74797694
74807695 - `type: "code_execution_tool_result_error"`
74817696
7482 - `"code_execution_tool_result_error"`
7483
7484 - `BetaCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
7697 default: code_execution_tool_result_error
7698
7699 - `BetaCodeExecutionResultBlock object`
74857700
74867701 - `content: array of BetaCodeExecutionOutputBlock`
74877702
from line 7704
74897704
74907705 - `type: "code_execution_output"`
74917706
7492 - `"code_execution_output"`
7707 default: code_execution_output
74937708
74947709 - `return_code: number`
74957710
from line 7714
74997714
75007715 - `type: "code_execution_result"`
75017716
7502 - `"code_execution_result"`
7503
7504 - `BetaEncryptedCodeExecutionResultBlock object { content, encrypted_stdout, return_code, 2 more }`
7717 default: code_execution_result
7718
7719 - `BetaEncryptedCodeExecutionResultBlock object`
75057720
75067721 Code execution result with encrypted stdout for PFC + web_search results.
75077722
from line 7726
75117726
75127727 - `type: "code_execution_output"`
75137728
7729 default: code_execution_output
7730
75147731 - `encrypted_stdout: string`
75157732
75167733 - `return_code: number`
from line 7736
75197736
75207737 - `type: "encrypted_code_execution_result"`
75217738
7522 - `"encrypted_code_execution_result"`
7739 default: encrypted_code_execution_result
75237740
75247741 - `tool_use_id: string`
75257742
7743 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7744
75267745 - `type: "code_execution_tool_result"`
75277746
7528 - `"code_execution_tool_result"`
7529
7530 - `BetaBashCodeExecutionToolResultBlock object { content, tool_use_id, type }`
7747 default: code_execution_tool_result
7748
7749 - `BetaBashCodeExecutionToolResultBlock object`
75317750
75327751 - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock`
75337752
7534 - `BetaBashCodeExecutionToolResultError object { error_code, type }`
7753 - `BetaBashCodeExecutionToolResultError object`
75357754
75367755 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
75377756
from line 7766
75477766
75487767 - `type: "bash_code_execution_tool_result_error"`
75497768
7550 - `"bash_code_execution_tool_result_error"`
7551
7552 - `BetaBashCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
7769 default: bash_code_execution_tool_result_error
7770
7771 - `BetaBashCodeExecutionResultBlock object`
75537772
75547773 - `content: array of BetaBashCodeExecutionOutputBlock`
75557774
from line 7776
75577776
75587777 - `type: "bash_code_execution_output"`
75597778
7560 - `"bash_code_execution_output"`
7779 default: bash_code_execution_output
75617780
75627781 - `return_code: number`
75637782
from line 7786
75677786
75687787 - `type: "bash_code_execution_result"`
75697788
7570 - `"bash_code_execution_result"`
7789 default: bash_code_execution_result
75717790
75727791 - `tool_use_id: string`
75737792
7793 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7794
75747795 - `type: "bash_code_execution_tool_result"`
75757796
7576 - `"bash_code_execution_tool_result"`
7577
7578 - `BetaTextEditorCodeExecutionToolResultBlock object { content, tool_use_id, type }`
7797 default: bash_code_execution_tool_result
7798
7799 - `BetaTextEditorCodeExecutionToolResultBlock object`
75797800
75807801 - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock`
75817802
7582 - `BetaTextEditorCodeExecutionToolResultError object { error_code, error_message, type }`
7803 - `BetaTextEditorCodeExecutionToolResultError object`
75837804
75847805 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
75857806
from line 7818
75977818
75987819 - `type: "text_editor_code_execution_tool_result_error"`
75997820
7600 - `"text_editor_code_execution_tool_result_error"`
7601
7602 - `BetaTextEditorCodeExecutionViewResultBlock object { content, file_type, num_lines, 3 more }`
7821 default: text_editor_code_execution_tool_result_error
7822
7823 - `BetaTextEditorCodeExecutionViewResultBlock object`
76037824
76047825 - `content: string`
76057826
from line 7840
76197840
76207841 - `type: "text_editor_code_execution_view_result"`
76217842
7622 - `"text_editor_code_execution_view_result"`
7623
7624 - `BetaTextEditorCodeExecutionCreateResultBlock object { is_file_update, type }`
7843 default: text_editor_code_execution_view_result
7844
7845 - `BetaTextEditorCodeExecutionCreateResultBlock object`
76257846
76267847 - `is_file_update: boolean`
76277848
76287849 - `type: "text_editor_code_execution_create_result"`
76297850
7630 - `"text_editor_code_execution_create_result"`
7631
7632 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object { lines, new_lines, new_start, 3 more }`
7851 default: text_editor_code_execution_create_result
7852
7853 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object`
76337854
76347855 - `lines: array of string or null`
76357856
from line 7864
76437864
76447865 - `type: "text_editor_code_execution_str_replace_result"`
76457866
7646 - `"text_editor_code_execution_str_replace_result"`
7867 default: text_editor_code_execution_str_replace_result
76477868
76487869 - `tool_use_id: string`
76497870
7871 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7872
76507873 - `type: "text_editor_code_execution_tool_result"`
76517874
7652 - `"text_editor_code_execution_tool_result"`
7653
7654 - `BetaToolSearchToolResultBlock object { content, tool_use_id, type }`
7875 default: text_editor_code_execution_tool_result
7876
7877 - `BetaToolSearchToolResultBlock object`
76557878
76567879 - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock`
76577880
7658 - `BetaToolSearchToolResultError object { error_code, error_message, type }`
7881 - `BetaToolSearchToolResultError object`
76597882
76607883 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
76617884
from line 7894
76717894
76727895 - `type: "tool_search_tool_result_error"`
76737896
7674 - `"tool_search_tool_result_error"`
7675
7676 - `BetaToolSearchToolSearchResultBlock object { tool_references, type }`
7897 default: tool_search_tool_result_error
7898
7899 - `BetaToolSearchToolSearchResultBlock object`
76777900
76787901 - `tool_references: array of BetaToolReferenceBlock`
76797902
76807903 - `tool_name: string`
76817904
7905 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
7906
76827907 - `type: "tool_reference"`
76837908
7684 - `"tool_reference"`
7909 default: tool_reference
76857910
76867911 - `type: "tool_search_tool_search_result"`
76877912
7688 - `"tool_search_tool_search_result"`
7913 default: tool_search_tool_search_result
76897914
76907915 - `tool_use_id: string`
76917916
7917 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
7918
76927919 - `type: "tool_search_tool_result"`
76937920
7694 - `"tool_search_tool_result"`
7695
7696 - `BetaMCPToolUseBlock object { id, input, name, 2 more }`
7921 default: tool_search_tool_result
7922
7923 - `BetaMCPToolUseBlock object`
76977924
76987925 - `id: string`
76997926
7927 pattern: ^[a-zA-Z0-9_-]+$
7928
77007929 - `input: map[unknown]`
77017930
77027931 - `name: string`
from line 7938
77097938
77107939 - `type: "mcp_tool_use"`
77117940
7712 - `"mcp_tool_use"`
7713
7714 - `BetaMCPToolResultBlock object { content, is_error, tool_use_id, type }`
7941 default: mcp_tool_use
7942
7943 - `BetaMCPToolResultBlock object`
77157944
77167945 - `content: string or array of BetaTextBlock`
77177946
from line 7956
77277956
77287957 - `text: string`
77297958
7959 maxLength: 5000000, minLength: 0
7960
77307961 - `type: "text"`
77317962
7963 default: text
7964
77327965 - `is_error: boolean`
77337966
7967 default: false
7968
77347969 - `tool_use_id: string`
77357970
7971 pattern: ^[a-zA-Z0-9_-]+$
7972
77367973 - `type: "mcp_tool_result"`
77377974
7738 - `"mcp_tool_result"`
7739
7740 - `BetaContainerUploadBlock object { file_id, type }`
7975 default: mcp_tool_result
7976
7977 - `BetaContainerUploadBlock object`
77417978
77427979 Response model for a file uploaded to the container.
77437980
from line 7982
77457982
77467983 - `type: "container_upload"`
77477984
7748 - `"container_upload"`
7749
7750 - `BetaCompactionBlock object { content, encrypted_content, type }`
7985 default: container_upload
7986
7987 - `BetaCompactionBlock object`
77517988
77527989 A compaction block returned when autocompact is triggered.
77537990
from line 8002
77658002
77668003 - `type: "compaction"`
77678004
7768 - `"compaction"`
7769
7770 - `BetaFallbackBlock object { from, to, trigger, type }`
8005 default: compaction
8006
8007 - `BetaFallbackBlock object`
77718008
77728009 Marks the point in `content` where one model's output gives way to the next.
77738010
from line 8130
78938130
78948131 - `type: "refusal"`
78958132
7896 - `"refusal"`
8133 default: refusal
78978134
78988135 - `type: "fallback"`
78998136
7900 - `"fallback"`
8137 default: fallback
79018138
79028139 - `context_management: BetaContextManagementResponse or null`
79038140
from line 8146
79098146
79108147 List of context management edits that were applied.
79118148
7912 - `BetaClearToolUses20250919EditResponse object { cleared_input_tokens, cleared_tool_uses, type }`
8149 - `BetaClearToolUses20250919EditResponse object`
79138150
79148151 - `cleared_input_tokens: number`
79158152
79168153 Number of input tokens cleared by this edit.
79178154
8155 minimum: 0
8156
79188157 - `cleared_tool_uses: number`
79198158
79208159 Number of tool uses that were cleared.
79218160
8161 minimum: 0
8162
79228163 - `type: "clear_tool_uses_20250919"`
79238164
79248165 The type of context management edit applied.
79258166
7926 - `"clear_tool_uses_20250919"`
7927
7928 - `BetaClearThinking20251015EditResponse object { cleared_input_tokens, cleared_thinking_turns, type }`
8167 default: clear_tool_uses_20250919
8168
8169 - `BetaClearThinking20251015EditResponse object`
79298170
79308171 - `cleared_input_tokens: number`
79318172
79328173 Number of input tokens cleared by this edit.
79338174
8175 minimum: 0
8176
79348177 - `cleared_thinking_turns: number`
79358178
79368179 Number of thinking turns that were cleared.
79378180
8181 minimum: 0
8182
79388183 - `type: "clear_thinking_20251015"`
79398184
79408185 The type of context management edit applied.
79418186
7942 - `"clear_thinking_20251015"`
8187 default: clear_thinking_20251015
79438188
79448189 - `diagnostics: BetaDiagnostics or null`
79458190
from line 8195
79508195
79518196 Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.
79528197
7953 - `BetaCacheMissModelChanged object { cache_missed_input_tokens, type }`
8198 - `BetaCacheMissModelChanged object`
79548199
79558200 - `cache_missed_input_tokens: number`
79568201
from line 8203
79588203
79598204 - `type: "model_changed"`
79608205
7961 - `"model_changed"`
7962
7963 - `BetaCacheMissSystemChanged object { cache_missed_input_tokens, type }`
8206 default: model_changed
8207
8208 - `BetaCacheMissSystemChanged object`
79648209
79658210 - `cache_missed_input_tokens: number`
79668211
from line 8213
79688213
79698214 - `type: "system_changed"`
79708215
7971 - `"system_changed"`
7972
7973 - `BetaCacheMissToolsChanged object { cache_missed_input_tokens, type }`
8216 default: system_changed
8217
8218 - `BetaCacheMissToolsChanged object`
79748219
79758220 - `cache_missed_input_tokens: number`
79768221
from line 8223
79788223
79798224 - `type: "tools_changed"`
79808225
7981 - `"tools_changed"`
7982
7983 - `BetaCacheMissMessagesChanged object { cache_missed_input_tokens, type }`
8226 default: tools_changed
8227
8228 - `BetaCacheMissMessagesChanged object`
79848229
79858230 - `cache_missed_input_tokens: number`
79868231
from line 8233
79888233
79898234 - `type: "messages_changed"`
79908235
7991 - `"messages_changed"`
7992
7993 - `BetaCacheMissPreviousMessageNotFound object { type }`
8236 default: messages_changed
8237
8238 - `BetaCacheMissPreviousMessageNotFound object`
79948239
79958240 - `type: "previous_message_not_found"`
79968241
7997 - `"previous_message_not_found"`
7998
7999 - `BetaCacheMissUnavailable object { type }`
8242 default: previous_message_not_found
8243
8244 - `BetaCacheMissUnavailable object`
80008245
80018246 - `type: "unavailable"`
80028247
8003 - `"unavailable"`
8248 default: unavailable
80048249
80058250 - `model: Model`
80068251
from line 8259
80148259
80158260 This will always be `"assistant"`.
80168261
8017 - `"assistant"`
8262 default: assistant
80188263
80198264 - `stop_details: BetaRefusalStopDetails or null`
80208265
from line 8346
81018346
81028347 - `type: "refusal"`
81038348
8104 - `"refusal"`
8349 default: refusal
81058350
81068351 - `stop_reason: BetaStopReason or null`
81078352
from line 8392
81478392
81488393 For Messages, this is always `"message"`.
81498394
8150 - `"message"`
8395 default: message
81518396
81528397 - `usage: BetaUsage`
81538398
from line 8414
81698414
81708415 The number of input tokens used to create the 1 hour cache entry.
81718416
8417 default: 0, minimum: 0
8418
81728419 - `ephemeral_5m_input_tokens: number`
81738420
81748421 The number of input tokens used to create the 5 minute cache entry.
81758422
8423 default: 0, minimum: 0
8424
81768425 - `cache_creation_input_tokens: number or null`
81778426
81788427 The number of input tokens used to create the cache entry.
81798428
8429 minimum: 0
8430
81808431 - `cache_read_input_tokens: number or null`
81818432
81828433 The number of input tokens read from the cache.
8434
8435 minimum: 0
81838436
81848437 - `fallback_credit: BetaFallbackCreditUsage or null`
81858438
from line 8447
81948447 resulting shift is zero because there was nothing to move. `not_applied`:
81958448 no reprice was applied; the arm's `reason` says why.
81968449
8197 - `BetaFallbackCreditRedeemed object { type }`
8450 - `BetaFallbackCreditRedeemed object`
81988451
81998452 The reprice was applied: the retry is billed as if the conversation
82008453 had been on the retry model all along.
82018454
82028455 - `type: "redeemed"`
82038456
8204 - `"redeemed"`
8205
8206 - `BetaFallbackCreditNotApplied object { reason, type, remove_to_redeem }`
8457 default: redeemed
8458
8459 - `BetaFallbackCreditNotApplied object`
82078460
82088461 No reprice was applied; `reason` says why.
82098462
from line 8493
82408493
82418494 - `type: "not_applied"`
82428495
8243 - `"not_applied"`
8496 default: not_applied
82448497
82458498 - `remove_to_redeem: optional array of string or null`
82468499
from line 8514
82618514
82628515 The number of input tokens which were used.
82638516
8517 minimum: 0
8518
82648519 - `iterations: BetaIterationsUsage or null`
82658520
82668521 Per-iteration token usage breakdown.
from line 8526
82718526 - Calculate the true context window size from the last iteration
82728527 - Understand token accumulation across server-side tool use loops
82738528
8274 - `BetaMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
8529 - `BetaMessageIterationUsage object`
82758530
82768531 Token usage for a sampling iteration.
82778532
from line 8538
82838538
82848539 The number of input tokens used to create the cache entry.
82858540
8541 default: 0, minimum: 0
8542
82868543 - `cache_read_input_tokens: number`
82878544
82888545 The number of input tokens read from the cache.
82898546
8547 default: 0, minimum: 0
8548
82908549 - `input_tokens: number`
82918550
82928551 The number of input tokens which were used.
82938552
8553 minimum: 0
8554
82948555 - `model: Model`
82958556
82968557 The model that will complete your prompt.
from line 8562
83018562
83028563 The number of output tokens which were used.
83038564
8565 minimum: 0
8566
83048567 - `type: "message"`
83058568
83068569 Usage for a sampling iteration
83078570
8308 - `"message"`
8309
8310 - `BetaCompactionIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }`
8571 default: message
8572
8573 - `BetaCompactionIterationUsage object`
83118574
83128575 Token usage for a compaction iteration.
83138576
from line 8582
83198582
83208583 The number of input tokens used to create the cache entry.
83218584
8585 default: 0, minimum: 0
8586
83228587 - `cache_read_input_tokens: number`
83238588
83248589 The number of input tokens read from the cache.
83258590
8591 default: 0, minimum: 0
8592
83268593 - `input_tokens: number`
83278594
83288595 The number of input tokens which were used.
83298596
8597 minimum: 0
8598
83308599 - `output_tokens: number`
83318600
83328601 The number of output tokens which were used.
83338602
8603 minimum: 0
8604
83348605 - `type: "compaction"`
83358606
83368607 Usage for a compaction iteration
83378608
8338 - `"compaction"`
8339
8340 - `BetaAdvisorMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
8609 default: compaction
8610
8611 - `BetaAdvisorMessageIterationUsage object`
83418612
83428613 Token usage for an advisor sub-inference iteration.
83438614
from line 8620
83498620
83508621 The number of input tokens used to create the cache entry.
83518622
8623 default: 0, minimum: 0
8624
83528625 - `cache_read_input_tokens: number`
83538626
83548627 The number of input tokens read from the cache.
83558628
8629 default: 0, minimum: 0
8630
83568631 - `input_tokens: number`
83578632
83588633 The number of input tokens which were used.
83598634
8635 minimum: 0
8636
83608637 - `model: Model`
83618638
83628639 The model that will complete your prompt.
from line 8644
83678644
83688645 The number of output tokens which were used.
83698646
8647 minimum: 0
8648
83708649 - `type: "advisor_message"`
83718650
83728651 Usage for an advisor sub-inference iteration
83738652
8374 - `"advisor_message"`
8375
8376 - `BetaFallbackMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
8653 default: advisor_message
8654
8655 - `BetaFallbackMessageIterationUsage object`
83778656
83788657 Token usage for the fallback-model attempt of a server-side fallback request.
83798658
from line 8669
83908669
83918670 The number of input tokens used to create the cache entry.
83928671
8672 default: 0, minimum: 0
8673
83938674 - `cache_read_input_tokens: number`
83948675
83958676 The number of input tokens read from the cache.
83968677
8678 default: 0, minimum: 0
8679
83978680 - `input_tokens: number`
83988681
83998682 The number of input tokens which were used.
84008683
8684 minimum: 0
8685
84018686 - `model: Model`
84028687
84038688 The model that will complete your prompt.
from line 8693
84088693
84098694 The number of output tokens which were used.
84108695
8696 minimum: 0
8697
84118698 - `type: "fallback_message"`
84128699
84138700 Usage for the fallback-model attempt that served the response
84148701
8415 - `"fallback_message"`
8702 default: fallback_message
84168703
84178704 - `output_tokens: number`
84188705
84198706 The number of output tokens which were used.
8707
8708 minimum: 0
84208709
84218710 - `output_tokens_details: BetaOutputTokensDetails or null`
84228711
from line 8727
84388727 generation count by a small number of tokens. Always ≤ `output_tokens`;
84398728 `output_tokens - thinking_tokens` approximates the non-reasoning output.
84408729
8730 default: 0, minimum: 0
8731
84418732 - `server_tool_use: BetaServerToolUsage or null`
84428733
84438734 The number of server tool requests.
from line 8737
84468737
84478738 The number of web fetch tool requests.
84488739
8740 default: 0, minimum: 0
8741
84498742 - `web_search_requests: number`
84508743
84518744 The number of web search tool requests.
84528745
8746 default: 0, minimum: 0
8747
84538748 - `service_tier: "standard" or "priority" or "batch" or null`
84548749
84558750 If the request used the priority, standard, or batch tier.
from line 8765
84708765
84718766 - `type: "succeeded"`
84728767
8473 - `"succeeded"`
8474
8475 - `BetaMessageBatchErroredResult object { error, type }`
8768 default: succeeded
8769
8770 - `BetaMessageBatchErroredResult object`
84768771
84778772 - `error: BetaErrorResponse`
84788773
84798774 - `error: BetaError`
84808775
8481 - `BetaInvalidRequestError object { message, type }`
8776 - `BetaInvalidRequestError object`
84828777
84838778 - `message: string`
84848779
8780 default: Invalid request
8781
84858782 - `type: "invalid_request_error"`
84868783
8487 - `"invalid_request_error"`
8488
8489 - `BetaAuthenticationError object { message, type }`
8784 default: invalid_request_error
8785
8786 - `BetaAuthenticationError object`
84908787
84918788 - `message: string`
84928789
8790 default: Authentication error
8791
84938792 - `type: "authentication_error"`
84948793
8495 - `"authentication_error"`
8496
8497 - `BetaBillingError object { message, type }`
8794 default: authentication_error
8795
8796 - `BetaBillingError object`
84988797
84998798 - `message: string`
85008799
8800 default: Billing error
8801
85018802 - `type: "billing_error"`
85028803
8503 - `"billing_error"`
8504
8505 - `BetaPermissionError object { message, type }`
8804 default: billing_error
8805
8806 - `BetaPermissionError object`
85068807
85078808 - `message: string`
85088809
8810 default: Permission denied
8811
85098812 - `type: "permission_error"`
85108813
8511 - `"permission_error"`
8512
8513 - `BetaNotFoundError object { message, type }`
8814 default: permission_error
8815
8816 - `BetaNotFoundError object`
85148817
85158818 - `message: string`
85168819
8820 default: Not found
8821
85178822 - `type: "not_found_error"`
85188823
8519 - `"not_found_error"`
8520
8521 - `BetaRateLimitError object { message, type }`
8824 default: not_found_error
8825
8826 - `BetaRateLimitError object`
85228827
85238828 - `message: string`
85248829
8830 default: Rate limited
8831
85258832 - `type: "rate_limit_error"`
85268833
8527 - `"rate_limit_error"`
8528
8529 - `BetaGatewayTimeoutError object { message, type }`
8834 default: rate_limit_error
8835
8836 - `BetaGatewayTimeoutError object`
85308837
85318838 - `message: string`
85328839
8840 default: Request timeout
8841
85338842 - `type: "timeout_error"`
85348843
8535 - `"timeout_error"`
8536
8537 - `BetaAPIError object { message, type }`
8844 default: timeout_error
8845
8846 - `BetaAPIError object`
85388847
85398848 - `message: string`
85408849
8850 default: Internal server error
8851
85418852 - `type: "api_error"`
85428853
8543 - `"api_error"`
8544
8545 - `BetaOverloadedError object { message, type }`
8854 default: api_error
8855
8856 - `BetaOverloadedError object`
85468857
85478858 - `message: string`
85488859
8860 default: Overloaded
8861
85498862 - `type: "overloaded_error"`
85508863
8551 - `"overloaded_error"`
8864 default: overloaded_error
85528865
85538866 - `request_id: string or null`
85548867
85558868 - `type: "error"`
85568869
8557 - `"error"`
8870 default: error
85588871
85598872 - `type: "errored"`
85608873
8561 - `"errored"`
8562
8563 - `BetaMessageBatchCanceledResult object { type }`
8874 default: errored
8875
8876 - `BetaMessageBatchCanceledResult object`
85648877
85658878 - `type: "canceled"`
85668879
8567 - `"canceled"`
8568
8569 - `BetaMessageBatchExpiredResult object { type }`
8880 default: canceled
8881
8882 - `BetaMessageBatchExpiredResult object`
85708883
85718884 - `type: "expired"`
85728885
8573 - `"expired"`
8886 default: expired
85748887
85758888### Beta Message Batch Request Counts
85768889
8577- `BetaMessageBatchRequestCounts object { canceled, errored, expired, 2 more }`
8890- `BetaMessageBatchRequestCounts object`
85788891
85798892 - `canceled: number`
85808893
from line 8895
85828895
85838896 This is zero until processing of the entire Message Batch has ended.
85848897
8898 default: 0
8899
85858900 - `errored: number`
85868901
85878902 Number of requests in the Message Batch that encountered an error.
85888903
85898904 This is zero until processing of the entire Message Batch has ended.
85908905
8906 default: 0
8907
85918908 - `expired: number`
85928909
85938910 Number of requests in the Message Batch that have expired.
85948911
85958912 This is zero until processing of the entire Message Batch has ended.
85968913
8914 default: 0
8915
85978916 - `processing: number`
85988917
85998918 Number of requests in the Message Batch that are processing.
86008919
8920 default: 0
8921
86018922 - `succeeded: number`
86028923
86038924 Number of requests in the Message Batch that have completed successfully.
86048925
86058926 This is zero until processing of the entire Message Batch has ended.
86068927
8928 default: 0
8929
86078930### Beta Message Batch Result
86088931
86098932- `BetaMessageBatchResult = BetaMessageBatchSucceededResult or BetaMessageBatchErroredResult or BetaMessageBatchCanceledResult or BetaMessageBatchExpiredResult`
from line 8935
86128935
86138936 Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
86148937
8615 - `BetaMessageBatchSucceededResult object { message, type }`
8938 - `BetaMessageBatchSucceededResult object`
86168939
86178940 - `message: BetaMessage`
86188941
from line 8957
86348957
86358958 The time at which the container will expire.
86368959
8960 format: date-time
8961
86378962 - `skills: array of BetaSkill or null`
86388963
86398964 Skills loaded in the container
from line 8967
86428967
86438968 Skill ID
86448969
8970 maxLength: 64, minLength: 1
8971
86458972 - `type: "anthropic" or "custom"`
86468973
86478974 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 8980
86538980 - `version: string`
86548981
86558982 The resolved version: a skill version ID for custom skills.
8983
8984 maxLength: 64, minLength: 1
86568985
86578986 - `content: array of BetaContentBlock`
86588987
from line 9012
86839012 [{"type": "text", "text": "B)"}]
86849013 ```
86859014
8686 - `BetaTextBlock object { citations, text, type }`
9015 - `BetaTextBlock object`
86879016
86889017 - `citations: array of BetaTextCitation or null`
86899018
from line 9020
86919020
86929021 The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
86939022
8694 - `BetaCitationCharLocation object { cited_text, document_index, document_title, 4 more }`
9023 - `BetaCitationCharLocation object`
86959024
86969025 - `cited_text: string`
86979026
86989027 - `document_index: number`
86999028
9029 minimum: 0
9030
87009031 - `document_title: string or null`
87019032
87029033 - `end_char_index: number`
from line 9036
87059036
87069037 - `start_char_index: number`
87079038
9039 minimum: 0
9040
87089041 - `type: "char_location"`
87099042
8710 - `"char_location"`
8711
8712 - `BetaCitationPageLocation object { cited_text, document_index, document_title, 4 more }`
9043 default: char_location
9044
9045 - `BetaCitationPageLocation object`
87139046
87149047 - `cited_text: string`
87159048
87169049 - `document_index: number`
87179050
9051 minimum: 0
9052
87189053 - `document_title: string or null`
87199054
87209055 - `end_page_number: number`
from line 9058
87239058
87249059 - `start_page_number: number`
87259060
9061 minimum: 1
9062
87269063 - `type: "page_location"`
87279064
8728 - `"page_location"`
8729
8730 - `BetaCitationContentBlockLocation object { cited_text, document_index, document_title, 4 more }`
9065 default: page_location
9066
9067 - `BetaCitationContentBlockLocation object`
87319068
87329069 - `cited_text: string`
87339070
from line 9074
87379074
87389075 - `document_index: number`
87399076
9077 minimum: 0
9078
87409079 - `document_title: string or null`
87419080
87429081 - `end_block_index: number`
from line 9090
87519090
87529091 0-based index of the first cited block in the source's `content` array.
87539092
9093 minimum: 0
9094
87549095 - `type: "content_block_location"`
87559096
8756 - `"content_block_location"`
8757
8758 - `BetaCitationsWebSearchResultLocation object { cited_text, encrypted_index, title, 2 more }`
9097 default: content_block_location
9098
9099 - `BetaCitationsWebSearchResultLocation object`
87599100
87609101 - `cited_text: string`
87619102
from line 9104
87639104
87649105 - `title: string or null`
87659106
9107 maxLength: 512
9108
87669109 - `type: "web_search_result_location"`
87679110
8768 - `"web_search_result_location"`
9111 default: web_search_result_location
87699112
87709113 - `url: string`
87719114
8772 - `BetaCitationSearchResultLocation object { cited_text, end_block_index, search_result_index, 4 more }`
9115 - `BetaCitationSearchResultLocation object`
87739116
87749117 - `cited_text: string`
87759118
from line 9132
87899132
87909133 Counted separately from `document_index`; server-side web search results are not included in this count.
87919134
9135 minimum: 0
9136
87929137 - `source: string`
87939138
87949139 - `start_block_index: number`
87959140
87969141 0-based index of the first cited block in the source's `content` array.
87979142
9143 minimum: 0
9144
87989145 - `title: string or null`
87999146
88009147 - `type: "search_result_location"`
88019148
8802 - `"search_result_location"`
9149 default: search_result_location
88039150
88049151 - `text: string`
88059152
9153 maxLength: 5000000, minLength: 0
9154
88069155 - `type: "text"`
88079156
8808 - `"text"`
8809
8810 - `BetaThinkingBlock object { signature, thinking, type }`
9157 default: text
9158
9159 - `BetaThinkingBlock object`
88119160
88129161 - `signature: string`
88139162
from line 9172
88239172
88249173 - `type: "thinking"`
88259174
8826 - `"thinking"`
8827
8828 - `BetaRedactedThinkingBlock object { data, type }`
9175 default: thinking
9176
9177 - `BetaRedactedThinkingBlock object`
88299178
88309179 - `data: string`
88319180
from line 9186
88379186
88389187 - `type: "redacted_thinking"`
88399188
8840 - `"redacted_thinking"`
8841
8842 - `BetaToolUseBlock object { id, input, name, 3 more }`
9189 default: redacted_thinking
9190
9191 - `BetaToolUseBlock object`
88439192
88449193 - `id: string`
88459194
9195 pattern: ^[a-zA-Z0-9_-]+$
9196
88469197 - `input: map[unknown]`
88479198
88489199 - `name: string`
88499200
9201 minLength: 1
9202
88509203 - `type: "tool_use"`
88519204
8852 - `"tool_use"`
9205 default: tool_use
88539206
88549207 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
88559208
88569209 Tool invocation directly from the model.
88579210
8858 - `BetaDirectCaller object { type }`
9211 - `BetaDirectCaller object`
88599212
88609213 Tool invocation directly from the model.
88619214
88629215 - `type: "direct"`
88639216
8864 - `"direct"`
8865
8866 - `BetaServerToolCaller object { tool_id, type }`
9217 - `BetaServerToolCaller object`
88679218
88689219 Tool invocation generated by a server-side tool.
88699220
88709221 - `tool_id: string`
88719222
9223 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9224
88729225 - `type: "code_execution_20250825"`
88739226
8874 - `"code_execution_20250825"`
8875
8876 - `BetaServerToolCaller20260120 object { tool_id, type }`
9227 - `BetaServerToolCaller20260120 object`
88779228
88789229 - `tool_id: string`
88799230
9231 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9232
88809233 - `type: "code_execution_20260120"`
88819234
8882 - `"code_execution_20260120"`
8883
88849235 - `toolset_name: optional string or null`
88859236
88869237 For a toolset member tool_use, the toolset family.
88879238
8888 - `BetaServerToolUseBlock object { id, input, name, 2 more }`
9239 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
9240
9241 - `BetaServerToolUseBlock object`
88899242
88909243 - `id: string`
88919244
9245 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9246
88929247 - `input: map[unknown]`
88939248
88949249 - `name: "advisor" or "web_search" or "web_fetch" or 5 more`
from line 9266
89119266
89129267 - `type: "server_tool_use"`
89139268
8914 - `"server_tool_use"`
9269 default: server_tool_use
89159270
89169271 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
89179272
89189273 Tool invocation directly from the model.
89199274
8920 - `BetaDirectCaller object { type }`
9275 - `BetaDirectCaller object`
89219276
89229277 Tool invocation directly from the model.
89239278
8924 - `BetaServerToolCaller object { tool_id, type }`
9279 - `BetaServerToolCaller object`
89259280
89269281 Tool invocation generated by a server-side tool.
89279282
8928 - `BetaServerToolCaller20260120 object { tool_id, type }`
8929
8930 - `BetaWebSearchToolResultBlock object { content, tool_use_id, type, caller }`
9283 - `BetaServerToolCaller20260120 object`
9284
9285 - `BetaWebSearchToolResultBlock object`
89319286
89329287 - `content: BetaWebSearchToolResultBlockContent`
89339288
8934 - `BetaWebSearchToolResultError object { error_code, type }`
9289 - `BetaWebSearchToolResultError object`
89359290
89369291 - `error_code: BetaWebSearchToolResultErrorCode`
89379292
from line 9304
89499304
89509305 - `type: "web_search_tool_result_error"`
89519306
8952 - `"web_search_tool_result_error"`
9307 default: web_search_tool_result_error
89539308
89549309 - `array of BetaWebSearchResultBlock`
89559310
from line 9316
89619316
89629317 - `type: "web_search_result"`
89639318
8964 - `"web_search_result"`
9319 default: web_search_result
89659320
89669321 - `url: string`
89679322
89689323 - `tool_use_id: string`
89699324
9325 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9326
89709327 - `type: "web_search_tool_result"`
89719328
8972 - `"web_search_tool_result"`
9329 default: web_search_tool_result
89739330
89749331 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
89759332
89769333 Tool invocation directly from the model.
89779334
8978 - `BetaDirectCaller object { type }`
9335 - `BetaDirectCaller object`
89799336
89809337 Tool invocation directly from the model.
89819338
8982 - `BetaServerToolCaller object { tool_id, type }`
9339 - `BetaServerToolCaller object`
89839340
89849341 Tool invocation generated by a server-side tool.
89859342
8986 - `BetaServerToolCaller20260120 object { tool_id, type }`
8987
8988 - `BetaWebFetchToolResultBlock object { content, tool_use_id, type, caller }`
9343 - `BetaServerToolCaller20260120 object`
9344
9345 - `BetaWebFetchToolResultBlock object`
89899346
89909347 - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock`
89919348
8992 - `BetaWebFetchToolResultErrorBlock object { error_code, type }`
9349 - `BetaWebFetchToolResultErrorBlock object`
89939350
89949351 - `error_code: BetaWebFetchToolResultErrorCode`
89959352
from line 9370
90139370
90149371 - `type: "web_fetch_tool_result_error"`
90159372
9016 - `"web_fetch_tool_result_error"`
9017
9018 - `BetaWebFetchBlock object { content, retrieved_at, type, url }`
9373 default: web_fetch_tool_result_error
9374
9375 - `BetaWebFetchBlock object`
90199376
90209377 - `content: BetaDocumentBlock`
90219378
from line 9382
90259382
90269383 - `enabled: boolean`
90279384
9385 default: false
9386
90289387 - `source: BetaBase64PDFSource or BetaPlainTextSource`
90299388
9030 - `BetaBase64PDFSource object { data, media_type, type }`
9389 - `BetaBase64PDFSource object`
90319390
90329391 - `data: string`
90339392
9393 format: byte
9394
90349395 - `media_type: "application/pdf"`
90359396
9036 - `"application/pdf"`
9037
90389397 - `type: "base64"`
90399398
9040 - `"base64"`
9041
9042 - `BetaPlainTextSource object { data, media_type, type }`
9399 - `BetaPlainTextSource object`
90439400
90449401 - `data: string`
90459402
90469403 - `media_type: "text/plain"`
90479404
9048 - `"text/plain"`
9049
90509405 - `type: "text"`
90519406
9052 - `"text"`
9053
90549407 - `title: string or null`
90559408
90569409 The title of the document
90579410
90589411 - `type: "document"`
90599412
9060 - `"document"`
9413 default: document
90619414
90629415 - `retrieved_at: string or null`
90639416
from line 9418
90659418
90669419 - `type: "web_fetch_result"`
90679420
9068 - `"web_fetch_result"`
9421 default: web_fetch_result
90699422
90709423 - `url: string`
90719424
from line 9426
90739426
90749427 - `tool_use_id: string`
90759428
9429 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9430
90769431 - `type: "web_fetch_tool_result"`
90779432
9078 - `"web_fetch_tool_result"`
9433 default: web_fetch_tool_result
90799434
90809435 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
90819436
90829437 Tool invocation directly from the model.
90839438
9084 - `BetaDirectCaller object { type }`
9439 - `BetaDirectCaller object`
90859440
90869441 Tool invocation directly from the model.
90879442
9088 - `BetaServerToolCaller object { tool_id, type }`
9443 - `BetaServerToolCaller object`
90899444
90909445 Tool invocation generated by a server-side tool.
90919446
9092 - `BetaServerToolCaller20260120 object { tool_id, type }`
9093
9094 - `BetaAdvisorToolResultBlock object { content, tool_use_id, type }`
9447 - `BetaServerToolCaller20260120 object`
9448
9449 - `BetaAdvisorToolResultBlock object`
90959450
90969451 - `content: BetaAdvisorToolResultError or BetaAdvisorResultBlock or BetaAdvisorRedactedResultBlock`
90979452
9098 - `BetaAdvisorToolResultError object { error_code, type }`
9453 - `BetaAdvisorToolResultError object`
90999454
91009455 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
91019456
from line 9470
91159470
91169471 - `type: "advisor_tool_result_error"`
91179472
9118 - `"advisor_tool_result_error"`
9119
9120 - `BetaAdvisorResultBlock object { stop_reason, text, type }`
9473 default: advisor_tool_result_error
9474
9475 - `BetaAdvisorResultBlock object`
91219476
91229477 - `stop_reason: string or null`
91239478
from line 9482
91279482
91289483 - `type: "advisor_result"`
91299484
9130 - `"advisor_result"`
9131
9132 - `BetaAdvisorRedactedResultBlock object { encrypted_content, stop_reason, type }`
9485 default: advisor_result
9486
9487 - `BetaAdvisorRedactedResultBlock object`
91339488
91349489 - `encrypted_content: string`
91359490
from line 9496
91419496
91429497 - `type: "advisor_redacted_result"`
91439498
9144 - `"advisor_redacted_result"`
9499 default: advisor_redacted_result
91459500
91469501 - `tool_use_id: string`
91479502
9503 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9504
91489505 - `type: "advisor_tool_result"`
91499506
9150 - `"advisor_tool_result"`
9151
9152 - `BetaCodeExecutionToolResultBlock object { content, tool_use_id, type }`
9507 default: advisor_tool_result
9508
9509 - `BetaCodeExecutionToolResultBlock object`
91539510
91549511 - `content: BetaCodeExecutionToolResultBlockContent`
91559512
91569513 Code execution result with encrypted stdout for PFC + web_search results.
91579514
9158 - `BetaCodeExecutionToolResultError object { error_code, type }`
9515 - `BetaCodeExecutionToolResultError object`
91599516
91609517 - `error_code: BetaCodeExecutionToolResultErrorCode`
91619518
from line 9526
91699526
91709527 - `type: "code_execution_tool_result_error"`
91719528
9172 - `"code_execution_tool_result_error"`
9173
9174 - `BetaCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
9529 default: code_execution_tool_result_error
9530
9531 - `BetaCodeExecutionResultBlock object`
91759532
91769533 - `content: array of BetaCodeExecutionOutputBlock`
91779534
from line 9536
91799536
91809537 - `type: "code_execution_output"`
91819538
9182 - `"code_execution_output"`
9539 default: code_execution_output
91839540
91849541 - `return_code: number`
91859542
from line 9546
91899546
91909547 - `type: "code_execution_result"`
91919548
9192 - `"code_execution_result"`
9193
9194 - `BetaEncryptedCodeExecutionResultBlock object { content, encrypted_stdout, return_code, 2 more }`
9549 default: code_execution_result
9550
9551 - `BetaEncryptedCodeExecutionResultBlock object`
91959552
91969553 Code execution result with encrypted stdout for PFC + web_search results.
91979554
from line 9558
92019558
92029559 - `type: "code_execution_output"`
92039560
9561 default: code_execution_output
9562
92049563 - `encrypted_stdout: string`
92059564
92069565 - `return_code: number`
from line 9568
92099568
92109569 - `type: "encrypted_code_execution_result"`
92119570
9212 - `"encrypted_code_execution_result"`
9571 default: encrypted_code_execution_result
92139572
92149573 - `tool_use_id: string`
92159574
9575 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9576
92169577 - `type: "code_execution_tool_result"`
92179578
9218 - `"code_execution_tool_result"`
9219
9220 - `BetaBashCodeExecutionToolResultBlock object { content, tool_use_id, type }`
9579 default: code_execution_tool_result
9580
9581 - `BetaBashCodeExecutionToolResultBlock object`
92219582
92229583 - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock`
92239584
9224 - `BetaBashCodeExecutionToolResultError object { error_code, type }`
9585 - `BetaBashCodeExecutionToolResultError object`
92259586
92269587 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
92279588
from line 9598
92379598
92389599 - `type: "bash_code_execution_tool_result_error"`
92399600
9240 - `"bash_code_execution_tool_result_error"`
9241
9242 - `BetaBashCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
9601 default: bash_code_execution_tool_result_error
9602
9603 - `BetaBashCodeExecutionResultBlock object`
92439604
92449605 - `content: array of BetaBashCodeExecutionOutputBlock`
92459606
from line 9608
92479608
92489609 - `type: "bash_code_execution_output"`
92499610
9250 - `"bash_code_execution_output"`
9611 default: bash_code_execution_output
92519612
92529613 - `return_code: number`
92539614
from line 9618
92579618
92589619 - `type: "bash_code_execution_result"`
92599620
9260 - `"bash_code_execution_result"`
9621 default: bash_code_execution_result
92619622
92629623 - `tool_use_id: string`
92639624
9625 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9626
92649627 - `type: "bash_code_execution_tool_result"`
92659628
9266 - `"bash_code_execution_tool_result"`
9267
9268 - `BetaTextEditorCodeExecutionToolResultBlock object { content, tool_use_id, type }`
9629 default: bash_code_execution_tool_result
9630
9631 - `BetaTextEditorCodeExecutionToolResultBlock object`
92699632
92709633 - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock`
92719634
9272 - `BetaTextEditorCodeExecutionToolResultError object { error_code, error_message, type }`
9635 - `BetaTextEditorCodeExecutionToolResultError object`
92739636
92749637 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
92759638
from line 9650
92879650
92889651 - `type: "text_editor_code_execution_tool_result_error"`
92899652
9290 - `"text_editor_code_execution_tool_result_error"`
9291
9292 - `BetaTextEditorCodeExecutionViewResultBlock object { content, file_type, num_lines, 3 more }`
9653 default: text_editor_code_execution_tool_result_error
9654
9655 - `BetaTextEditorCodeExecutionViewResultBlock object`
92939656
92949657 - `content: string`
92959658
from line 9672
93099672
93109673 - `type: "text_editor_code_execution_view_result"`
93119674
9312 - `"text_editor_code_execution_view_result"`
9313
9314 - `BetaTextEditorCodeExecutionCreateResultBlock object { is_file_update, type }`
9675 default: text_editor_code_execution_view_result
9676
9677 - `BetaTextEditorCodeExecutionCreateResultBlock object`
93159678
93169679 - `is_file_update: boolean`
93179680
93189681 - `type: "text_editor_code_execution_create_result"`
93199682
9320 - `"text_editor_code_execution_create_result"`
9321
9322 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object { lines, new_lines, new_start, 3 more }`
9683 default: text_editor_code_execution_create_result
9684
9685 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object`
93239686
93249687 - `lines: array of string or null`
93259688
from line 9696
93339696
93349697 - `type: "text_editor_code_execution_str_replace_result"`
93359698
9336 - `"text_editor_code_execution_str_replace_result"`
9699 default: text_editor_code_execution_str_replace_result
93379700
93389701 - `tool_use_id: string`
93399702
9703 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9704
93409705 - `type: "text_editor_code_execution_tool_result"`
93419706
9342 - `"text_editor_code_execution_tool_result"`
9343
9344 - `BetaToolSearchToolResultBlock object { content, tool_use_id, type }`
9707 default: text_editor_code_execution_tool_result
9708
9709 - `BetaToolSearchToolResultBlock object`
93459710
93469711 - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock`
93479712
9348 - `BetaToolSearchToolResultError object { error_code, error_message, type }`
9713 - `BetaToolSearchToolResultError object`
93499714
93509715 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
93519716
from line 9726
93619726
93629727 - `type: "tool_search_tool_result_error"`
93639728
9364 - `"tool_search_tool_result_error"`
9365
9366 - `BetaToolSearchToolSearchResultBlock object { tool_references, type }`
9729 default: tool_search_tool_result_error
9730
9731 - `BetaToolSearchToolSearchResultBlock object`
93679732
93689733 - `tool_references: array of BetaToolReferenceBlock`
93699734
93709735 - `tool_name: string`
93719736
9737 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
9738
93729739 - `type: "tool_reference"`
93739740
9374 - `"tool_reference"`
9741 default: tool_reference
93759742
93769743 - `type: "tool_search_tool_search_result"`
93779744
9378 - `"tool_search_tool_search_result"`
9745 default: tool_search_tool_search_result
93799746
93809747 - `tool_use_id: string`
93819748
9749 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
9750
93829751 - `type: "tool_search_tool_result"`
93839752
9384 - `"tool_search_tool_result"`
9385
9386 - `BetaMCPToolUseBlock object { id, input, name, 2 more }`
9753 default: tool_search_tool_result
9754
9755 - `BetaMCPToolUseBlock object`
93879756
93889757 - `id: string`
93899758
9759 pattern: ^[a-zA-Z0-9_-]+$
9760
93909761 - `input: map[unknown]`
93919762
93929763 - `name: string`
from line 9770
93999770
94009771 - `type: "mcp_tool_use"`
94019772
9402 - `"mcp_tool_use"`
9403
9404 - `BetaMCPToolResultBlock object { content, is_error, tool_use_id, type }`
9773 default: mcp_tool_use
9774
9775 - `BetaMCPToolResultBlock object`
94059776
94069777 - `content: string or array of BetaTextBlock`
94079778
from line 9788
94179788
94189789 - `text: string`
94199790
9791 maxLength: 5000000, minLength: 0
9792
94209793 - `type: "text"`
94219794
9795 default: text
9796
94229797 - `is_error: boolean`
94239798
9799 default: false
9800
94249801 - `tool_use_id: string`
94259802
9803 pattern: ^[a-zA-Z0-9_-]+$
9804
94269805 - `type: "mcp_tool_result"`
94279806
9428 - `"mcp_tool_result"`
9429
9430 - `BetaContainerUploadBlock object { file_id, type }`
9807 default: mcp_tool_result
9808
9809 - `BetaContainerUploadBlock object`
94319810
94329811 Response model for a file uploaded to the container.
94339812
from line 9814
94359814
94369815 - `type: "container_upload"`
94379816
9438 - `"container_upload"`
9439
9440 - `BetaCompactionBlock object { content, encrypted_content, type }`
9817 default: container_upload
9818
9819 - `BetaCompactionBlock object`
94419820
94429821 A compaction block returned when autocompact is triggered.
94439822
from line 9834
94559834
94569835 - `type: "compaction"`
94579836
9458 - `"compaction"`
9459
9460 - `BetaFallbackBlock object { from, to, trigger, type }`
9837 default: compaction
9838
9839 - `BetaFallbackBlock object`
94619840
94629841 Marks the point in `content` where one model's output gives way to the next.
94639842
from line 9962
95839962
95849963 - `type: "refusal"`
95859964
9586 - `"refusal"`
9965 default: refusal
95879966
95889967 - `type: "fallback"`
95899968
9590 - `"fallback"`
9969 default: fallback
95919970
95929971 - `context_management: BetaContextManagementResponse or null`
95939972
from line 9978
95999978
96009979 List of context management edits that were applied.
96019980
9602 - `BetaClearToolUses20250919EditResponse object { cleared_input_tokens, cleared_tool_uses, type }`
9981 - `BetaClearToolUses20250919EditResponse object`
96039982
96049983 - `cleared_input_tokens: number`
96059984
96069985 Number of input tokens cleared by this edit.
96079986
9987 minimum: 0
9988
96089989 - `cleared_tool_uses: number`
96099990
96109991 Number of tool uses that were cleared.
96119992
9993 minimum: 0
9994
96129995 - `type: "clear_tool_uses_20250919"`
96139996
96149997 The type of context management edit applied.
96159998
9616 - `"clear_tool_uses_20250919"`
9617
9618 - `BetaClearThinking20251015EditResponse object { cleared_input_tokens, cleared_thinking_turns, type }`
9999 default: clear_tool_uses_20250919
10000
10001 - `BetaClearThinking20251015EditResponse object`
961910002
962010003 - `cleared_input_tokens: number`
962110004
962210005 Number of input tokens cleared by this edit.
962310006
10007 minimum: 0
10008
962410009 - `cleared_thinking_turns: number`
962510010
962610011 Number of thinking turns that were cleared.
962710012
10013 minimum: 0
10014
962810015 - `type: "clear_thinking_20251015"`
962910016
963010017 The type of context management edit applied.
963110018
9632 - `"clear_thinking_20251015"`
10019 default: clear_thinking_20251015
963310020
963410021 - `diagnostics: BetaDiagnostics or null`
963510022
from line 10027
964010027
964110028 Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.
964210029
9643 - `BetaCacheMissModelChanged object { cache_missed_input_tokens, type }`
10030 - `BetaCacheMissModelChanged object`
964410031
964510032 - `cache_missed_input_tokens: number`
964610033
from line 10035
964810035
964910036 - `type: "model_changed"`
965010037
9651 - `"model_changed"`
9652
9653 - `BetaCacheMissSystemChanged object { cache_missed_input_tokens, type }`
10038 default: model_changed
10039
10040 - `BetaCacheMissSystemChanged object`
965410041
965510042 - `cache_missed_input_tokens: number`
965610043
from line 10045
965810045
965910046 - `type: "system_changed"`
966010047
9661 - `"system_changed"`
9662
9663 - `BetaCacheMissToolsChanged object { cache_missed_input_tokens, type }`
10048 default: system_changed
10049
10050 - `BetaCacheMissToolsChanged object`
966410051
966510052 - `cache_missed_input_tokens: number`
966610053
from line 10055
966810055
966910056 - `type: "tools_changed"`
967010057
9671 - `"tools_changed"`
9672
9673 - `BetaCacheMissMessagesChanged object { cache_missed_input_tokens, type }`
10058 default: tools_changed
10059
10060 - `BetaCacheMissMessagesChanged object`
967410061
967510062 - `cache_missed_input_tokens: number`
967610063
from line 10065
967810065
967910066 - `type: "messages_changed"`
968010067
9681 - `"messages_changed"`
9682
9683 - `BetaCacheMissPreviousMessageNotFound object { type }`
10068 default: messages_changed
10069
10070 - `BetaCacheMissPreviousMessageNotFound object`
968410071
968510072 - `type: "previous_message_not_found"`
968610073
9687 - `"previous_message_not_found"`
9688
9689 - `BetaCacheMissUnavailable object { type }`
10074 default: previous_message_not_found
10075
10076 - `BetaCacheMissUnavailable object`
969010077
969110078 - `type: "unavailable"`
969210079
9693 - `"unavailable"`
10080 default: unavailable
969410081
969510082 - `model: Model`
969610083
from line 10091
970410091
970510092 This will always be `"assistant"`.
970610093
9707 - `"assistant"`
10094 default: assistant
970810095
970910096 - `stop_details: BetaRefusalStopDetails or null`
971010097
from line 10178
979110178
979210179 - `type: "refusal"`
979310180
9794 - `"refusal"`
10181 default: refusal
979510182
979610183 - `stop_reason: BetaStopReason or null`
979710184
from line 10224
983710224
983810225 For Messages, this is always `"message"`.
983910226
9840 - `"message"`
10227 default: message
984110228
984210229 - `usage: BetaUsage`
984310230
from line 10246
985910246
986010247 The number of input tokens used to create the 1 hour cache entry.
986110248
10249 default: 0, minimum: 0
10250
986210251 - `ephemeral_5m_input_tokens: number`
986310252
986410253 The number of input tokens used to create the 5 minute cache entry.
986510254
10255 default: 0, minimum: 0
10256
986610257 - `cache_creation_input_tokens: number or null`
986710258
986810259 The number of input tokens used to create the cache entry.
986910260
10261 minimum: 0
10262
987010263 - `cache_read_input_tokens: number or null`
987110264
987210265 The number of input tokens read from the cache.
10266
10267 minimum: 0
987310268
987410269 - `fallback_credit: BetaFallbackCreditUsage or null`
987510270
from line 10279
988410279 resulting shift is zero because there was nothing to move. `not_applied`:
988510280 no reprice was applied; the arm's `reason` says why.
988610281
9887 - `BetaFallbackCreditRedeemed object { type }`
10282 - `BetaFallbackCreditRedeemed object`
988810283
988910284 The reprice was applied: the retry is billed as if the conversation
989010285 had been on the retry model all along.
989110286
989210287 - `type: "redeemed"`
989310288
9894 - `"redeemed"`
9895
9896 - `BetaFallbackCreditNotApplied object { reason, type, remove_to_redeem }`
10289 default: redeemed
10290
10291 - `BetaFallbackCreditNotApplied object`
989710292
989810293 No reprice was applied; `reason` says why.
989910294
from line 10325
993010325
993110326 - `type: "not_applied"`
993210327
9933 - `"not_applied"`
10328 default: not_applied
993410329
993510330 - `remove_to_redeem: optional array of string or null`
993610331
from line 10346
995110346
995210347 The number of input tokens which were used.
995310348
10349 minimum: 0
10350
995410351 - `iterations: BetaIterationsUsage or null`
995510352
995610353 Per-iteration token usage breakdown.
from line 10358
996110358 - Calculate the true context window size from the last iteration
996210359 - Understand token accumulation across server-side tool use loops
996310360
9964 - `BetaMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
10361 - `BetaMessageIterationUsage object`
996510362
996610363 Token usage for a sampling iteration.
996710364
from line 10370
997310370
997410371 The number of input tokens used to create the cache entry.
997510372
10373 default: 0, minimum: 0
10374
997610375 - `cache_read_input_tokens: number`
997710376
997810377 The number of input tokens read from the cache.
997910378
10379 default: 0, minimum: 0
10380
998010381 - `input_tokens: number`
998110382
998210383 The number of input tokens which were used.
998310384
10385 minimum: 0
10386
998410387 - `model: Model`
998510388
998610389 The model that will complete your prompt.
from line 10394
999110394
999210395 The number of output tokens which were used.
999310396
10397 minimum: 0
10398
999410399 - `type: "message"`
999510400
999610401 Usage for a sampling iteration
999710402
9998 - `"message"`
9999
10000 - `BetaCompactionIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }`
10403 default: message
10404
10405 - `BetaCompactionIterationUsage object`
1000110406
1000210407 Token usage for a compaction iteration.
1000310408
from line 10414
1000910414
1001010415 The number of input tokens used to create the cache entry.
1001110416
10417 default: 0, minimum: 0
10418
1001210419 - `cache_read_input_tokens: number`
1001310420
1001410421 The number of input tokens read from the cache.
1001510422
10423 default: 0, minimum: 0
10424
1001610425 - `input_tokens: number`
1001710426
1001810427 The number of input tokens which were used.
1001910428
10429 minimum: 0
10430
1002010431 - `output_tokens: number`
1002110432
1002210433 The number of output tokens which were used.
1002310434
10435 minimum: 0
10436
1002410437 - `type: "compaction"`
1002510438
1002610439 Usage for a compaction iteration
1002710440
10028 - `"compaction"`
10029
10030 - `BetaAdvisorMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
10441 default: compaction
10442
10443 - `BetaAdvisorMessageIterationUsage object`
1003110444
1003210445 Token usage for an advisor sub-inference iteration.
1003310446
from line 10452
1003910452
1004010453 The number of input tokens used to create the cache entry.
1004110454
10455 default: 0, minimum: 0
10456
1004210457 - `cache_read_input_tokens: number`
1004310458
1004410459 The number of input tokens read from the cache.
1004510460
10461 default: 0, minimum: 0
10462
1004610463 - `input_tokens: number`
1004710464
1004810465 The number of input tokens which were used.
1004910466
10467 minimum: 0
10468
1005010469 - `model: Model`
1005110470
1005210471 The model that will complete your prompt.
from line 10476
1005710476
1005810477 The number of output tokens which were used.
1005910478
10479 minimum: 0
10480
1006010481 - `type: "advisor_message"`
1006110482
1006210483 Usage for an advisor sub-inference iteration
1006310484
10064 - `"advisor_message"`
10065
10066 - `BetaFallbackMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
10485 default: advisor_message
10486
10487 - `BetaFallbackMessageIterationUsage object`
1006710488
1006810489 Token usage for the fallback-model attempt of a server-side fallback request.
1006910490
from line 10501
1008010501
1008110502 The number of input tokens used to create the cache entry.
1008210503
10504 default: 0, minimum: 0
10505
1008310506 - `cache_read_input_tokens: number`
1008410507
1008510508 The number of input tokens read from the cache.
1008610509
10510 default: 0, minimum: 0
10511
1008710512 - `input_tokens: number`
1008810513
1008910514 The number of input tokens which were used.
1009010515
10516 minimum: 0
10517
1009110518 - `model: Model`
1009210519
1009310520 The model that will complete your prompt.
from line 10525
1009810525
1009910526 The number of output tokens which were used.
1010010527
10528 minimum: 0
10529
1010110530 - `type: "fallback_message"`
1010210531
1010310532 Usage for the fallback-model attempt that served the response
1010410533
10105 - `"fallback_message"`
10534 default: fallback_message
1010610535
1010710536 - `output_tokens: number`
1010810537
1010910538 The number of output tokens which were used.
10539
10540 minimum: 0
1011010541
1011110542 - `output_tokens_details: BetaOutputTokensDetails or null`
1011210543
from line 10559
1012810559 generation count by a small number of tokens. Always ≤ `output_tokens`;
1012910560 `output_tokens - thinking_tokens` approximates the non-reasoning output.
1013010561
10562 default: 0, minimum: 0
10563
1013110564 - `server_tool_use: BetaServerToolUsage or null`
1013210565
1013310566 The number of server tool requests.
from line 10569
1013610569
1013710570 The number of web fetch tool requests.
1013810571
10572 default: 0, minimum: 0
10573
1013910574 - `web_search_requests: number`
1014010575
1014110576 The number of web search tool requests.
1014210577
10578 default: 0, minimum: 0
10579
1014310580 - `service_tier: "standard" or "priority" or "batch" or null`
1014410581
1014510582 If the request used the priority, standard, or batch tier.
from line 10597
1016010597
1016110598 - `type: "succeeded"`
1016210599
10163 - `"succeeded"`
10164
10165 - `BetaMessageBatchErroredResult object { error, type }`
10600 default: succeeded
10601
10602 - `BetaMessageBatchErroredResult object`
1016610603
1016710604 - `error: BetaErrorResponse`
1016810605
1016910606 - `error: BetaError`
1017010607
10171 - `BetaInvalidRequestError object { message, type }`
10608 - `BetaInvalidRequestError object`
1017210609
1017310610 - `message: string`
1017410611
10612 default: Invalid request
10613
1017510614 - `type: "invalid_request_error"`
1017610615
10177 - `"invalid_request_error"`
10178
10179 - `BetaAuthenticationError object { message, type }`
10616 default: invalid_request_error
10617
10618 - `BetaAuthenticationError object`
1018010619
1018110620 - `message: string`
1018210621
10622 default: Authentication error
10623
1018310624 - `type: "authentication_error"`
1018410625
10185 - `"authentication_error"`
10186
10187 - `BetaBillingError object { message, type }`
10626 default: authentication_error
10627
10628 - `BetaBillingError object`
1018810629
1018910630 - `message: string`
1019010631
10632 default: Billing error
10633
1019110634 - `type: "billing_error"`
1019210635
10193 - `"billing_error"`
10194
10195 - `BetaPermissionError object { message, type }`
10636 default: billing_error
10637
10638 - `BetaPermissionError object`
1019610639
1019710640 - `message: string`
1019810641
10642 default: Permission denied
10643
1019910644 - `type: "permission_error"`
1020010645
10201 - `"permission_error"`
10202
10203 - `BetaNotFoundError object { message, type }`
10646 default: permission_error
10647
10648 - `BetaNotFoundError object`
1020410649
1020510650 - `message: string`
1020610651
10652 default: Not found
10653
1020710654 - `type: "not_found_error"`
1020810655
10209 - `"not_found_error"`
10210
10211 - `BetaRateLimitError object { message, type }`
10656 default: not_found_error
10657
10658 - `BetaRateLimitError object`
1021210659
1021310660 - `message: string`
1021410661
10662 default: Rate limited
10663
1021510664 - `type: "rate_limit_error"`
1021610665
10217 - `"rate_limit_error"`
10218
10219 - `BetaGatewayTimeoutError object { message, type }`
10666 default: rate_limit_error
10667
10668 - `BetaGatewayTimeoutError object`
1022010669
1022110670 - `message: string`
1022210671
10672 default: Request timeout
10673
1022310674 - `type: "timeout_error"`
1022410675
10225 - `"timeout_error"`
10226
10227 - `BetaAPIError object { message, type }`
10676 default: timeout_error
10677
10678 - `BetaAPIError object`
1022810679
1022910680 - `message: string`
1023010681
10682 default: Internal server error
10683
1023110684 - `type: "api_error"`
1023210685
10233 - `"api_error"`
10234
10235 - `BetaOverloadedError object { message, type }`
10686 default: api_error
10687
10688 - `BetaOverloadedError object`
1023610689
1023710690 - `message: string`
1023810691
10692 default: Overloaded
10693
1023910694 - `type: "overloaded_error"`
1024010695
10241 - `"overloaded_error"`
10696 default: overloaded_error
1024210697
1024310698 - `request_id: string or null`
1024410699
1024510700 - `type: "error"`
1024610701
10247 - `"error"`
10702 default: error
1024810703
1024910704 - `type: "errored"`
1025010705
10251 - `"errored"`
10252
10253 - `BetaMessageBatchCanceledResult object { type }`
10706 default: errored
10707
10708 - `BetaMessageBatchCanceledResult object`
1025410709
1025510710 - `type: "canceled"`
1025610711
10257 - `"canceled"`
10258
10259 - `BetaMessageBatchExpiredResult object { type }`
10712 default: canceled
10713
10714 - `BetaMessageBatchExpiredResult object`
1026010715
1026110716 - `type: "expired"`
1026210717
10263 - `"expired"`
10718 default: expired
1026410719
1026510720### Beta Message Batch Succeeded Result
1026610721
10267- `BetaMessageBatchSucceededResult object { message, type }`
10722- `BetaMessageBatchSucceededResult object`
1026810723
1026910724 - `message: BetaMessage`
1027010725
from line 10741
1028610741
1028710742 The time at which the container will expire.
1028810743
10744 format: date-time
10745
1028910746 - `skills: array of BetaSkill or null`
1029010747
1029110748 Skills loaded in the container
from line 10751
1029410751
1029510752 Skill ID
1029610753
10754 maxLength: 64, minLength: 1
10755
1029710756 - `type: "anthropic" or "custom"`
1029810757
1029910758 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 10764
1030510764 - `version: string`
1030610765
1030710766 The resolved version: a skill version ID for custom skills.
10767
10768 maxLength: 64, minLength: 1
1030810769
1030910770 - `content: array of BetaContentBlock`
1031010771
from line 10796
1033510796 [{"type": "text", "text": "B)"}]
1033610797 ```
1033710798
10338 - `BetaTextBlock object { citations, text, type }`
10799 - `BetaTextBlock object`
1033910800
1034010801 - `citations: array of BetaTextCitation or null`
1034110802
from line 10804
1034310804
1034410805 The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
1034510806
10346 - `BetaCitationCharLocation object { cited_text, document_index, document_title, 4 more }`
10807 - `BetaCitationCharLocation object`
1034710808
1034810809 - `cited_text: string`
1034910810
1035010811 - `document_index: number`
1035110812
10813 minimum: 0
10814
1035210815 - `document_title: string or null`
1035310816
1035410817 - `end_char_index: number`
from line 10820
1035710820
1035810821 - `start_char_index: number`
1035910822
10823 minimum: 0
10824
1036010825 - `type: "char_location"`
1036110826
10362 - `"char_location"`
10363
10364 - `BetaCitationPageLocation object { cited_text, document_index, document_title, 4 more }`
10827 default: char_location
10828
10829 - `BetaCitationPageLocation object`
1036510830
1036610831 - `cited_text: string`
1036710832
1036810833 - `document_index: number`
1036910834
10835 minimum: 0
10836
1037010837 - `document_title: string or null`
1037110838
1037210839 - `end_page_number: number`
from line 10842
1037510842
1037610843 - `start_page_number: number`
1037710844
10845 minimum: 1
10846
1037810847 - `type: "page_location"`
1037910848
10380 - `"page_location"`
10381
10382 - `BetaCitationContentBlockLocation object { cited_text, document_index, document_title, 4 more }`
10849 default: page_location
10850
10851 - `BetaCitationContentBlockLocation object`
1038310852
1038410853 - `cited_text: string`
1038510854
from line 10858
1038910858
1039010859 - `document_index: number`
1039110860
10861 minimum: 0
10862
1039210863 - `document_title: string or null`
1039310864
1039410865 - `end_block_index: number`
from line 10874
1040310874
1040410875 0-based index of the first cited block in the source's `content` array.
1040510876
10877 minimum: 0
10878
1040610879 - `type: "content_block_location"`
1040710880
10408 - `"content_block_location"`
10409
10410 - `BetaCitationsWebSearchResultLocation object { cited_text, encrypted_index, title, 2 more }`
10881 default: content_block_location
10882
10883 - `BetaCitationsWebSearchResultLocation object`
1041110884
1041210885 - `cited_text: string`
1041310886
from line 10888
1041510888
1041610889 - `title: string or null`
1041710890
10891 maxLength: 512
10892
1041810893 - `type: "web_search_result_location"`
1041910894
10420 - `"web_search_result_location"`
10895 default: web_search_result_location
1042110896
1042210897 - `url: string`
1042310898
10424 - `BetaCitationSearchResultLocation object { cited_text, end_block_index, search_result_index, 4 more }`
10899 - `BetaCitationSearchResultLocation object`
1042510900
1042610901 - `cited_text: string`
1042710902
from line 10916
1044110916
1044210917 Counted separately from `document_index`; server-side web search results are not included in this count.
1044310918
10919 minimum: 0
10920
1044410921 - `source: string`
1044510922
1044610923 - `start_block_index: number`
1044710924
1044810925 0-based index of the first cited block in the source's `content` array.
1044910926
10927 minimum: 0
10928
1045010929 - `title: string or null`
1045110930
1045210931 - `type: "search_result_location"`
1045310932
10454 - `"search_result_location"`
10933 default: search_result_location
1045510934
1045610935 - `text: string`
1045710936
10937 maxLength: 5000000, minLength: 0
10938
1045810939 - `type: "text"`
1045910940
10460 - `"text"`
10461
10462 - `BetaThinkingBlock object { signature, thinking, type }`
10941 default: text
10942
10943 - `BetaThinkingBlock object`
1046310944
1046410945 - `signature: string`
1046510946
from line 10956
1047510956
1047610957 - `type: "thinking"`
1047710958
10478 - `"thinking"`
10479
10480 - `BetaRedactedThinkingBlock object { data, type }`
10959 default: thinking
10960
10961 - `BetaRedactedThinkingBlock object`
1048110962
1048210963 - `data: string`
1048310964
from line 10970
1048910970
1049010971 - `type: "redacted_thinking"`
1049110972
10492 - `"redacted_thinking"`
10493
10494 - `BetaToolUseBlock object { id, input, name, 3 more }`
10973 default: redacted_thinking
10974
10975 - `BetaToolUseBlock object`
1049510976
1049610977 - `id: string`
1049710978
10979 pattern: ^[a-zA-Z0-9_-]+$
10980
1049810981 - `input: map[unknown]`
1049910982
1050010983 - `name: string`
1050110984
10985 minLength: 1
10986
1050210987 - `type: "tool_use"`
1050310988
10504 - `"tool_use"`
10989 default: tool_use
1050510990
1050610991 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
1050710992
1050810993 Tool invocation directly from the model.
1050910994
10510 - `BetaDirectCaller object { type }`
10995 - `BetaDirectCaller object`
1051110996
1051210997 Tool invocation directly from the model.
1051310998
1051410999 - `type: "direct"`
1051511000
10516 - `"direct"`
10517
10518 - `BetaServerToolCaller object { tool_id, type }`
11001 - `BetaServerToolCaller object`
1051911002
1052011003 Tool invocation generated by a server-side tool.
1052111004
1052211005 - `tool_id: string`
1052311006
11007 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11008
1052411009 - `type: "code_execution_20250825"`
1052511010
10526 - `"code_execution_20250825"`
10527
10528 - `BetaServerToolCaller20260120 object { tool_id, type }`
11011 - `BetaServerToolCaller20260120 object`
1052911012
1053011013 - `tool_id: string`
1053111014
11015 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11016
1053211017 - `type: "code_execution_20260120"`
1053311018
10534 - `"code_execution_20260120"`
10535
1053611019 - `toolset_name: optional string or null`
1053711020
1053811021 For a toolset member tool_use, the toolset family.
1053911022
10540 - `BetaServerToolUseBlock object { id, input, name, 2 more }`
11023 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
11024
11025 - `BetaServerToolUseBlock object`
1054111026
1054211027 - `id: string`
1054311028
11029 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11030
1054411031 - `input: map[unknown]`
1054511032
1054611033 - `name: "advisor" or "web_search" or "web_fetch" or 5 more`
from line 11050
1056311050
1056411051 - `type: "server_tool_use"`
1056511052
10566 - `"server_tool_use"`
11053 default: server_tool_use
1056711054
1056811055 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
1056911056
1057011057 Tool invocation directly from the model.
1057111058
10572 - `BetaDirectCaller object { type }`
11059 - `BetaDirectCaller object`
1057311060
1057411061 Tool invocation directly from the model.
1057511062
10576 - `BetaServerToolCaller object { tool_id, type }`
11063 - `BetaServerToolCaller object`
1057711064
1057811065 Tool invocation generated by a server-side tool.
1057911066
10580 - `BetaServerToolCaller20260120 object { tool_id, type }`
10581
10582 - `BetaWebSearchToolResultBlock object { content, tool_use_id, type, caller }`
11067 - `BetaServerToolCaller20260120 object`
11068
11069 - `BetaWebSearchToolResultBlock object`
1058311070
1058411071 - `content: BetaWebSearchToolResultBlockContent`
1058511072
10586 - `BetaWebSearchToolResultError object { error_code, type }`
11073 - `BetaWebSearchToolResultError object`
1058711074
1058811075 - `error_code: BetaWebSearchToolResultErrorCode`
1058911076
from line 11088
1060111088
1060211089 - `type: "web_search_tool_result_error"`
1060311090
10604 - `"web_search_tool_result_error"`
11091 default: web_search_tool_result_error
1060511092
1060611093 - `array of BetaWebSearchResultBlock`
1060711094
from line 11100
1061311100
1061411101 - `type: "web_search_result"`
1061511102
10616 - `"web_search_result"`
11103 default: web_search_result
1061711104
1061811105 - `url: string`
1061911106
1062011107 - `tool_use_id: string`
1062111108
11109 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11110
1062211111 - `type: "web_search_tool_result"`
1062311112
10624 - `"web_search_tool_result"`
11113 default: web_search_tool_result
1062511114
1062611115 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
1062711116
1062811117 Tool invocation directly from the model.
1062911118
10630 - `BetaDirectCaller object { type }`
11119 - `BetaDirectCaller object`
1063111120
1063211121 Tool invocation directly from the model.
1063311122
10634 - `BetaServerToolCaller object { tool_id, type }`
11123 - `BetaServerToolCaller object`
1063511124
1063611125 Tool invocation generated by a server-side tool.
1063711126
10638 - `BetaServerToolCaller20260120 object { tool_id, type }`
10639
10640 - `BetaWebFetchToolResultBlock object { content, tool_use_id, type, caller }`
11127 - `BetaServerToolCaller20260120 object`
11128
11129 - `BetaWebFetchToolResultBlock object`
1064111130
1064211131 - `content: BetaWebFetchToolResultErrorBlock or BetaWebFetchBlock`
1064311132
10644 - `BetaWebFetchToolResultErrorBlock object { error_code, type }`
11133 - `BetaWebFetchToolResultErrorBlock object`
1064511134
1064611135 - `error_code: BetaWebFetchToolResultErrorCode`
1064711136
from line 11154
1066511154
1066611155 - `type: "web_fetch_tool_result_error"`
1066711156
10668 - `"web_fetch_tool_result_error"`
10669
10670 - `BetaWebFetchBlock object { content, retrieved_at, type, url }`
11157 default: web_fetch_tool_result_error
11158
11159 - `BetaWebFetchBlock object`
1067111160
1067211161 - `content: BetaDocumentBlock`
1067311162
from line 11166
1067711166
1067811167 - `enabled: boolean`
1067911168
11169 default: false
11170
1068011171 - `source: BetaBase64PDFSource or BetaPlainTextSource`
1068111172
10682 - `BetaBase64PDFSource object { data, media_type, type }`
11173 - `BetaBase64PDFSource object`
1068311174
1068411175 - `data: string`
1068511176
11177 format: byte
11178
1068611179 - `media_type: "application/pdf"`
1068711180
10688 - `"application/pdf"`
10689
1069011181 - `type: "base64"`
1069111182
10692 - `"base64"`
10693
10694 - `BetaPlainTextSource object { data, media_type, type }`
11183 - `BetaPlainTextSource object`
1069511184
1069611185 - `data: string`
1069711186
1069811187 - `media_type: "text/plain"`
1069911188
10700 - `"text/plain"`
10701
1070211189 - `type: "text"`
1070311190
10704 - `"text"`
10705
1070611191 - `title: string or null`
1070711192
1070811193 The title of the document
1070911194
1071011195 - `type: "document"`
1071111196
10712 - `"document"`
11197 default: document
1071311198
1071411199 - `retrieved_at: string or null`
1071511200
from line 11202
1071711202
1071811203 - `type: "web_fetch_result"`
1071911204
10720 - `"web_fetch_result"`
11205 default: web_fetch_result
1072111206
1072211207 - `url: string`
1072311208
from line 11210
1072511210
1072611211 - `tool_use_id: string`
1072711212
11213 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11214
1072811215 - `type: "web_fetch_tool_result"`
1072911216
10730 - `"web_fetch_tool_result"`
11217 default: web_fetch_tool_result
1073111218
1073211219 - `caller: optional BetaDirectCaller or BetaServerToolCaller or BetaServerToolCaller20260120`
1073311220
1073411221 Tool invocation directly from the model.
1073511222
10736 - `BetaDirectCaller object { type }`
11223 - `BetaDirectCaller object`
1073711224
1073811225 Tool invocation directly from the model.
1073911226
10740 - `BetaServerToolCaller object { tool_id, type }`
11227 - `BetaServerToolCaller object`
1074111228
1074211229 Tool invocation generated by a server-side tool.
1074311230
10744 - `BetaServerToolCaller20260120 object { tool_id, type }`
10745
10746 - `BetaAdvisorToolResultBlock object { content, tool_use_id, type }`
11231 - `BetaServerToolCaller20260120 object`
11232
11233 - `BetaAdvisorToolResultBlock object`
1074711234
1074811235 - `content: BetaAdvisorToolResultError or BetaAdvisorResultBlock or BetaAdvisorRedactedResultBlock`
1074911236
10750 - `BetaAdvisorToolResultError object { error_code, type }`
11237 - `BetaAdvisorToolResultError object`
1075111238
1075211239 - `error_code: "max_uses_exceeded" or "prompt_too_long" or "too_many_requests" or 4 more`
1075311240
from line 11254
1076711254
1076811255 - `type: "advisor_tool_result_error"`
1076911256
10770 - `"advisor_tool_result_error"`
10771
10772 - `BetaAdvisorResultBlock object { stop_reason, text, type }`
11257 default: advisor_tool_result_error
11258
11259 - `BetaAdvisorResultBlock object`
1077311260
1077411261 - `stop_reason: string or null`
1077511262
from line 11266
1077911266
1078011267 - `type: "advisor_result"`
1078111268
10782 - `"advisor_result"`
10783
10784 - `BetaAdvisorRedactedResultBlock object { encrypted_content, stop_reason, type }`
11269 default: advisor_result
11270
11271 - `BetaAdvisorRedactedResultBlock object`
1078511272
1078611273 - `encrypted_content: string`
1078711274
from line 11280
1079311280
1079411281 - `type: "advisor_redacted_result"`
1079511282
10796 - `"advisor_redacted_result"`
11283 default: advisor_redacted_result
1079711284
1079811285 - `tool_use_id: string`
1079911286
11287 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11288
1080011289 - `type: "advisor_tool_result"`
1080111290
10802 - `"advisor_tool_result"`
10803
10804 - `BetaCodeExecutionToolResultBlock object { content, tool_use_id, type }`
11291 default: advisor_tool_result
11292
11293 - `BetaCodeExecutionToolResultBlock object`
1080511294
1080611295 - `content: BetaCodeExecutionToolResultBlockContent`
1080711296
1080811297 Code execution result with encrypted stdout for PFC + web_search results.
1080911298
10810 - `BetaCodeExecutionToolResultError object { error_code, type }`
11299 - `BetaCodeExecutionToolResultError object`
1081111300
1081211301 - `error_code: BetaCodeExecutionToolResultErrorCode`
1081311302
from line 11310
1082111310
1082211311 - `type: "code_execution_tool_result_error"`
1082311312
10824 - `"code_execution_tool_result_error"`
10825
10826 - `BetaCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
11313 default: code_execution_tool_result_error
11314
11315 - `BetaCodeExecutionResultBlock object`
1082711316
1082811317 - `content: array of BetaCodeExecutionOutputBlock`
1082911318
from line 11320
1083111320
1083211321 - `type: "code_execution_output"`
1083311322
10834 - `"code_execution_output"`
11323 default: code_execution_output
1083511324
1083611325 - `return_code: number`
1083711326
from line 11330
1084111330
1084211331 - `type: "code_execution_result"`
1084311332
10844 - `"code_execution_result"`
10845
10846 - `BetaEncryptedCodeExecutionResultBlock object { content, encrypted_stdout, return_code, 2 more }`
11333 default: code_execution_result
11334
11335 - `BetaEncryptedCodeExecutionResultBlock object`
1084711336
1084811337 Code execution result with encrypted stdout for PFC + web_search results.
1084911338
from line 11342
1085311342
1085411343 - `type: "code_execution_output"`
1085511344
11345 default: code_execution_output
11346
1085611347 - `encrypted_stdout: string`
1085711348
1085811349 - `return_code: number`
from line 11352
1086111352
1086211353 - `type: "encrypted_code_execution_result"`
1086311354
10864 - `"encrypted_code_execution_result"`
11355 default: encrypted_code_execution_result
1086511356
1086611357 - `tool_use_id: string`
1086711358
11359 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11360
1086811361 - `type: "code_execution_tool_result"`
1086911362
10870 - `"code_execution_tool_result"`
10871
10872 - `BetaBashCodeExecutionToolResultBlock object { content, tool_use_id, type }`
11363 default: code_execution_tool_result
11364
11365 - `BetaBashCodeExecutionToolResultBlock object`
1087311366
1087411367 - `content: BetaBashCodeExecutionToolResultError or BetaBashCodeExecutionResultBlock`
1087511368
10876 - `BetaBashCodeExecutionToolResultError object { error_code, type }`
11369 - `BetaBashCodeExecutionToolResultError object`
1087711370
1087811371 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
1087911372
from line 11382
1088911382
1089011383 - `type: "bash_code_execution_tool_result_error"`
1089111384
10892 - `"bash_code_execution_tool_result_error"`
10893
10894 - `BetaBashCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
11385 default: bash_code_execution_tool_result_error
11386
11387 - `BetaBashCodeExecutionResultBlock object`
1089511388
1089611389 - `content: array of BetaBashCodeExecutionOutputBlock`
1089711390
from line 11392
1089911392
1090011393 - `type: "bash_code_execution_output"`
1090111394
10902 - `"bash_code_execution_output"`
11395 default: bash_code_execution_output
1090311396
1090411397 - `return_code: number`
1090511398
from line 11402
1090911402
1091011403 - `type: "bash_code_execution_result"`
1091111404
10912 - `"bash_code_execution_result"`
11405 default: bash_code_execution_result
1091311406
1091411407 - `tool_use_id: string`
1091511408
11409 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11410
1091611411 - `type: "bash_code_execution_tool_result"`
1091711412
10918 - `"bash_code_execution_tool_result"`
10919
10920 - `BetaTextEditorCodeExecutionToolResultBlock object { content, tool_use_id, type }`
11413 default: bash_code_execution_tool_result
11414
11415 - `BetaTextEditorCodeExecutionToolResultBlock object`
1092111416
1092211417 - `content: BetaTextEditorCodeExecutionToolResultError or BetaTextEditorCodeExecutionViewResultBlock or BetaTextEditorCodeExecutionCreateResultBlock or BetaTextEditorCodeExecutionStrReplaceResultBlock`
1092311418
10924 - `BetaTextEditorCodeExecutionToolResultError object { error_code, error_message, type }`
11419 - `BetaTextEditorCodeExecutionToolResultError object`
1092511420
1092611421 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or 2 more`
1092711422
from line 11434
1093911434
1094011435 - `type: "text_editor_code_execution_tool_result_error"`
1094111436
10942 - `"text_editor_code_execution_tool_result_error"`
10943
10944 - `BetaTextEditorCodeExecutionViewResultBlock object { content, file_type, num_lines, 3 more }`
11437 default: text_editor_code_execution_tool_result_error
11438
11439 - `BetaTextEditorCodeExecutionViewResultBlock object`
1094511440
1094611441 - `content: string`
1094711442
from line 11456
1096111456
1096211457 - `type: "text_editor_code_execution_view_result"`
1096311458
10964 - `"text_editor_code_execution_view_result"`
10965
10966 - `BetaTextEditorCodeExecutionCreateResultBlock object { is_file_update, type }`
11459 default: text_editor_code_execution_view_result
11460
11461 - `BetaTextEditorCodeExecutionCreateResultBlock object`
1096711462
1096811463 - `is_file_update: boolean`
1096911464
1097011465 - `type: "text_editor_code_execution_create_result"`
1097111466
10972 - `"text_editor_code_execution_create_result"`
10973
10974 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object { lines, new_lines, new_start, 3 more }`
11467 default: text_editor_code_execution_create_result
11468
11469 - `BetaTextEditorCodeExecutionStrReplaceResultBlock object`
1097511470
1097611471 - `lines: array of string or null`
1097711472
from line 11480
1098511480
1098611481 - `type: "text_editor_code_execution_str_replace_result"`
1098711482
10988 - `"text_editor_code_execution_str_replace_result"`
11483 default: text_editor_code_execution_str_replace_result
1098911484
1099011485 - `tool_use_id: string`
1099111486
11487 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11488
1099211489 - `type: "text_editor_code_execution_tool_result"`
1099311490
10994 - `"text_editor_code_execution_tool_result"`
10995
10996 - `BetaToolSearchToolResultBlock object { content, tool_use_id, type }`
11491 default: text_editor_code_execution_tool_result
11492
11493 - `BetaToolSearchToolResultBlock object`
1099711494
1099811495 - `content: BetaToolSearchToolResultError or BetaToolSearchToolSearchResultBlock`
1099911496
11000 - `BetaToolSearchToolResultError object { error_code, error_message, type }`
11497 - `BetaToolSearchToolResultError object`
1100111498
1100211499 - `error_code: "invalid_tool_input" or "unavailable" or "too_many_requests" or "execution_time_exceeded"`
1100311500
from line 11510
1101311510
1101411511 - `type: "tool_search_tool_result_error"`
1101511512
11016 - `"tool_search_tool_result_error"`
11017
11018 - `BetaToolSearchToolSearchResultBlock object { tool_references, type }`
11513 default: tool_search_tool_result_error
11514
11515 - `BetaToolSearchToolSearchResultBlock object`
1101911516
1102011517 - `tool_references: array of BetaToolReferenceBlock`
1102111518
1102211519 - `tool_name: string`
1102311520
11521 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
11522
1102411523 - `type: "tool_reference"`
1102511524
11026 - `"tool_reference"`
11525 default: tool_reference
1102711526
1102811527 - `type: "tool_search_tool_search_result"`
1102911528
11030 - `"tool_search_tool_search_result"`
11529 default: tool_search_tool_search_result
1103111530
1103211531 - `tool_use_id: string`
1103311532
11533 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
11534
1103411535 - `type: "tool_search_tool_result"`
1103511536
11036 - `"tool_search_tool_result"`
11037
11038 - `BetaMCPToolUseBlock object { id, input, name, 2 more }`
11537 default: tool_search_tool_result
11538
11539 - `BetaMCPToolUseBlock object`
1103911540
1104011541 - `id: string`
1104111542
11543 pattern: ^[a-zA-Z0-9_-]+$
11544
1104211545 - `input: map[unknown]`
1104311546
1104411547 - `name: string`
from line 11554
1105111554
1105211555 - `type: "mcp_tool_use"`
1105311556
11054 - `"mcp_tool_use"`
11055
11056 - `BetaMCPToolResultBlock object { content, is_error, tool_use_id, type }`
11557 default: mcp_tool_use
11558
11559 - `BetaMCPToolResultBlock object`
1105711560
1105811561 - `content: string or array of BetaTextBlock`
1105911562
from line 11572
1106911572
1107011573 - `text: string`
1107111574
11575 maxLength: 5000000, minLength: 0
11576
1107211577 - `type: "text"`
1107311578
11579 default: text
11580
1107411581 - `is_error: boolean`
1107511582
11583 default: false
11584
1107611585 - `tool_use_id: string`
1107711586
11587 pattern: ^[a-zA-Z0-9_-]+$
11588
1107811589 - `type: "mcp_tool_result"`
1107911590
11080 - `"mcp_tool_result"`
11081
11082 - `BetaContainerUploadBlock object { file_id, type }`
11591 default: mcp_tool_result
11592
11593 - `BetaContainerUploadBlock object`
1108311594
1108411595 Response model for a file uploaded to the container.
1108511596
from line 11598
1108711598
1108811599 - `type: "container_upload"`
1108911600
11090 - `"container_upload"`
11091
11092 - `BetaCompactionBlock object { content, encrypted_content, type }`
11601 default: container_upload
11602
11603 - `BetaCompactionBlock object`
1109311604
1109411605 A compaction block returned when autocompact is triggered.
1109511606
from line 11618
1110711618
1110811619 - `type: "compaction"`
1110911620
11110 - `"compaction"`
11111
11112 - `BetaFallbackBlock object { from, to, trigger, type }`
11621 default: compaction
11622
11623 - `BetaFallbackBlock object`
1111311624
1111411625 Marks the point in `content` where one model's output gives way to the next.
1111511626
from line 11746
1123511746
1123611747 - `type: "refusal"`
1123711748
11238 - `"refusal"`
11749 default: refusal
1123911750
1124011751 - `type: "fallback"`
1124111752
11242 - `"fallback"`
11753 default: fallback
1124311754
1124411755 - `context_management: BetaContextManagementResponse or null`
1124511756
from line 11762
1125111762
1125211763 List of context management edits that were applied.
1125311764
11254 - `BetaClearToolUses20250919EditResponse object { cleared_input_tokens, cleared_tool_uses, type }`
11765 - `BetaClearToolUses20250919EditResponse object`
1125511766
1125611767 - `cleared_input_tokens: number`
1125711768
1125811769 Number of input tokens cleared by this edit.
1125911770
11771 minimum: 0
11772
1126011773 - `cleared_tool_uses: number`
1126111774
1126211775 Number of tool uses that were cleared.
1126311776
11777 minimum: 0
11778
1126411779 - `type: "clear_tool_uses_20250919"`
1126511780
1126611781 The type of context management edit applied.
1126711782
11268 - `"clear_tool_uses_20250919"`
11269
11270 - `BetaClearThinking20251015EditResponse object { cleared_input_tokens, cleared_thinking_turns, type }`
11783 default: clear_tool_uses_20250919
11784
11785 - `BetaClearThinking20251015EditResponse object`
1127111786
1127211787 - `cleared_input_tokens: number`
1127311788
1127411789 Number of input tokens cleared by this edit.
1127511790
11791 minimum: 0
11792
1127611793 - `cleared_thinking_turns: number`
1127711794
1127811795 Number of thinking turns that were cleared.
1127911796
11797 minimum: 0
11798
1128011799 - `type: "clear_thinking_20251015"`
1128111800
1128211801 The type of context management edit applied.
1128311802
11284 - `"clear_thinking_20251015"`
11803 default: clear_thinking_20251015
1128511804
1128611805 - `diagnostics: BetaDiagnostics or null`
1128711806
from line 11811
1129211811
1129311812 Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.
1129411813
11295 - `BetaCacheMissModelChanged object { cache_missed_input_tokens, type }`
11814 - `BetaCacheMissModelChanged object`
1129611815
1129711816 - `cache_missed_input_tokens: number`
1129811817
from line 11819
1130011819
1130111820 - `type: "model_changed"`
1130211821
11303 - `"model_changed"`
11304
11305 - `BetaCacheMissSystemChanged object { cache_missed_input_tokens, type }`
11822 default: model_changed
11823
11824 - `BetaCacheMissSystemChanged object`
1130611825
1130711826 - `cache_missed_input_tokens: number`
1130811827
from line 11829
1131011829
1131111830 - `type: "system_changed"`
1131211831
11313 - `"system_changed"`
11314
11315 - `BetaCacheMissToolsChanged object { cache_missed_input_tokens, type }`
11832 default: system_changed
11833
11834 - `BetaCacheMissToolsChanged object`
1131611835
1131711836 - `cache_missed_input_tokens: number`
1131811837
from line 11839
1132011839
1132111840 - `type: "tools_changed"`
1132211841
11323 - `"tools_changed"`
11324
11325 - `BetaCacheMissMessagesChanged object { cache_missed_input_tokens, type }`
11842 default: tools_changed
11843
11844 - `BetaCacheMissMessagesChanged object`
1132611845
1132711846 - `cache_missed_input_tokens: number`
1132811847
from line 11849
1133011849
1133111850 - `type: "messages_changed"`
1133211851
11333 - `"messages_changed"`
11334
11335 - `BetaCacheMissPreviousMessageNotFound object { type }`
11852 default: messages_changed
11853
11854 - `BetaCacheMissPreviousMessageNotFound object`
1133611855
1133711856 - `type: "previous_message_not_found"`
1133811857
11339 - `"previous_message_not_found"`
11340
11341 - `BetaCacheMissUnavailable object { type }`
11858 default: previous_message_not_found
11859
11860 - `BetaCacheMissUnavailable object`
1134211861
1134311862 - `type: "unavailable"`
1134411863
11345 - `"unavailable"`
11864 default: unavailable
1134611865
1134711866 - `model: Model`
1134811867
from line 11875
1135611875
1135711876 This will always be `"assistant"`.
1135811877
11359 - `"assistant"`
11878 default: assistant
1136011879
1136111880 - `stop_details: BetaRefusalStopDetails or null`
1136211881
from line 11962
1144311962
1144411963 - `type: "refusal"`
1144511964
11446 - `"refusal"`
11965 default: refusal
1144711966
1144811967 - `stop_reason: BetaStopReason or null`
1144911968
from line 12008
1148912008
1149012009 For Messages, this is always `"message"`.
1149112010
11492 - `"message"`
12011 default: message
1149312012
1149412013 - `usage: BetaUsage`
1149512014
from line 12030
1151112030
1151212031 The number of input tokens used to create the 1 hour cache entry.
1151312032
12033 default: 0, minimum: 0
12034
1151412035 - `ephemeral_5m_input_tokens: number`
1151512036
1151612037 The number of input tokens used to create the 5 minute cache entry.
1151712038
12039 default: 0, minimum: 0
12040
1151812041 - `cache_creation_input_tokens: number or null`
1151912042
1152012043 The number of input tokens used to create the cache entry.
1152112044
12045 minimum: 0
12046
1152212047 - `cache_read_input_tokens: number or null`
1152312048
1152412049 The number of input tokens read from the cache.
12050
12051 minimum: 0
1152512052
1152612053 - `fallback_credit: BetaFallbackCreditUsage or null`
1152712054
from line 12063
1153612063 resulting shift is zero because there was nothing to move. `not_applied`:
1153712064 no reprice was applied; the arm's `reason` says why.
1153812065
11539 - `BetaFallbackCreditRedeemed object { type }`
12066 - `BetaFallbackCreditRedeemed object`
1154012067
1154112068 The reprice was applied: the retry is billed as if the conversation
1154212069 had been on the retry model all along.
1154312070
1154412071 - `type: "redeemed"`
1154512072
11546 - `"redeemed"`
11547
11548 - `BetaFallbackCreditNotApplied object { reason, type, remove_to_redeem }`
12073 default: redeemed
12074
12075 - `BetaFallbackCreditNotApplied object`
1154912076
1155012077 No reprice was applied; `reason` says why.
1155112078
from line 12109
1158212109
1158312110 - `type: "not_applied"`
1158412111
11585 - `"not_applied"`
12112 default: not_applied
1158612113
1158712114 - `remove_to_redeem: optional array of string or null`
1158812115
from line 12130
1160312130
1160412131 The number of input tokens which were used.
1160512132
12133 minimum: 0
12134
1160612135 - `iterations: BetaIterationsUsage or null`
1160712136
1160812137 Per-iteration token usage breakdown.
from line 12142
1161312142 - Calculate the true context window size from the last iteration
1161412143 - Understand token accumulation across server-side tool use loops
1161512144
11616 - `BetaMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
12145 - `BetaMessageIterationUsage object`
1161712146
1161812147 Token usage for a sampling iteration.
1161912148
from line 12154
1162512154
1162612155 The number of input tokens used to create the cache entry.
1162712156
12157 default: 0, minimum: 0
12158
1162812159 - `cache_read_input_tokens: number`
1162912160
1163012161 The number of input tokens read from the cache.
1163112162
12163 default: 0, minimum: 0
12164
1163212165 - `input_tokens: number`
1163312166
1163412167 The number of input tokens which were used.
1163512168
12169 minimum: 0
12170
1163612171 - `model: Model`
1163712172
1163812173 The model that will complete your prompt.
from line 12178
1164312178
1164412179 The number of output tokens which were used.
1164512180
12181 minimum: 0
12182
1164612183 - `type: "message"`
1164712184
1164812185 Usage for a sampling iteration
1164912186
11650 - `"message"`
11651
11652 - `BetaCompactionIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 3 more }`
12187 default: message
12188
12189 - `BetaCompactionIterationUsage object`
1165312190
1165412191 Token usage for a compaction iteration.
1165512192
from line 12198
1166112198
1166212199 The number of input tokens used to create the cache entry.
1166312200
12201 default: 0, minimum: 0
12202
1166412203 - `cache_read_input_tokens: number`
1166512204
1166612205 The number of input tokens read from the cache.
1166712206
12207 default: 0, minimum: 0
12208
1166812209 - `input_tokens: number`
1166912210
1167012211 The number of input tokens which were used.
1167112212
12213 minimum: 0
12214
1167212215 - `output_tokens: number`
1167312216
1167412217 The number of output tokens which were used.
1167512218
12219 minimum: 0
12220
1167612221 - `type: "compaction"`
1167712222
1167812223 Usage for a compaction iteration
1167912224
11680 - `"compaction"`
11681
11682 - `BetaAdvisorMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
12225 default: compaction
12226
12227 - `BetaAdvisorMessageIterationUsage object`
1168312228
1168412229 Token usage for an advisor sub-inference iteration.
1168512230
from line 12236
1169112236
1169212237 The number of input tokens used to create the cache entry.
1169312238
12239 default: 0, minimum: 0
12240
1169412241 - `cache_read_input_tokens: number`
1169512242
1169612243 The number of input tokens read from the cache.
1169712244
12245 default: 0, minimum: 0
12246
1169812247 - `input_tokens: number`
1169912248
1170012249 The number of input tokens which were used.
1170112250
12251 minimum: 0
12252
1170212253 - `model: Model`
1170312254
1170412255 The model that will complete your prompt.
from line 12260
1170912260
1171012261 The number of output tokens which were used.
1171112262
12263 minimum: 0
12264
1171212265 - `type: "advisor_message"`
1171312266
1171412267 Usage for an advisor sub-inference iteration
1171512268
11716 - `"advisor_message"`
11717
11718 - `BetaFallbackMessageIterationUsage object { cache_creation, cache_creation_input_tokens, cache_read_input_tokens, 4 more }`
12269 default: advisor_message
12270
12271 - `BetaFallbackMessageIterationUsage object`
1171912272
1172012273 Token usage for the fallback-model attempt of a server-side fallback request.
1172112274
from line 12285
1173212285
1173312286 The number of input tokens used to create the cache entry.
1173412287
12288 default: 0, minimum: 0
12289
1173512290 - `cache_read_input_tokens: number`
1173612291
1173712292 The number of input tokens read from the cache.
1173812293
12294 default: 0, minimum: 0
12295
1173912296 - `input_tokens: number`
1174012297
1174112298 The number of input tokens which were used.
1174212299
12300 minimum: 0
12301
1174312302 - `model: Model`
1174412303
1174512304 The model that will complete your prompt.
from line 12309
1175012309
1175112310 The number of output tokens which were used.
1175212311
12312 minimum: 0
12313
1175312314 - `type: "fallback_message"`
1175412315
1175512316 Usage for the fallback-model attempt that served the response
1175612317
11757 - `"fallback_message"`
12318 default: fallback_message
1175812319
1175912320 - `output_tokens: number`
1176012321
1176112322 The number of output tokens which were used.
12323
12324 minimum: 0
1176212325
1176312326 - `output_tokens_details: BetaOutputTokensDetails or null`
1176412327
from line 12343
1178012343 generation count by a small number of tokens. Always ≤ `output_tokens`;
1178112344 `output_tokens - thinking_tokens` approximates the non-reasoning output.
1178212345
12346 default: 0, minimum: 0
12347
1178312348 - `server_tool_use: BetaServerToolUsage or null`
1178412349
1178512350 The number of server tool requests.
from line 12353
1178812353
1178912354 The number of web fetch tool requests.
1179012355
12356 default: 0, minimum: 0
12357
1179112358 - `web_search_requests: number`
1179212359
1179312360 The number of web search tool requests.
1179412361
12362 default: 0, minimum: 0
12363
1179512364 - `service_tier: "standard" or "priority" or "batch" or null`
1179612365
1179712366 If the request used the priority, standard, or batch tier.
from line 12381
1181212381
1181312382 - `type: "succeeded"`
1181412383
11815 - `"succeeded"`
12384 default: succeeded
1181612385
No line in this hunk matches that.