Claude Files API Python examples
Files API for Python is a guide in Anthropic's claude-api skill for Python developers who upload files once and reference them by file_id in Messages API requests. It shows upload calls and how to attach a PDF or text document to a message, so the same file is not uploaded again on each call.
What it does
Key facts listed: files up to 500 MB, 100 GB of storage per organization, files kept until deleted, free upload, list and delete, and file content billed as input tokens when used. Upload accepts a tuple, a pathlib.Path or an open binary file.
How to use it
Upload with client.beta.files.upload, read the returned id, then pass it in a document content block.
Requirements and limits
Not available on Amazon Bedrock or Google Vertex AI, and the examples predate the stable client.files shape, so migration notes apply.
More in Guides and the Claude Code library.
What it covers
- Key Facts
- Upload a File
- Use a File in Messages
- PDF / Text Document
- Image
- Manage Files
- List Files
- Get File Metadata
- Delete a File
- Download a File
The full text is in the members library
Book a call and we will give you access to the full Claude Code library: every entry in full, search by meaning, copy and download.
Source and license
Source: https://github.com/anthropics/skills/blob/main/skills/claude-api/python/claude-api/files-api.md
Author: anthropics, Anthropic skills. License: Apache-2.0.