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

# Export Errors

> Export error data in CSV or JSON format

## Query Parameters

<ParamField query="format" type="string" default="csv">
  Export format: `json` or `csv`
</ParamField>

<ParamField query="environment" type="string">
  Filter by environment
</ParamField>

<ParamField query="priority" type="string">
  Filter by priority
</ParamField>

<ParamField query="category" type="string">
  Filter by category
</ParamField>

<ParamField query="start_date" type="string">
  Start date (ISO 8601)
</ParamField>

<ParamField query="end_date" type="string">
  End date (ISO 8601)
</ParamField>

<ParamField query="limit" type="integer" default="1000">
  Maximum number of errors to export (max 10,000)
</ParamField>

## Response

Returns the exported data in the requested format. CSV exports include a `Content-Disposition` header for file download.

<RequestExample>
  ```bash cURL theme={null}
  curl "https://kodostatus.com/api/v1/errors/export?format=csv&start_date=2024-01-01T00:00:00Z&end_date=2024-01-31T23:59:59Z" \
    -H "X-API-Key: your_api_key"
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({
    format: 'json',
    start_date: '2024-01-01T00:00:00Z',
    end_date: '2024-01-31T23:59:59Z'
  });

  const response = await fetch(
    `https://kodostatus.com/api/v1/errors/export?${params}`,
    { headers: { 'X-API-Key': 'your_api_key' } }
  );

  // For CSV format
  const csv = await response.text();

  // For JSON format
  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "export": {
      "format": "json",
      "from": "2024-01-01T00:00:00Z",
      "to": "2024-01-31T23:59:59Z",
      "total_errors": 156,
      "total_occurrences": 4823
    },
    "errors": [
      {
        "id": "err_abc123",
        "message": "Cannot read property 'map' of undefined",
        "type": "TypeError",
        "occurrences": 47,
        "sessions_affected": 23,
        "first_seen": "2024-01-15T08:30:00Z",
        "last_seen": "2024-01-15T10:45:00Z"
      }
    ]
  }
  ```
</ResponseExample>

<Note>
  Exports are limited to 10,000 error signatures. For larger datasets, use pagination with the List Errors endpoint.
</Note>
