A 413 means the request body exceeded Mixpanel’s size limit. Split the batch and send it again.
What the Response Looks Like
Size Limits
The size limit is measured against the uncompressed body. Sending Content-Encoding: gzip reduces network egress and transfer time, but it does not let you fit more data into one request.
Common Causes
Too Many Events Per Batch
The 2,000-event cap and the 10MB cap apply independently. A batch of 2,000 unusually large events can exceed 10MB even though the event count is legal.
One Oversized Event
A single event over 1MB fails validation. This usually comes from embedding a large payload in a property — a JSON blob stored as a string, a base64 attachment, or full page HTML.
Strings over 255 characters are truncated rather than rejected, so ordinary long text does not cause a 413 on its own.
How to Fix It
Batch by size, not just by count. Track the serialized byte length as you build a batch and flush when it approaches 10MB, rather than always sending 2,000 events.
Find the oversized events before sending. Measure each event’s serialized length and log anything over 1MB.
Move large values out of properties. Parse a JSON-encoded string into individual properties, or drop the field if it is not useful for analysis. See Import Events for guidance on long strings.