> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/mixpanel/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Export

> Export raw event data

# Raw Event Export

Export raw event data as JSON for custom processing and analysis.

## Base URL

```
https://data.mixpanel.com/api/2.0/export
```

## Authentication

Use Project Secret with HTTP Basic Auth.

## Download Data

Export events within a date range.

<ParamField query="project_id" type="integer">
  Required when using service account authentication
</ParamField>

<ParamField query="from_date" type="string" required>
  Start date in `yyyy-mm-dd` format (inclusive)

  Interpreted as UTC timezone for projects created after January 1, 2023
</ParamField>

<ParamField query="to_date" type="string" required>
  End date in `yyyy-mm-dd` format (inclusive)
</ParamField>

<ParamField query="limit" type="integer">
  Maximum number of events to return (max: 100,000)
</ParamField>

<ParamField query="event" type="string">
  Event name(s) to export, encoded as JSON array

  Example: `["Signed Up", "Purchase"]`
</ParamField>

<ParamField query="where" type="string">
  Expression to filter events
</ParamField>

<ParamField query="time_in_ms" type="boolean">
  Export timestamps with millisecond precision

  Default: `false` (second precision)
</ParamField>

<ParamField header="Accept-Encoding" type="string">
  Set to `gzip` to compress the response
</ParamField>

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://data.mixpanel.com/api/2.0/export?from_date=2024-01-01&to_date=2024-01-31" \
    -u YOUR_PROJECT_SECRET: \
    -H "Accept-Encoding: gzip"
  ```

  ```python Python theme={null}
  import requests
  from requests.auth import HTTPBasicAuth

  response = requests.get(
      'https://data.mixpanel.com/api/2.0/export',
      auth=HTTPBasicAuth('YOUR_PROJECT_SECRET', ''),
      params={
          'from_date': '2024-01-01',
          'to_date': '2024-01-31',
          'event': '["Signed Up", "Purchase"]'
      },
      headers={'Accept-Encoding': 'gzip'}
  )

  # Response is newline-delimited JSON
  for line in response.text.split('\n'):
      if line:
          event = json.loads(line)
          print(event)
  ```
</CodeGroup>

### Response

Returns newline-delimited JSON ([JSONL](http://jsonlines.org)):

<CodeGroup>
  ```text 200 Success theme={null}
  {"event":"Signed Up","properties":{"time":1602611311,"$insert_id":"hpuDqcvpltpCjBsebtxwadtEBDnFAdycabFb","mp_processing_time_ms":1602625711874,"distinct_id":"user123","$email":"user@example.com"}}
  {"event":"Purchase","properties":{"time":1602787121,"$insert_id":"jajcebutltmvhbbholfhxtCcycwnBjDtndha","mp_processing_time_ms":1602801521561,"distinct_id":"user123","amount":29.99,"currency":"USD"}}
  ```
</CodeGroup>

## Rate Limits

<Warning>
  The Export API has strict rate limits:

  * **60 queries per hour**
  * **3 queries per second**
  * **100 concurrent queries** maximum

  Exceeding these limits returns a `429 Too Many Requests` error.
</Warning>

## Best Practices

<AccordionGroup>
  <Accordion title="Use compression">
    Always request gzip compression for large exports:

    ```python theme={null}
    headers = {'Accept-Encoding': 'gzip'}
    ```
  </Accordion>

  <Accordion title="Export in reasonable date ranges">
    Split large exports into smaller chunks:

    ```python theme={null}
    from datetime import datetime, timedelta

    start = datetime(2024, 1, 1)
    end = datetime(2024, 12, 31)

    # Export one month at a time
    current = start
    while current < end:
        next_date = min(current + timedelta(days=30), end)
        export_data(current, next_date)
        current = next_date
    ```
  </Accordion>

  <Accordion title="Use Data Pipelines for regular exports">
    For scheduled exports, use Data Pipelines instead of polling the Export API.
  </Accordion>
</AccordionGroup>
