# Stats API

Make a key with the `stats` scope in the org's **Keys** page. Send it as a bearer token.

```sh
curl "https://api.crowne.io/v1/sites/YOUR_SITE_ID/report?period=7d&filter=source:is:Google" \
  -H "Authorization: Bearer $CROWNE_KEY"
```

## Endpoints

| Endpoint                              | Answers                                                                       |
| ------------------------------------- | ----------------------------------------------------------------------------- |
| `GET /v1/sites/:site`                 | The site, its goals, funnels, and panels.                                     |
| `GET /v1/sites/:site/report`          | Totals, the time graph, each panel's top values, and each goal's conversions. |
| `GET /v1/sites/:site/realtime`        | Visitors in the last 5 minutes, with top pages and sources.                   |
| `GET /v1/sites/:site/funnels/:funnel` | The visits at each step of a funnel.                                          |

## Query

| Parameter | Use                                                                                                                        |
| --------- | -------------------------------------------------------------------------------------------------------------------------- |
| `period`  | `today`, `yesterday`, `7d`, `30d` (default), `90d`, `month`, `12mo`, or `custom` with `from` and `to` as `YYYY-MM-DD`.     |
| `filter`  | `dimension:op:value`, repeated. `op` is `is`, `is_not`, or `contains`. For example, `country:is:DE` or `prop:plan:is:pro`. |
| `compare` | `previous` adds the totals of the period before.                                                                           |
| `limit`   | Rows per panel, 1 to 1000. Default: 10.                                                                                    |
