# Statistics

> HTML version: https://zapped.to/api-documentation/statistics
> Authentication: an API key holding the scope each endpoint lists, sent as `Authorization: Bearer YOUR_API_KEY`. See https://zapped.to/api-documentation/index.md for the base URL, errors and rate limits.

## api_documentation.read

### api_documentation.endpoint

`GET https://zapped.to/api/statistics/{vcard_id}`

### Authentication

An API key with the `statistics:read` scope (Read card statistics), sent as `Authorization: Bearer YOUR_API_KEY`.

| api_documentation.parameters | Details | Description |
| --- | --- | --- |
| start_date | api_documentation.required | api_documentation.statistics.start_date |
| end_date | api_documentation.required | api_documentation.statistics.end_date |
| type | api_documentation.optional, api_documentation.string | api_documentation.allowed_values |
| country_code | api_documentation.optional, api_documentation.string | api_documentation.available_when |
| utm_source | api_documentation.optional, api_documentation.string | api_documentation.available_when |
| utm_medium | api_documentation.optional, api_documentation.string | api_documentation.available_when |
| referrer_host | api_documentation.optional, api_documentation.string | api_documentation.available_when |

A range longer than 366 days keeps `end_date` and starts 366 days before it. Every `type` other than `overview` and `hour` returns at most 500 rows, most viewed first.

### api_documentation.example

```bash
curl --request GET \
  --url 'https://zapped.to/api/statistics/{vcard_id}?start_date=2020-01-01&end_date=2021-01-01' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

### api_documentation.response

```json
{
    "data": [
        {
            "pageviews": 20,
            "visitors": 5,
            "formatted_date": "2021-01"
        },
        {
            "pageviews": 35,
            "visitors": 10,
            "formatted_date": "2021-02"
        },
        {
            "pageviews": 50,
            "visitors": 25,
            "formatted_date": "2021-03"
        }
    ]
}
```
