API
Make a key under Settings → API keys (Pro and higher) with the permissions it needs. Send it as a bearer token.
Authorization: Bearer ank_…A key belongs to the workspace and works on every site in it. An app you connect through OAuth instead (scope stats:read and the address https://analytics.deltabreen.eu/api/v1 as its resource) works as you: it sees the sites you see, with your role as it is at each call, and it stops working if you leave the workspace or sign out everywhere. A token made for the assistant door (/mcp) doesn't open this API, and the other way round.
Stats (stats:read) — the same reports as the portal:
GET /api/v1/sites
GET /api/v1/stats/overview?site=<id>&from=2026-11-01&to=2026-11-30&compare=1
GET /api/v1/stats/timeseries?site=<id>&metric=visitors&interval=day
GET /api/v1/stats/breakdown?site=<id>&dim=utm_campaign&sort=visitors&limit=50
GET /api/v1/stats/{realtime,goals,errors,vitals,retention}?site=<id>Filters: filters=[{"dim":"country","op":"is","values":["IE","GB"]}] (URL-encoded; value takes one). Operators: is, is_not, contains, not_contains, matches, not_matches (a regular expression, under 200 characters). compare=1 adds the period before, compare=year the same dates a year earlier. Dates are the site's own days, both ends counted, and never reach further back than your plan keeps. Every answer carries sampled: true when, past twice your plan's allowance, the numbers were scaled up from a sample of whole visitors.
Events from your server (events:write) — orders, renewals, anything that happens away from the page:
POST /api/v1/events
{ "site_id": "<id>", "events": [ { "name": "Subscription renewed", "user_id": "42", "revenue": 49, "currency": "EUR",
"props": { "plan": "pro" }, "event_id": "inv_8812" } ] }
→ { "accepted": 1, "duplicates": 0, "refused": 0 }event_id makes a resend harmless for 24 hours. Up to 100 events per call; they count toward your plan like custom events. Sending events takes a key with events:write, or an app connected by an owner or admin. A timestamp more than an hour old or more than five minutes ahead is refused (refused counts it); send events as they happen.
Values from your server (events:write) — a number your server measures, for charts: the count of your users, a queue's length, a day's sign-ups from your database:
POST /api/v1/metrics
{ "site_id": "<id>", "metrics": [ { "name": "total_users", "value": 5231, "labels": { "plan": "pro" },
"timestamp": "2026-11-07T09:00:00Z", "id": "users-2026-11-07T09" } ] }
→ { "accepted": 1, "duplicates": 0, "refused": 0, "errors": [] }Or one value on its own: { "site_id": "<id>", "name": "queue_length", "value": 12 }. A name is up to 64 letters, digits, _ . : -; a value is a JSON number; up to 10 labels of text, numbers or true/false; a time from the last year, or now when left out. id makes a resend harmless for a day (the same name, time, value and labels without one are one value too). Up to 100 values a call and 50,000 a site a day; they don't count toward your plan's events. errors lists each value refused, by its place in the list, with a code and a sentence. A chart reads them as the latest value, a sum, an average, the median, the smallest, the largest or a count, split or filtered by a label.
What you know about your signed-in people (events:write) — their plan, their company's size, anything that says what kind of customer they are, so every report can be filtered by it and a chart split by it:
POST /api/v1/people
{ "site_id": "<id>", "people": [ { "id": "42", "traits": { "plan": "pro", "seats": 12, "trial": null } } ] }
→ { "accepted": 1, "refused": 0, "errors": [] }Or one person on their own: { "site_id": "<id>", "id": "42", "traits": { "plan": "pro" } }. id is your own id for the person, the one you pass to identify. Up to 30 traits of text, numbers or true/false; null forgets one; a trait you leave out stays as it was. A trait is never an email address, and names like email, phone or name are left out: keep traits to what kind of customer someone is, not who they are. Each trait is kept at its latest value, for as long as your plan keeps history, and goes when the person is erased. Up to 100 people a call; traits don't count toward your plan's events. The same traits can ride in the signed identify token instead (signed-in people), which works on every plan.
Charts (stats:read to read, config:write to save) — anything a site sends, counted over any period:
GET /api/v1/insights/catalog?site=<id> what the site sent in 90 days: events with their properties
(and which held numbers), values with their labels, currencies,
its people's traits, goals
POST /api/v1/insights/check { site_id, query } every name in a chart the site never sent, with the closest that were
GET /api/v1/insights/run?site=<id>&q=<query> a chart answered without saving it
GET /api/v1/insights?site=<id> saved charts
POST /api/v1/insights { site_id, name, query, allow_unseen? } PUT and DELETE /api/v1/insights/<id>
GET /api/v1/insights/<id>/result a saved chart's answer nowA query is JSON:
{ "source": "event", "target": "Order", "measure": "sum", "property": "total",
"period": { "kind": "last", "amount": 24, "unit": "hour" }, "interval": "hour",
"breakdown": { "dim": "prop_value", "key": "plan" }, "compare": "previous", "filters": [] }source is event, pageview, visit, goal (target: its id), revenue (target: a currency) or metric (target: a value's name). measure is count, people or visits; sum, avg, median, min or max of an event's property (or of a revenue or a value); or latest for a value. A pageview has numbers of its own: time_on_page (seconds the page was in view, every return to the tab added) and scroll_depth (how far down it was read, percent), each by avg, median, min or max (and sum for time). So does a visit: duration (seconds) and pages, and bounced with avg for the bounce rate. { "source": "pageview", "measure": "median", "property": "time_on_page", "breakdown": { "dim": "pathname" } } is the median time on each page.
per_person and per_person_median count what each person did in each bar of the chart, then average it (or take the middle person): pageviews per person a day, orders per person, or with a property their number added up, like { "source": "pageview", "measure": "per_person", "property": "time_on_page", "interval": "day" } for each day's time on the site per person. A signed-in person is one person on every device; anyone else is one per device once they consent, and a new person each day before that.
A chart is filtered by any dimension a report is ({ "dim": "channel", "op": "is", "values": ["Organic Search"] }) and split by what its rows carry; a chart of visits by where they came in and from (entry_page, channel, referrer, utm_*, place and device). Either is by a person's trait too: { "dim": "trait", "key": "plan" } splits by each signed-in person's latest plan (visits nobody was signed in on are "not set"), and a trait filter picks the visits of the people who have it. period is rolling ({ "kind": "last", "amount": 7, "unit": "day" }), calendar ({ "kind": "preset", "preset": "this_month" }: today, yesterday, this_week, last_week, this_month, last_month, this_year, last_7_days, last_30_days, last_90_days, last_12_months) or fixed ({ "kind": "range", "from": "2026-10-01", "to": "2026-10-31" }). interval is total for one number, or hour, day, week or month for a series. The answer has total, previous and change (with compare), series, the ten biggest groups of a split, and sampled. Saving a chart over a name the site never sent is refused with the closest names that were, unless allow_unseen is true (it will be sent soon).
Webhooks (Settings → Webhooks, Pro and higher) post JSON to your https address when a goal converts, an alert fires, an experiment finishes or an erasure is done. Each delivery is signed:
X-Analytics-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>Check it in constant time and refuse a t more than five minutes old. Failed deliveries are retried with backoff for a day.
Limits. 3,000 calls an hour per workspace. Errors are { "error": code, "message": sentence }; a plan limit is 402.