Stats API
Create a key under Account settings → API keys and send it as Authorization: Bearer …. The query format follows Plausible’s Stats API v1 for the common subset.
GET /api/v1/stats/realtime/visitors?site_id=example.comGET /api/v1/stats/aggregate?site_id=example.com&period=30d&metrics=visitors,pageviews,bounce_rateGET /api/v1/stats/timeseries?site_id=example.com&period=30d&metrics=visitorsGET /api/v1/stats/breakdown?site_id=example.com&period=30d&property=visit:source&limit=10Parameters
Section titled “Parameters”| Parameter | Notes |
|---|---|
site_id |
The site’s domain. Required |
period |
day, 7d, 30d, month, 6mo, 12mo, year or custom. Default 30d |
date |
YYYY-MM-DD for the period’s anchor. For custom: YYYY-MM-DD,YYYY-MM-DD |
metrics |
Comma-separated: visitors, visits, pageviews, views_per_visit, bounce_rate, visit_duration. Default visitors |
filters |
See below |
interval |
Timeseries only. One of the intervals allowed for the period |
compare |
aggregate only. previous_period adds a change percentage |
property |
breakdown only. See below |
limit, page |
breakdown only. limit is 1 to 1000, default 100 |
Days begin and end in the site’s timezone.
Responses
Section titled “Responses”{ "results": { "visitors": { "value": 1423 }, "pageviews": { "value": 3320 } } }timeseries returns results as a list of { "date": …, "visitors": … } rows. breakdown returns a list of rows keyed by the property name, for example { "source": "Google", "visitors": 310 }. realtime/visitors returns a number.
Filters
Section titled “Filters”Join clauses with ;. Separate alternative values with |.
filters=visit:country==DE|FR;event:page==/blog/*| Operator | Meaning |
|---|---|
== |
is (* is a wildcard) |
!= |
is not |
=~ |
contains |
Dimensions: event:page, event:goal, event:props:NAME, visit:entry_page, visit:exit_page, visit:source, visit:referrer, visit:channel, visit:utm_medium, visit:utm_source, visit:utm_campaign, visit:utm_content, visit:utm_term, visit:country, visit:region, visit:city, visit:browser, visit:os, visit:device.
Breakdown properties
Section titled “Breakdown properties”Any dimension above except event:goal and event:props:* works as property.
Errors
Section titled “Errors”| Status | Reason |
|---|---|
| 401 | Missing or invalid key |
| 404 | Unknown site, or you don’t have access to it |
| 422 | Unsupported period or property, or a malformed custom date |