When receiving a
streaming
response over server-sent events (SSE), an error can occur after the API returns a 200 response. In that case, error handling doesn't follow these standard mechanisms. See
Error events
for the shape of mid-stream errors.
Request size limits

The API enforces request size limits:
Endpoint type
Maximum request size
Messages API
32 MB
Token Counting API
32 MB
Batch API
256 MB
Files API
500 MB
If you exceed these limits, you'll receive a 413
request_too_large
error. On the direct Claude API, Cloudflare returns this error before the request reaches the API servers.
Error shapes

The API always returns errors as JSON, with a top-level
error
object that always includes a
type
and
message
value.
