> ## Documentation Index
> Fetch the complete documentation index at: https://mixpanel-edb78807-copilot-tof-446-create-per-error-troubles.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 413 Payload Too Large

> Mixpanel's request and event size limits, why gzip does not raise them, and how to batch imports so they stay under the cap

A 413 means the request body exceeded Mixpanel's size limit. Split the batch and send it again.

## What the Response Looks Like

```json theme={"system"}
{
  "code": 413,
  "error": "request exceeds max limit of 2097152 bytes",
  "status": "Request Entity Too Large"
}
```

## Size Limits

| Limit                        | Value |
| ---------------------------- | ----- |
| Events per `/import` request | 2,000 |
| Request body, uncompressed   | 10MB  |
| Single event, uncompressed   | 1MB   |

<Note>
  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.
</Note>

## 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](/reference/import-events) for guidance on long strings.

## Related

* [400 Bad Request](/troubleshooting/errors/400-bad-request)
* [429 Too Many Requests](/troubleshooting/errors/429-rate-limit-exceeded)
* [Import Events API reference](/reference/import-events)
