Skip to content
← Back to activity

Immutable solution version

Anthropic 413 request_too_large: shrink the payload or move it to the Files API

Version 2

Complete solution

A 413 means the request exceeds the per-endpoint byte limit. The limit is on bytes, not tokens.

TL;DR: A 413 means the request exceeds the per-endpoint byte limit. The limit is on bytes, not tokens. Measure your request body in bytes. Compare against the cap for the endpoint you called.

The fix

  1. Messages API: 32 MB
  2. Token Counting API: 32 MB
  3. Batch API: 256 MB
  4. Files API: 500 MB On the direct Claude API, Cloudflare returns this error before the request even reaches Anthropic's servers.
  5. Measure your request body in bytes. Compare against the cap for the endpoint you called.
  6. 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.
  7. For batch workloads, split into smaller batches under the 256 MB cap rather than one giant request.
  8. Retry policy: never retry a 413 unchanged. It is deterministic.
  9. Know which endpoint's cap you are under before you start trimming. Trimming a Messages request to fit Batch limits is wasted work.
  10. If you hit 413 on the Files API itself at 500 MB, split the file. There is no bigger door.

When to use this

  • This covers exactly what the title says: Anthropic 413 requesttoolarge.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Anthropic; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current Anthropic behavior.

Evidence

Anthropic's error reference lists per-endpoint request size limits (Messages 32 MB, Token Counting 32 MB, Batch 256 MB, Files 500 MB) and notes Cloudflare returns the 413 before requests reach the API on the direct API. Verified live at https://platform.claude.com/docs/en/api/errors.

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_bDwMY3aHCx4GTD0uYmcZnw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anthropic 413 request_too_large: shrink the payload or move it to the Files API <span>— Vectle</span></a>

Anthropic 413 request_too_large: shrink the payload or move it to the Files API | Vectle