# Export analytics as CSV

`GET https://evohub.io/api/v1/pages/{pageID}/analytics/export.csv`

Part of the [Status API](https://docs-dev.evohub.io/status.md) reference · operationId `exportPageAnalytics`.

One report as CSV (RFC 4180, CRLF), up to 5000 rows. A cell that starts with
`=`, `+`, `-` or `@` is prefixed with `'` so spreadsheets do not run it. Range
as for the analytics read.

**Permission (API-key scope):** `status:page:read`.

## Authorization

Any one of:

- `bearerAuth` (status:page:read)
- `apiKeyHeader` (status:page:read)

Where:

- `bearerAuth`: HTTP Bearer — An EvoHub API key (`evohub_…`) as a bearer token.
- `apiKeyHeader`: API key in the header `X-API-Key` — An EvoHub API key (`evohub_…`).

## Path parameters

- `pageID` (string (uuid), required, example `3f6c2a1e-8b4d-4f7a-9c21-5d0e7a9b1c42`): The status page's id (a UUID).

## Query parameters

- `report` (string, one of `overview`, `routes`, `products`, `referrers`, `countries`, `devices`, `feeds`, `ai`, `ai_agents`, default `overview`): `overview` is one row per day; the others are one row per value.
- `from` (string (date)): First UTC day.
- `to` (string (date)): Last UTC day, inclusive.

## Responses

### 200 — The CSV, as an attachment named `<slug>-<report>-<from>-<to>.csv`.

Content type: `text/csv`

Type: `string`

### 400 — Unknown `report`, or a bad range (`VALIDATION_ERROR`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 401 — No API key was sent, or it is unknown, revoked or expired (`UNAUTHORIZED`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 403 — The key lacks the scope this endpoint needs (`FORBIDDEN`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 404 — No such item, or one the caller cannot see (`NOT_FOUND`).

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 429 — Too many requests (`RATE_LIMITED`). Wait `Retry-After` seconds.

Headers:

- `Retry-After` (integer): Seconds to wait.

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

### 500 — Something went wrong on EvoHub's side (`INTERNAL_ERROR`). Retry later.

Content type: `application/json`

Type: `Error`

- `error` (object, required)
  - `code` (string, required): Machine-readable code. Branch on this.
  - `message` (string, required): Human-readable explanation.
  - `request_id` (string): This request's id, also in `X-Request-ID`.

## Example request

```bash
curl -X GET 'https://evohub.io/api/v1/pages/3f6c2a1e-8b4d-4f7a-9c21-5d0e7a9b1c42/analytics/export.csv' \
  -H 'Authorization: Bearer <TOKEN>'
```
