---
title: Retrieve Message Batch results
url: https://platform.claude.com/docs/en/api/go/messages/batches/results
---

# Retrieve Message Batch results

`client.Messages.Batches.ResultsStreaming(ctx, messageBatchID, query) *jsonl.Stream[MessageBatchIndividualResponse]`

**GET** `/v1/messages/batches/{message_batch_id}/results`

Streams the results of a Message Batch as a `.jsonl` file.

Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing?sdk_languages=go)

## Parameters

- `messageBatchID string` (path parameter)

  ID of the Message Batch.

- `query MessageBatchResultsParams`

  - `WorkspaceID param.Opt[string] Optional` (header parameter)

    Optional header to select the Workspace for this request. The value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).

    Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace.

## Returns

- `type MessageBatchIndividualResponse`

  This is a single line in the response `.jsonl` file and does not represent the response as a whole.

  - `CustomID string`

    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.

    Must be unique for each request within the Message Batch.

  - `Result MessageBatchResultUnion`

    Processing result for this request.

    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.

    - `type MessageBatchSucceededResult`

      - `Type Succeeded`

        default: succeeded

      - `Message Message`

        - `Type Message`

          Object type.

          For Messages, this is always `"message"`.

          default: message

        - `ID string`

          Unique object identifier.

          The format and length of IDs may change over time.

        - `Container Container`

          Information about the container used in this request.

          This will be non-null if a container tool (e.g. code execution) was used.

          - `ID string`

            Identifier for the container used in this request

          - `ExpiresAt Time`

            The time at which the container will expire.

            format: date-time

          - `Skills []ContainerSkill`

            Skills loaded in the container

            - `Type ContainerSkillType`

              Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)

              - `const ContainerSkillTypeAnthropic ContainerSkillType = "anthropic"`

              - `const ContainerSkillTypeCustom ContainerSkillType = "custom"`

            - `SkillID string`

              Skill ID

              minLength: 1, maxLength: 64

            - `Version string`

              The resolved version: a skill version ID for custom skills.

              minLength: 1, maxLength: 64

        - `Content []ContentBlockUnion`

          Content generated by the model.

          This is an array of content blocks, each of which has a `type` that determines its shape.

          Example:

          ```json
          [{"type": "text", "text": "Hi, I'm Claude."}]
          ```

          If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

          For example, if the input `messages` were:

          ```json
          [
            {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
            {"role": "assistant", "content": "The best answer is ("}
          ]
          ```

          Then the response `content` might be:

          ```json
          [{"type": "text", "text": "B)"}]
          ```

          - `type TextBlock`

            - `Type Text`

              default: text

            - `Citations []TextCitationUnion`

              Citations supporting the text block.

              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`.

              - `type CitationCharLocation`

                - `Type CharLocation`

                  default: char_location

                - `CitedText string`

                - `DocumentIndex int64`

                  minimum: 0

                - `DocumentTitle string`

                - `EndCharIndex int64`

                - `FileID string`

                - `StartCharIndex int64`

                  minimum: 0

              - `type CitationPageLocation`

                - `Type PageLocation`

                  default: page_location

                - `CitedText string`

                - `DocumentIndex int64`

                  minimum: 0

                - `DocumentTitle string`

                - `EndPageNumber int64`

                - `FileID string`

                - `StartPageNumber int64`

                  minimum: 1

              - `type CitationContentBlockLocation`

                - `Type ContentBlockLocation`

                  default: content_block_location

                - `CitedText string`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `DocumentIndex int64`

                  minimum: 0

                - `DocumentTitle string`

                - `EndBlockIndex int64`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `FileID string`

                - `StartBlockIndex int64`

                  0-based index of the first cited block in the source's `content` array.

                  minimum: 0

              - `type CitationsWebSearchResultLocation`

                - `Type WebSearchResultLocation`

                  default: web_search_result_location

                - `CitedText string`

                - `EncryptedIndex string`

                - `Title string`

                  maxLength: 512

                - `URL string`

              - `type CitationsSearchResultLocation`

                - `Type SearchResultLocation`

                  default: search_result_location

                - `CitedText string`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `EndBlockIndex int64`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `SearchResultIndex int64`

                  0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                  Counted separately from `document_index`; server-side web search results are not included in this count.

                  minimum: 0

                - `Source string`

                - `StartBlockIndex int64`

                  0-based index of the first cited block in the source's `content` array.

                  minimum: 0

                - `Title string`

            - `Text string`

          - `type ThinkingBlock`

            - `Type Thinking`

              default: thinking

            - `Signature string`

              A value used to verify that this thinking block was generated by Claude when it is passed back to the API.

              This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact.

              See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking?sdk_languages=go) for details.

            - `Thinking string`

              The text of Claude's thinking process for this block.

          - `type RedactedThinkingBlock`

            - `Type RedactedThinking`

              default: redacted_thinking

            - `Data string`

              The contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content.

              Pass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation.

              See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking?sdk_languages=go#redacted-thinking-blocks) for details.

          - `type ToolUseBlock`

            - `Type ToolUse`

              default: tool_use

            - `ID string`

              pattern: ^[a-zA-Z0-9_-]+$

            - `Caller ToolUseBlockCallerUnion`

              default: {"type":"direct"}

              - `type DirectCaller`

                Tool invocation directly from the model.

                - `Type Direct`

              - `type ServerToolCaller`

                Tool invocation generated by a server-side tool.

                - `Type CodeExecution20250825`

                - `ToolID string`

                  pattern: ^srvtoolu_[a-zA-Z0-9_]+$

              - `type ServerToolCaller20260120`

                - `Type CodeExecution20260120`

                - `ToolID string`

                  pattern: ^srvtoolu_[a-zA-Z0-9_]+$

            - `Input map[string, any]`

            - `Name string`

              minLength: 1

            - `ToolsetName string Optional`

              For a toolset member tool_use, the toolset family.

              minLength: 1, maxLength: 64, pattern: ^[a-zA-Z0-9_-]+$

          - `type ServerToolUseBlock`

            - `Type ServerToolUse`

              default: server_tool_use

            - `ID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

            - `Caller ServerToolUseBlockCallerUnion`

              default: {"type":"direct"}

              - `type DirectCaller`

                Tool invocation directly from the model.

              - `type ServerToolCaller`

                Tool invocation generated by a server-side tool.

              - `type ServerToolCaller20260120`

            - `Input map[string, any]`

            - `Name ServerToolUseBlockName`

              - `const ServerToolUseBlockNameWebSearch ServerToolUseBlockName = "web_search"`

              - `const ServerToolUseBlockNameWebFetch ServerToolUseBlockName = "web_fetch"`

              - `const ServerToolUseBlockNameCodeExecution ServerToolUseBlockName = "code_execution"`

              - `const ServerToolUseBlockNameBashCodeExecution ServerToolUseBlockName = "bash_code_execution"`

              - `const ServerToolUseBlockNameTextEditorCodeExecution ServerToolUseBlockName = "text_editor_code_execution"`

              - `const ServerToolUseBlockNameToolSearchToolRegex ServerToolUseBlockName = "tool_search_tool_regex"`

              - `const ServerToolUseBlockNameToolSearchToolBm25 ServerToolUseBlockName = "tool_search_tool_bm25"`

          - `type WebSearchToolResultBlock`

            - `Type WebSearchToolResult`

              default: web_search_tool_result

            - `Caller WebSearchToolResultBlockCallerUnion`

              default: {"type":"direct"}

              - `type DirectCaller`

                Tool invocation directly from the model.

              - `type ServerToolCaller`

                Tool invocation generated by a server-side tool.

              - `type ServerToolCaller20260120`

            - `Content WebSearchToolResultBlockContentUnion`

              - `type WebSearchToolResultError`

                - `Type WebSearchToolResultError`

                  default: web_search_tool_result_error

                - `ErrorCode WebSearchToolResultErrorCode`

                  - `const WebSearchToolResultErrorCodeInvalidToolInput WebSearchToolResultErrorCode = "invalid_tool_input"`

                  - `const WebSearchToolResultErrorCodeUnavailable WebSearchToolResultErrorCode = "unavailable"`

                  - `const WebSearchToolResultErrorCodeMaxUsesExceeded WebSearchToolResultErrorCode = "max_uses_exceeded"`

                  - `const WebSearchToolResultErrorCodeTooManyRequests WebSearchToolResultErrorCode = "too_many_requests"`

                  - `const WebSearchToolResultErrorCodeQueryTooLong WebSearchToolResultErrorCode = "query_too_long"`

                  - `const WebSearchToolResultErrorCodeRequestTooLarge WebSearchToolResultErrorCode = "request_too_large"`

              - `[]WebSearchResultBlock`

                - `Type WebSearchResult`

                  default: web_search_result

                - `EncryptedContent string`

                - `PageAge string`

                - `Title string`

                - `URL string`

            - `ToolUseID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

          - `type WebFetchToolResultBlock`

            - `Type WebFetchToolResult`

              default: web_fetch_tool_result

            - `Caller WebFetchToolResultBlockCallerUnion`

              default: {"type":"direct"}

              - `type DirectCaller`

                Tool invocation directly from the model.

              - `type ServerToolCaller`

                Tool invocation generated by a server-side tool.

              - `type ServerToolCaller20260120`

            - `Content WebFetchToolResultBlockContentUnion`

              - `type WebFetchToolResultErrorBlock`

                - `Type WebFetchToolResultError`

                  default: web_fetch_tool_result_error

                - `ErrorCode WebFetchToolResultErrorCode`

                  - `const WebFetchToolResultErrorCodeInvalidToolInput WebFetchToolResultErrorCode = "invalid_tool_input"`

                  - `const WebFetchToolResultErrorCodeURLTooLong WebFetchToolResultErrorCode = "url_too_long"`

                  - `const WebFetchToolResultErrorCodeURLNotAllowed WebFetchToolResultErrorCode = "url_not_allowed"`

                  - `const WebFetchToolResultErrorCodeURLNotInPriorContext WebFetchToolResultErrorCode = "url_not_in_prior_context"`

                  - `const WebFetchToolResultErrorCodeURLNotAccessible WebFetchToolResultErrorCode = "url_not_accessible"`

                  - `const WebFetchToolResultErrorCodeUnsupportedContentType WebFetchToolResultErrorCode = "unsupported_content_type"`

                  - `const WebFetchToolResultErrorCodeTooManyRequests WebFetchToolResultErrorCode = "too_many_requests"`

                  - `const WebFetchToolResultErrorCodeMaxUsesExceeded WebFetchToolResultErrorCode = "max_uses_exceeded"`

                  - `const WebFetchToolResultErrorCodeUnavailable WebFetchToolResultErrorCode = "unavailable"`

                  - `const WebFetchToolResultErrorCodeContentTooLarge WebFetchToolResultErrorCode = "content_too_large"`

              - `type WebFetchBlock`

                - `Type WebFetchResult`

                  default: web_fetch_result

                - `Content DocumentBlock`

                  - `Type Document`

                    default: document

                  - `Citations CitationsConfig`

                    Citation configuration for the document

                    - `Enabled bool`

                      default: false

                  - `Source DocumentBlockSourceUnion`

                    - `type Base64PDFSource`

                      - `Type Base64`

                      - `Data string`

                        format: byte

                      - `MediaType ApplicationPDF`

                    - `type PlainTextSource`

                      - `Type Text`

                      - `Data string`

                      - `MediaType TextPlain`

                  - `Title string`

                    The title of the document

                - `RetrievedAt string`

                  ISO 8601 timestamp when the content was retrieved

                - `URL string`

                  Fetched content URL

            - `ToolUseID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

          - `type CodeExecutionToolResultBlock`

            - `Type CodeExecutionToolResult`

              default: code_execution_tool_result

            - `Content CodeExecutionToolResultBlockContentUnion`

              - `type CodeExecutionToolResultError`

                - `Type CodeExecutionToolResultError`

                  default: code_execution_tool_result_error

                - `ErrorCode CodeExecutionToolResultErrorCode`

                  - `const CodeExecutionToolResultErrorCodeInvalidToolInput CodeExecutionToolResultErrorCode = "invalid_tool_input"`

                  - `const CodeExecutionToolResultErrorCodeUnavailable CodeExecutionToolResultErrorCode = "unavailable"`

                  - `const CodeExecutionToolResultErrorCodeTooManyRequests CodeExecutionToolResultErrorCode = "too_many_requests"`

                  - `const CodeExecutionToolResultErrorCodeExecutionTimeExceeded CodeExecutionToolResultErrorCode = "execution_time_exceeded"`

              - `type CodeExecutionResultBlock`

                - `Type CodeExecutionResult`

                  default: code_execution_result

                - `Content []CodeExecutionOutputBlock`

                  - `Type CodeExecutionOutput`

                    default: code_execution_output

                  - `FileID string`

                - `ReturnCode int64`

                - `Stderr string`

                - `Stdout string`

              - `type EncryptedCodeExecutionResultBlock`

                Code execution result with encrypted stdout for PFC + web_search results.

                - `Type EncryptedCodeExecutionResult`

                  default: encrypted_code_execution_result

                - `Content []CodeExecutionOutputBlock`

                  - `Type CodeExecutionOutput`

                    default: code_execution_output

                  - `FileID string`

                - `EncryptedStdout string`

                - `ReturnCode int64`

                - `Stderr string`

            - `ToolUseID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

          - `type BashCodeExecutionToolResultBlock`

            - `Type BashCodeExecutionToolResult`

              default: bash_code_execution_tool_result

            - `Content BashCodeExecutionToolResultBlockContentUnion`

              - `type BashCodeExecutionToolResultError`

                - `Type BashCodeExecutionToolResultError`

                  default: bash_code_execution_tool_result_error

                - `ErrorCode BashCodeExecutionToolResultErrorCode`

                  - `const BashCodeExecutionToolResultErrorCodeInvalidToolInput BashCodeExecutionToolResultErrorCode = "invalid_tool_input"`

                  - `const BashCodeExecutionToolResultErrorCodeUnavailable BashCodeExecutionToolResultErrorCode = "unavailable"`

                  - `const BashCodeExecutionToolResultErrorCodeTooManyRequests BashCodeExecutionToolResultErrorCode = "too_many_requests"`

                  - `const BashCodeExecutionToolResultErrorCodeExecutionTimeExceeded BashCodeExecutionToolResultErrorCode = "execution_time_exceeded"`

                  - `const BashCodeExecutionToolResultErrorCodeOutputFileTooLarge BashCodeExecutionToolResultErrorCode = "output_file_too_large"`

              - `type BashCodeExecutionResultBlock`

                - `Type BashCodeExecutionResult`

                  default: bash_code_execution_result

                - `Content []BashCodeExecutionOutputBlock`

                  - `Type BashCodeExecutionOutput`

                    default: bash_code_execution_output

                  - `FileID string`

                - `ReturnCode int64`

                - `Stderr string`

                - `Stdout string`

            - `ToolUseID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

          - `type TextEditorCodeExecutionToolResultBlock`

            - `Type TextEditorCodeExecutionToolResult`

              default: text_editor_code_execution_tool_result

            - `Content TextEditorCodeExecutionToolResultBlockContentUnion`

              - `type TextEditorCodeExecutionToolResultError`

                - `Type TextEditorCodeExecutionToolResultError`

                  default: text_editor_code_execution_tool_result_error

                - `ErrorCode TextEditorCodeExecutionToolResultErrorCode`

                  - `const TextEditorCodeExecutionToolResultErrorCodeInvalidToolInput TextEditorCodeExecutionToolResultErrorCode = "invalid_tool_input"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeUnavailable TextEditorCodeExecutionToolResultErrorCode = "unavailable"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeTooManyRequests TextEditorCodeExecutionToolResultErrorCode = "too_many_requests"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeExecutionTimeExceeded TextEditorCodeExecutionToolResultErrorCode = "execution_time_exceeded"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeFileNotFound TextEditorCodeExecutionToolResultErrorCode = "file_not_found"`

                - `ErrorMessage string`

              - `type TextEditorCodeExecutionViewResultBlock`

                - `Type TextEditorCodeExecutionViewResult`

                  default: text_editor_code_execution_view_result

                - `Content string`

                - `FileType TextEditorCodeExecutionViewResultBlockFileType`

                  - `const TextEditorCodeExecutionViewResultBlockFileTypeText TextEditorCodeExecutionViewResultBlockFileType = "text"`

                  - `const TextEditorCodeExecutionViewResultBlockFileTypeImage TextEditorCodeExecutionViewResultBlockFileType = "image"`

                  - `const TextEditorCodeExecutionViewResultBlockFileTypePDF TextEditorCodeExecutionViewResultBlockFileType = "pdf"`

                - `NumLines int64`

                - `StartLine int64`

                - `TotalLines int64`

              - `type TextEditorCodeExecutionCreateResultBlock`

                - `Type TextEditorCodeExecutionCreateResult`

                  default: text_editor_code_execution_create_result

                - `IsFileUpdate bool`

              - `type TextEditorCodeExecutionStrReplaceResultBlock`

                - `Type TextEditorCodeExecutionStrReplaceResult`

                  default: text_editor_code_execution_str_replace_result

                - `Lines []string`

                - `NewLines int64`

                - `NewStart int64`

                - `OldLines int64`

                - `OldStart int64`

            - `ToolUseID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

          - `type ToolSearchToolResultBlock`

            - `Type ToolSearchToolResult`

              default: tool_search_tool_result

            - `Content ToolSearchToolResultBlockContentUnion`

              - `type ToolSearchToolResultError`

                - `Type ToolSearchToolResultError`

                  default: tool_search_tool_result_error

                - `ErrorCode ToolSearchToolResultErrorCode`

                  - `const ToolSearchToolResultErrorCodeInvalidToolInput ToolSearchToolResultErrorCode = "invalid_tool_input"`

                  - `const ToolSearchToolResultErrorCodeUnavailable ToolSearchToolResultErrorCode = "unavailable"`

                  - `const ToolSearchToolResultErrorCodeTooManyRequests ToolSearchToolResultErrorCode = "too_many_requests"`

                  - `const ToolSearchToolResultErrorCodeExecutionTimeExceeded ToolSearchToolResultErrorCode = "execution_time_exceeded"`

                - `ErrorMessage string`

              - `type ToolSearchToolSearchResultBlock`

                - `Type ToolSearchToolSearchResult`

                  default: tool_search_tool_search_result

                - `ToolReferences []ToolReferenceBlock`

                  - `Type ToolReference`

                    default: tool_reference

                  - `ToolName string`

                    minLength: 1, maxLength: 256, pattern: ^[a-zA-Z0-9_-]{1,256}$

            - `ToolUseID string`

              pattern: ^srvtoolu_[a-zA-Z0-9_]+$

          - `type ContainerUploadBlock`

            Response model for a file uploaded to the container.

            - `Type ContainerUpload`

              default: container_upload

            - `FileID string`

        - `Diagnostics Diagnostics`

          Request-level diagnostics. `null` when the request did not supply `diagnostics`, or when it did and no prompt-cache divergence was detected.

          - `CacheMissReason CacheMissReasonUnion`

            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.

            - `type CacheMissModelChanged`

              - `Type ModelChanged`

                default: model_changed

              - `CacheMissedInputTokens int64`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `type CacheMissSystemChanged`

              - `Type SystemChanged`

                default: system_changed

              - `CacheMissedInputTokens int64`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `type CacheMissToolsChanged`

              - `Type ToolsChanged`

                default: tools_changed

              - `CacheMissedInputTokens int64`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `type CacheMissMessagesChanged`

              - `Type MessagesChanged`

                default: messages_changed

              - `CacheMissedInputTokens int64`

                Approximate number of input tokens that would have been read from cache had the prefix matched the previous request.

            - `type CacheMissPreviousMessageNotFound`

              - `Type PreviousMessageNotFound`

                default: previous_message_not_found

            - `type CacheMissUnavailable`

              - `Type Unavailable`

                default: unavailable

        - `Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `const ModelClaudeHaiku5_5 Model = "claude-haiku-5-5"`

            Fastest model for high-volume, real-time tasks

          - `const ModelClaudeSonnet5_5 Model = "claude-sonnet-5-5"`

            Efficient model for coding and agents

          - `const ModelClaudeFable5_1 Model = "claude-fable-5-1"`

            Frontier intelligence for ambitious tasks across coding, scientific discovery, and enterprise workflows

          - `const ModelClaudeOpus5_5 Model = "claude-opus-5-5"`

            Powerful intelligence for coding, knowledge work, and long-running agents

          - `const ModelClaudeMythos5_1 Model = "claude-mythos-5-1"`

            Our most capable model for cybersecurity and biology research, available through trusted access programs

          - `const ModelClaudeSonnet5 Model = "claude-sonnet-5"`

            Efficient model for coding and agents

          - `const ModelClaudeFable5 Model = "claude-fable-5"`

            Next generation of intelligence for the hardest knowledge work and coding problems

          - `const ModelClaudeMythos5 Model = "claude-mythos-5"`

            Most capable model for cybersecurity and biology research

          - `const ModelClaudeOpus5 Model = "claude-opus-5"`

            Powerful intelligence for long-running agents and coding

          - `const ModelClaudeOpus4_8 Model = "claude-opus-4-8"`

            Powerful intelligence for long-running agents and coding

          - `const ModelClaudeOpus4_7 Model = "claude-opus-4-7"`

            Powerful intelligence for long-running agents and coding

          - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"`

            Powerful intelligence for long-running agents and coding

          - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"`

            Best combination of speed and intelligence

          - `const ModelClaudeHaiku4_5 Model = "claude-haiku-4-5"`

          - `const ModelClaudeHaiku4_5_20251001 Model = "claude-haiku-4-5-20251001"`

          - `const ModelClaudeOpus4_5 Model = "claude-opus-4-5"`

            Powerful intelligence for long-running agents and coding

          - `const ModelClaudeOpus4_5_20251101 Model = "claude-opus-4-5-20251101"`

            Powerful intelligence for long-running agents and coding

          - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"`

            **Deprecated**: Will reach end-of-life on June 30, 2026. Please migrate to claude-mythos-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.

            New class of intelligence, strongest in coding and cybersecurity

          - `const ModelClaudeSonnet4_5 Model = "claude-sonnet-4-5"`

            **Deprecated**: Will reach end-of-life on November 30, 2026. Please migrate to claude-sonnet-5-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.

            High-performance model for agents and coding

          - `const ModelClaudeSonnet4_5_20250929 Model = "claude-sonnet-4-5-20250929"`

            **Deprecated**: Will reach end-of-life on November 30, 2026. Please migrate to claude-sonnet-5-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.

            High-performance model for agents and coding

        - `Role Assistant`

          Conversational role of the generated message.

          This will always be `"assistant"`.

          default: assistant

        - `StopDetails RefusalStopDetails`

          Structured information about why model output stopped.

          This is `null` when the `stop_reason` has no additional detail to report.

          - `Type Refusal`

            default: refusal

          - `Category RefusalStopDetailsCategory`

            The policy category that triggered the refusal.

            `null` when the refusal doesn't map to a named category.

            - `const RefusalStopDetailsCategoryCyber RefusalStopDetailsCategory = "cyber"`

              The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category.

            - `const RefusalStopDetailsCategoryBio RefusalStopDetailsCategory = "bio"`

              The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category.

            - `const RefusalStopDetailsCategoryFrontierLLM RefusalStopDetailsCategory = "frontier_llm"`

              The request could assist the development of competing AI models, which is restricted under [Anthropic's commercial terms](https://www.anthropic.com/legal/commercial-terms). Benign machine learning work can also trigger this category.

            - `const RefusalStopDetailsCategoryReasoningExtraction RefusalStopDetailsCategory = "reasoning_extraction"`

              The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking?sdk_languages=go).

            - `const RefusalStopDetailsCategoryGeneralHarms RefusalStopDetailsCategory = "general_harms"`

              The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.

          - `Explanation string`

            Human-readable explanation of the refusal.

            This text is not guaranteed to be stable. `null` when no explanation is available for the category.

        - `StopReason StopReason`

          The reason that we stopped.

          This may be one the following values:

          * `"end_turn"`: the model reached a natural stopping point
          * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
          * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
          * `"tool_use"`: the model invoked one or more tools
          * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
          * `"refusal"`: when streaming classifiers intervene to handle potential policy violations
          * `"model_context_window_exceeded"`: we exceeded the model's context window

          In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

          - `const StopReasonEndTurn StopReason = "end_turn"`

          - `const StopReasonMaxTokens StopReason = "max_tokens"`

          - `const StopReasonStopSequence StopReason = "stop_sequence"`

          - `const StopReasonToolUse StopReason = "tool_use"`

          - `const StopReasonPauseTurn StopReason = "pause_turn"`

          - `const StopReasonRefusal StopReason = "refusal"`

          - `const StopReasonModelContextWindowExceeded StopReason = "model_context_window_exceeded"`

        - `StopSequence string`

          Which custom stop sequence was generated, if any.

          This value will be a non-null string if one of your custom stop sequences was generated.

        - `Usage Usage`

          Billing and rate-limit usage.

          Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

          Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

          For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

          Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

          - `CacheCreation CacheCreation`

            Breakdown of cached tokens by TTL

            - `Ephemeral1hInputTokens int64`

              The number of input tokens used to create the 1 hour cache entry.

              default: 0, minimum: 0

            - `Ephemeral5mInputTokens int64`

              The number of input tokens used to create the 5 minute cache entry.

              default: 0, minimum: 0

          - `CacheCreationInputTokens int64`

            The number of input tokens used to create the cache entry.

            minimum: 0

          - `CacheReadInputTokens int64`

            The number of input tokens read from the cache.

            minimum: 0

          - `InferenceGeo string`

            The geographic region where inference was performed for this request.

          - `InputTokens int64`

            The number of input tokens which were used.

            minimum: 0

          - `OutputTokens int64`

            The number of output tokens which were used.

            minimum: 0

          - `OutputTokensDetails OutputTokensDetails`

            Breakdown of output tokens by category.

            `output_tokens` remains the inclusive, authoritative total used for billing.
            This object provides a read-only decomposition for observability — for example,
            how many of the billed output tokens were spent on internal reasoning that may
            have been summarized before being returned to you.

            - `ThinkingTokens int64`

              Number of output tokens the model generated as internal reasoning, including
              the thinking-block delimiter tokens.

              Reflects the raw reasoning the model produced, not the (possibly shorter)
              summarized thinking text returned in the response body. Computed by
              re-tokenizing the raw reasoning text, so it may differ from the model's exact
              generation count by a small number of tokens. Always ≤ `output_tokens`;
              `output_tokens - thinking_tokens` approximates the non-reasoning output.

              default: 0, minimum: 0

          - `ServerToolUse ServerToolUsage`

            The number of server tool requests.

            - `WebFetchRequests int64`

              The number of web fetch tool requests.

              default: 0, minimum: 0

            - `WebSearchRequests int64`

              The number of web search tool requests.

              default: 0, minimum: 0

          - `ServiceTier UsageServiceTier`

            If the request used the priority, standard, or batch tier.

            - `const UsageServiceTierStandard UsageServiceTier = "standard"`

            - `const UsageServiceTierPriority UsageServiceTier = "priority"`

            - `const UsageServiceTierBatch UsageServiceTier = "batch"`

          - `Speed UsageSpeed`

            The inference speed mode used for this request.

            - `const UsageSpeedStandard UsageSpeed = "standard"`

            - `const UsageSpeedFast UsageSpeed = "fast"`

    - `type MessageBatchErroredResult`

      - `Type Errored`

        default: errored

      - `Error ErrorResponse`

        - `Type Error`

          default: error

        - `Error ErrorObjectUnion`

          - `type InvalidRequestError`

            - `Type InvalidRequestError`

              default: invalid_request_error

            - `Message string`

              default: Invalid request

          - `type AuthenticationError`

            - `Type AuthenticationError`

              default: authentication_error

            - `Message string`

              default: Authentication error

          - `type BillingError`

            - `Type BillingError`

              default: billing_error

            - `Message string`

              default: Billing error

          - `type PermissionError`

            - `Type PermissionError`

              default: permission_error

            - `Message string`

              default: Permission denied

          - `type NotFoundError`

            - `Type NotFoundError`

              default: not_found_error

            - `Message string`

              default: Not found

          - `type RateLimitError`

            - `Type RateLimitError`

              default: rate_limit_error

            - `Message string`

              default: Rate limited

          - `type GatewayTimeoutError`

            - `Type TimeoutError`

              default: timeout_error

            - `Message string`

              default: Request timeout

          - `type APIErrorObject`

            - `Type APIError`

              default: api_error

            - `Message string`

              default: Internal server error

          - `type OverloadedError`

            - `Type OverloadedError`

              default: overloaded_error

            - `Message string`

              default: Overloaded

        - `RequestID string`

    - `type MessageBatchCanceledResult`

      - `Type Canceled`

        default: canceled

    - `type MessageBatchExpiredResult`

      - `Type Expired`

        default: expired

## Example

```go
package main

import (
	"context"
	"fmt"

	"github.com/anthropics/anthropic-sdk-go"
	"github.com/anthropics/anthropic-sdk-go/option"
)

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	stream := client.Messages.Batches.ResultsStreaming(
		context.TODO(),
		"message_batch_id",
		anthropic.MessageBatchResultsParams{},
	)
	for stream.Next() {
		fmt.Printf("%+v\n", stream.Current())
	}
	err := stream.Err()
	if err != nil {
		panic(err.Error())
	}
}
```
