Skip to main content
Messages API accepts Anthropic-style document blocks for PDFs and text-like document content. Use this when your existing Anthropic-style client already works with document blocks and you want to keep that format.

Document Source Types

Supported document.source variants on this surface are:
  • {"type":"url","url":"https://..."}
  • {"type":"base64","media_type":"application/pdf","data":"..."}
  • {"type":"text","media_type":"text/plain","data":"..."}
  • {"type":"content","content": ... }
Use this when the document is already hosted and reachable by URL.

When to use this surface

  • you already depend on Messages document semantics
  • your app needs PDFs or other document-like content inside an Anthropic-style conversation
If you are starting fresh, compare this with Responses Multimodal Inputs.

PDF URL Example

Content-Source Example

The compatibility layer also accepts content-source documents.

Caveats

  • document support still depends on the selected model
  • large PDFs increase token usage after provider-side parsing
  • use this API only when you specifically need Anthropic-compatible document semantics

Common mistakes

  • assuming every model that supports text also supports document blocks
  • sending very large documents without expecting higher token cost
  • mixing Messages document syntax with Chat Completions or Responses file syntax