> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpanel.com/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"
}
```

> [!NOTE]
>
> The byte count in this example comes from the API reference's sample response and doesn't match the documented 10MB request limit below. Check the limit stated in the error message you actually received.

## 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.

## 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

Each event must be smaller than 1MB of uncompressed JSON. This is a per-event validation requirement, so an oversized event may be reported in `failed_records` on a [400](https://docs.mixpanel.com/troubleshooting/errors/400-bad-request.md) rather than as a 413. Oversized events usually come 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](https://docs.mixpanel.com/reference/import-events.md) for guidance on long strings.

## Related

* [400 Bad Request](https://docs.mixpanel.com/troubleshooting/errors/400-bad-request.md)
* [429 Too Many Requests](https://docs.mixpanel.com/troubleshooting/errors/429-rate-limit-exceeded.md)
* [Import Events API reference](https://docs.mixpanel.com/reference/import-events.md)
