# Export table

Export table is a read in the HeadHoncho API. One raw table as a CSV file for a company and a date range, up to 50,000 rows, with its caveat in the last lines.

Page: https://headhoncho.app/docs/api/export_table | Part of the HeadHoncho API docs: https://headhoncho.app/docs/api | Machine-readable: https://headhoncho.app/docs/api/openapi.json

## The request

Reference for **Export table**, HeadHoncho API v1. It is a read, sent to the base address `https://api.headhoncho.app`.

`GET /api/v1/data/tables/{key}/export`

The key or app needs the **Raw data** area at **read**. It counts as a export call: 10 a minute for each key or connected app. See [rate limits](https://headhoncho.app/docs/api/errors#rate-limits).

Send your key as `Authorization: Bearer hh_live_...`. See [API keys](https://headhoncho.app/docs/api/keys).

## Parameters

| Name | Kind | Required | Description | Example |
| --- | --- | --- | --- | --- |
| `key` | text, in the path | Yes | A table key from List tables. | `callrail.calls` |
| `company_id` | id, in the query | No | Default: the first company the credential reaches. | `cmp_14f5` |
| `from` | date, in the query | No | Default: this month. | `2026-10-01` |
| `to` | date, in the query | No | The last day, inclusive. | `2026-10-14` |

## What comes back

Over the API: the CSV itself (text/csv). Over MCP: a download link that works once for five minutes, so the file never passes through the AI.

It never changes a record. It only reads the companies the key reaches.

## Errors that apply

| Code | Status | What it means |
| --- | --- | --- |
| [`missing_key`](https://headhoncho.app/docs/api/errors#missing_key) | 401 | Send your key as Authorization: Bearer hh_live_... |
| [`unknown_key`](https://headhoncho.app/docs/api/errors#unknown_key) | 401 | That key is not one we issued, or it was revoked. |
| [`expired_token`](https://headhoncho.app/docs/api/errors#expired_token) | 401 | That token has expired. Refresh it, or connect the app again. |
| [`no_access`](https://headhoncho.app/docs/api/errors#no_access) | 403 | This credential does not reach that. Ask the person who made it for access. |
| [`not_found`](https://headhoncho.app/docs/api/errors#not_found) | 404 | No such record in the companies this credential reaches. |
| [`out_of_scope`](https://headhoncho.app/docs/api/errors#out_of_scope) | 404 | No such company in the companies this credential reaches. |
| [`invalid`](https://headhoncho.app/docs/api/errors#invalid) | 422 | Some fields were refused. See fields. |
| [`rate_limited`](https://headhoncho.app/docs/api/errors#rate_limited) | 429 | Too many calls this minute. Wait and try again. |
| [`not_connected`](https://headhoncho.app/docs/api/errors#not_connected) | 409 | This company has not connected that provider yet. |

## Related

- [List tables](https://headhoncho.app/docs/api/list_tables): Every raw table, by the provider that produced it, with its columns, its grain and whether this company has it connected.
- [Read table](https://headhoncho.app/docs/api/read_table): Rows of one raw table for one company and a date range, exactly as the provider reported them. No joins, no derived figures.
- The same records in the app: [the Raw data board](https://headhoncho.app/docs/marketing/raw-data).
- How the API fits together: [the model](https://headhoncho.app/docs/api/model), [API keys](https://headhoncho.app/docs/api/keys), [errors](https://headhoncho.app/docs/api/errors) and [the MCP server](https://headhoncho.app/docs/api/mcp).

## Examples

### Answer

This is the answer over MCP. Over the API the answer is the file itself, as text/csv.

```json
{
  "download": {
    "url": "https://api.headhoncho.app/api/v1/data/tables/callrail.calls/export?company_id=cmp_14f5&from=2026-10-01&to=2026-10-14&once=k7Qm...",
    "expires_in": 300,
    "filename": "callrail-calls-20261014-0915.csv"
  }
}
```

### cURL

```bash
curl "https://api.headhoncho.app/api/v1/data/tables/callrail.calls/export?company_id=cmp_14f5&from=2026-10-01" \
  -H "Authorization: Bearer hh_live_..." -o file.csv
```

### Python

```python
import requests

response = requests.get(
    "https://api.headhoncho.app/api/v1/data/tables/callrail.calls/export",
    headers={"Authorization": "Bearer hh_live_..."},
    params={
        "company_id": "cmp_14f5",
        "from": "2026-10-01",
    },
)
response.raise_for_status()
open("file.csv", "wb").write(response.content)
```

### JavaScript

```javascript
const response = await fetch("https://api.headhoncho.app/api/v1/data/tables/callrail.calls/export?company_id=cmp_14f5&from=2026-10-01", {
  headers: { Authorization: "Bearer hh_live_..." },
});
const data = await response.text();
console.log(data);
```

### Your AI

```text
Tool: export_table
Arguments: key (text, required), company_id (id, optional), from (date, optional), to (date, optional)
Access: read on Raw data
Hints: readOnly=true, destructive=false, idempotent=true, openWorld=false
Try asking: "Using HeadHoncho, export table with key callrail.calls and company_id cmp_14f5."
```
