A document block in an assistant message returns a 400 in API version 2026-10-21
Returns 400
Applies to claude-* on the Anthropic Messages API with anthropic-version: 2026-10-21.
Anthropic's docs describe this error but don't quote the exact message, so we don't either.
How to fix it
Move the document into a user message.
Before
{
"max_tokens": 1024,
"messages": [
{
"content": "Read this.",
"role": "user"
},
{
"content": [
{
"source": {
"data": "...",
"media_type": "text/plain",
"type": "text"
},
"type": "document"
}
],
"role": "assistant"
},
{
"content": "Summarize it.",
"role": "user"
}
],
"model": "claude-opus-4-8"
}After (Claude Opus 4.8 (API version rules only))
{
"max_tokens": 1024,
"messages": [
{
"content": [
{
"source": {
"data": "...",
"media_type": "text/plain",
"type": "text"
},
"type": "document"
},
{
"text": "Summarize it.",
"type": "text"
}
],
"role": "user"
}
],
"model": "claude-opus-4-8"
}Official source
In2026-10-21, a request that places adocumentblock directly in anassistantmessage returns a 400 error.
https://platform.claude.com/docs/en/api/migration-2026-10-21 (last checked 2026-11-02)
Other changes for the same models
FAQ
How do I fix this when moving to claude-*?
Move the document into a user message.
Where is this documented?
In Anthropic’s official docs: https://platform.claude.com/docs/en/api/migration-2026-10-21, last checked 2026-11-02.