Anthropic Claude API
Download Anthropic Message Batch results
After processing ends, stream the Message Batch results as JSONL. Match each line by custom_id and check result.type for succeeded, errored, canceled, or expired before reading message content.
Documentation reviewed · 2 methods with sources
Ways to do it
API
GET /v1/messages/batches/{message_batch_id}/results
Stream one JSON object per request after the batch reaches ended.
Read source: Anthropic retrieve Message Batch results- Requirements
- An Anthropic API key, the Message Batch ID, and the anthropic-version header.
- Limitations
- Results are not guaranteed to follow request order. Each line can contain a message, an error, or a reason the request was not attempted.
Example shell
curl --fail "https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID/results" -H 'anthropic-version: 2026-10-21' -H "Authorization: Bearer $ANTHROPIC_API_KEY" > results.jsonlSDK
messages.batches.results()
Stream JSONL results through the official Python client and match each response by custom_id.
Read source: Anthropic Python batch results reference- Requirements
- The anthropic Python package, ANTHROPIC_API_KEY, and the ID of a batch whose processing has ended.
- Limitations
- A batch returns one result per input request. Read message fields only on succeeded results.
Example text
import os
from anthropic import Anthropic
client = Anthropic()
for item in client.messages.batches.results(os.environ["MESSAGE_BATCH_ID"]):
print(item.custom_id, item.result.type)