Claude API
How do you pass PDF files to the Claude API?
QUICK ANSWER
To send a PDF, pass it as a document content block in the messages array, base64-encoded, using the media type application/pdf.
JSON Payload PDF Request
{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": "JVBERi0xLjQKJdPr6g..."
}
},
{
"type": "text",
"text": "Summarize this PDF document."
}
]
}
]
}
Verified against: Anthropic API Document Processing Spec 2026