# Export calls history

`POST https://www.getrevox.com/api/call/export`

Export a list of call attempts as a CSV file. Large exports are split into several files of at most 4MB each: when the response carries a non-null next_offset, call the endpoint again with that value as offset to get the next file.

## Request body (JSON)

- `filters` (object, required)
  - `query` (string, optional)
  - `statuses` (array of enum (string), required): Default: `[]`.
  - `directions` (array of enum (string), required): Default: `[]`.
  - `results` (array of enum (string), required): Default: `[]`.
  - `outcomes` (array of enum (string), required): Default: `[]`.
  - `assistant_ids` (array of string, required): Default: `[]`.
  - `campaign_ids` (array of string, required): Default: `[]`.
  - `from_phone_numbers` (array of string, required): Default: `[]`.
  - `assignee_ids` (array of one of, required): Default: `[]`.
    - One of, **string** (string)
    - One of, **string** (string (constant))
  - `variables` (array of object, optional)
    - `key` (string, required)
    - `value` (string, required)
  - `to_phone_number` (string, optional)
  - `call_ids` (array of string, optional)
  - `page` (integer, required): Constraints: min 1, max 9007199254740991. Default: `1`.
  - `page_size` (integer, required): Constraints: min 1, max 50000. Default: `50000`.
  - `sort_by` (string, optional)
  - `sort_direction` (enum (string), optional): One of: `asc`, `desc`.
- `offset` (integer, required): Number of already-exported rows to skip, within the filters' page/page_size window. Pass the next_offset value from the previous response to fetch the next file of a split export. Constraints: min 0, max 9007199254740991. Default: `0`.
- `include_structured_output_fields` (boolean, optional): Whether to include the structured output fields in the CSV file. These are generated by our AI agent during call analysis phase.
- `include_metadata` (boolean, optional): Whether to include the metadata in the CSV file. These are the fields you (optionally) attached when placing the call.

## Example request

```bash
curl -X POST https://www.getrevox.com/api/call/export \
  -H "Authorization: Bearer $REVOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "statuses": [],
      "directions": [],
      "results": [],
      "outcomes": [],
      "assistant_ids": [],
      "campaign_ids": [],
      "from_phone_numbers": [],
      "assignee_ids": [],
      "page": 1,
      "page_size": 50000
    },
    "offset": 0
  }'
```

## Responses

### 200: Success

- `csv` (string, required)
- `filename` (string, required)
- `next_offset` (integer, required, nullable): Non-null when the export was split because this file reached the 4MB cap: pass it as offset in a follow-up call to get the next file. Null when this file completes the export. Constraints: min -9007199254740991, max 9007199254740991.