API reference

The Pageviews API is a read-only analytics API for accessing your website traffic data programmatically. All endpoints require authentication with a valid API token.

Base URL

https://pageviews.ai/api/v1

Authentication

All requests must include your API token in the Authorization header:

Authorization: Bearer your-api-token-here

API access is available on plans with the API Access feature enabled. Requests without a valid token receive a 401 Unauthenticated response. Requests from plans without API access receive a 403 Forbidden response.

Rate limiting

API requests are rate-limited to 600 requests per minute per token. If you exceed this limit, you'll receive a 429 Too Many Requests response. Wait and retry after the rate limit window resets.

Common query parameters

All analytics endpoints share the following query parameters:

ParameterRequiredDescription
fromYesStart date, inclusive (format: YYYY-MM-DD)
toYesEnd date, inclusive (must be on or after from)
periodNoTime grouping: day, week, or month. Default: day. Only used by the stats endpoint.
compare_fromNoComparison period start date
compare_toNoComparison period end date (required when compare_from is set)
timezoneNoIANA timezone for date calculations (e.g., Europe/Berlin). Defaults to the site's configured timezone.
filtersNoJSON-encoded array of filter objects (see Filtering below)

Filtering

The filters parameter accepts a JSON-encoded array of filter objects:

[{"field": "country", "op": "=", "values": ["US", "GB"]}]

Available filter fields

country, city, browser, os, device_type, utm_campaign

Custom properties can be filtered using the prop: prefix (e.g., prop:plan_name).

Filter operators

OperatorMeaning
=Equals
!=Not equals
containsContains (LIKE)
not_containsNot contains (NOT LIKE)
<Less than
<=Less than or equal
>Greater than
>=Greater than or equal

Response format

All responses are in JSON format. Successful responses return a 200 status code with data wrapped in a data object. Error responses include a descriptive message.

Error responses

StatusDescription
401Missing or invalid API token
403Plan does not include API access, or no access to the site
422Invalid query parameters (includes validation error details)
429Rate limit exceeded