Documentation

REST API reference and server-side events

Read your analytics as JSON from any server, script or spreadsheet job. Every route lives under /api/v1 and needs an API token.

Create a token

  1. Open your website in the dashboard and go to Settings → API.
  2. Choose the scopes the token needs. Bind it to one site if it should only ever see that site.
  3. Copy the token. It starts with afx_api_ and is shown once, so store it in a secret manager or environment variable.

Send it on every request:

Authorization: Bearer afx_api_...

Browser session cookies are not accepted here, so a missing or wrong token returns 401. Your public Site ID is not a credential either.

ScopeAllows
sites:readList sites and read one site
analytics:readOverview, breakdowns, visitors and revenue
events:writeSend server-side events (POST /api/v1/events)
payments:writeSend payments and refunds (POST /api/v1/payments)
identify:writeAttach a user to a visitor (POST /api/v1/identify)

A workspace token can read every site in its workspace. A site-bound token lists and reads only that site. Any other site returns 404, so a token never confirms that someone else's site exists.

Endpoints

Method and pathReturns
GET /api/v1/sitesThe sites this token can read
GET /api/v1/sites/:idOne site
GET /api/v1/sites/:id/overviewHeadline totals (visitors, pageviews, revenue) and a time series
GET /api/v1/sites/:id/breakdown?dim=sourceTop values for one dimension
GET /api/v1/sites/:id/visitors?search=adaRecent visitors, optionally filtered
GET /api/v1/sites/:id/visitors/:visitorIdOne visitor's sessions, pages, goals and payments
GET /api/v1/sites/:id/revenue?dim=sourceRevenue, customers and conversion per value

Date ranges and filters

ParameterValues
periodtoday, yesterday, 24h, 48h, 7d, 30d, 90d, 12m, all or custom
from, toYYYY-MM-DD, used with period=custom (to is optional)
filtersA JSON object of session fields, such as {"utm_source":"newsletter"}
limitMaximum rows for breakdowns and visitor lists

Breakdown dimensions: channel, source, campaign, keyword, utm_source, utm_medium, utm_content, ref, country, region, city, browser, os, device, entry_page, exit_page, hostname, referrer, page, exit_link and goal.

Revenue dimensions: channel, source, campaign, keyword, utm_source, utm_medium, utm_content, ref, country, device, entry_page and referrer.

Example

curl https://app.analyticfast.com/api/v1/sites/SITE_ID/revenue?dim=source&period=30d \
  -H "Authorization: Bearer $ANALYTICFAST_TOKEN"

Money is always integer minor units with an ISO 4217 currency, so 4900 with USD is $49.00. Responses send Cache-Control: no-store. The workspace needs an active plan; a lapsed plan returns an error rather than stale data.

Next: ask the same questions in plain English through the MCP server.

Questions, answered.

How do I use read api with AnalyticFast?

Follow the Read API instructions on this page using your own website’s Site ID and configuration. Verify a real event before relying on the reports.

Where can I get setup help?

Contact support@analyticfast.com with the website domain and a redacted description. Do not send API tokens, signing secrets or personal customer data.