Skip to content

Commit a3764d2

Browse files
Update stats-api.md
1 parent 750cda2 commit a3764d2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/stats-api.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,27 @@ Take a look at our [Events API Reference](events-api.md) if you want to record p
1919

2020
## Authentication
2121

22-
You can obtain an API key for your account by going to your user settings page [plausible.io/settings](https://plausible.io/settings).
22+
You can create a new stats API key by going to your Plausible Analytics account, navigating to "**Account Settings**" and clicking on the section called "**API Keys**". The key will be valid for all sites that you own.
2323

24-
After creating a token, you can authenticate your request by sending the token in the Authorization header of your request.
24+
Click "**New API Key**" and be sure you save the result as you will only see the key once. However, you can always delete the key and create a new one if you no longer remember what it is.
25+
26+
After creating an API key, you can authenticate your request by sending the key in the Authorization header of your request.
2527

2628
### Example curl request
2729

28-
In the following request, replace YOUR-TOKEN with a reference to your token and site_id value with your domain.
30+
In the following request, replace `YOUR-KEY` with a reference to your stats API key and `site_id` value with your domain as you've added it to your Plausible account.
2931

3032
```bash
3133
curl \
3234
--request POST \
3335
# highlight-next-line
34-
--header 'Authorization: Bearer YOUR-TOKEN' \
36+
--header 'Authorization: Bearer YOUR-KEY' \
3537
--header 'Content-Type: application/json' \
3638
--url 'https://plausible.io/api/v2/query' \
3739
--data '{ "site_id": "dummy.site", "metrics": ["visitors"], "date_range": "7d" }'
3840
```
3941

40-
API keys have a rate limit of 600 requests per hour by default. If you have special needs for more requests, please contact us to request more capacity.
42+
API keys have a rate limit of 600 requests per hour by default. If you have special needs for more requests, [please contact us](https://plausible.io/contact) to request more capacity.
4143

4244
## Request structure
4345

0 commit comments

Comments
 (0)