Claude Files API, PDFs and images: limits and block types
Upload a file once to POST /v1/files, then reference its file_id from a document block for PDFs and plain text, or from an image block for JPEG, PNG, GIF and WebP. PDFs and images can also be sent inline as base64 or by URL.
Block types and sources
The block type must match the file's MIME type. A PNG referenced from a document block is rejected; use {"type": "image", "source": {"type": "file", "file_id": "..."}}. Formats the document block does not support, such as .docx and .xlsx, must be converted to text or PDF first. On Amazon Bedrock and Google Cloud, only base64 sources are available.
Files are scoped to the workspace, not to an end user, so never accept a file_id from a user. Files you upload have downloadable: false; only files created by skills or the code execution tool can be downloaded. Files API operations are free, and file content used in a request is billed as input tokens.
Expiry
Files persist until deleted unless you pass expires_in_seconds at upload, between 3,600 and 7,776,000 seconds. It cannot be changed later. After expires_at, a Messages request that references the file fails before inference, but the file stays in list responses with readable metadata for up to 30 days. Compare expires_at with the current time instead of trusting the listing.
PDF and image limits
A request can carry up to 600 PDF pages, or 100 when its context window is under 1M tokens, within a 32 MB request size. Each page is sent as extracted text plus an image, typically 1,500 to 3,000 text tokens per page plus image tokens, so dense PDFs can fill the context window before the page limit. Place PDFs before your question.
Images cost one visual token per 28x28 pixel patch. Claude 4.7 and later models downscale above a 2576 px long edge or 4,784 visual tokens; other models above 1568 px or 1,568 tokens. Each image may be up to 8000x8000 px. Animated GIFs are not supported: only the first frame is used, with no error.
Where the exam catches people
Believing any uploaded file works in a document block: images need an image block.
Believing a file that appears in the list is still usable: expired files stay listed for up to 30 days but fail in Messages requests.
Believing an animated GIF is read frame by frame: only the first frame is used.
Believing you can download a PDF you uploaded: only files created by skills or code execution are downloadable.