# export_site_analytics

Source: https://modulify.ai/docs/api/analytics/export-site-analytics

Exports the all-time visitor analytics of a site in one call, as top pages, sources, countries, browsers, operating systems and devices.

- Title: Export the visitor analytics
- Scope: `analytics:read`
- Access: Read only
- Endpoint: `POST /v1/export_site_analytics`

Each breakdown is a list of names with their `visitors` and `pageviews` counts, up to 1,000 entries each, under `pages`, `sources`, `countries`, `browsers`, `operatingSystems` and `devices`. This is the whole picture at once, where `query_site_analytics` answers one question at a time, and it is the same data as **Export .csv** in the Analytics tab.

It needs the workspace to be on a paid plan, and a free one is refused with `A paid plan is required to export!` A site with no traffic recorded comes back successful with every list empty rather than as an error, but if the analytics backend cannot answer, the call fails with an error rather than returning empty lists.

Each call costs 6 of the 1,200 analytics lookups access tokens share per site per hour, one per breakdown, as [Rate limits and result size](https://modulify.ai/docs/mcp/tokens-and-scopes#rate-limits-and-result-size) explains. A breakdown already cached costs nothing, and neither does a site that was never published. Over that limit it fails with `Access tokens, through MCP clients or the API, used their 1,200 analytics lookups for this site this hour. Wait and try again!` See [Export](https://modulify.ai/docs/grow/analytics#export).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/export_site_analytics`, sending the inputs below as a JSON object. The token needs the `analytics:read` scope.

It only reads and changes nothing, so retrying it is safe.

```bash
curl -X POST https://api.modulify.ai/v1/export_site_analytics \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'
```

Over MCP, the same method is the [export_site_analytics tool](https://modulify.ai/docs/mcp/analytics/export-site-analytics).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.