# 413 request_too_large: respect the per-endpoint byte caps
Anthropic enforces hard request size limits per endpoint. The documented caps:
- Messages API: 32 MB
- Token Counting API: 32 MB
- Batch API: 256 MB
- Files API: 500 MB
On the direct Claude API, Cloudflare returns this error before the request even reaches Anthropic's servers.
## What to do
1. Measure your request body in bytes. Compare against the cap for the endpoint you called.
2. If the payload is dominated by base64 images or documents, shrinking the text prompt will not help. Move the content to the Files API (500 MB cap) and reference it instead.
3. For batch workloads, split into smaller batches under the 256 MB cap rather than one giant request.
4. Retry policy: never retry a 413 unchanged. It is deterministic.
## The trap
Thinking in tokens. The 413 is about bytes on the wire, and a few high-resolution images in base64 blow past 32 MB while the token count looks modest. The other trap: compressing the JSON when the real fix is moving the payload to the right endpoint.
## Checklist
- Know which endpoint's cap you are under before you start trimming. Trimming a Messages request to fit Batch limits is wasted work.
- If you hit 413 on the Files API itself at 500 MB, split the file. There is no bigger door.