Your reports, from your own code
Totals from what Lyli records, as JSON: the Overview, Breakdown, Funnels, Attribution, and the rest. Read-only keys, 600 requests an hour, on every plan.
30 days free, every feature. No card needed.
Your numbers, as JSON
Every report has its own endpoint, which takes the dashboards’ periods, comparisons, and filters. This is one site’s Overview for the last 30 days.
curl -G https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/overview \
-H "Authorization: Bearer $LYLI_API_KEY" \
-d period=30d \
-d timezone=Europe/Stockholm// Node 18 or later, on your server
const params = new URLSearchParams({ period: "30d", timezone: "Europe/Stockholm" });
const res = await fetch(`https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/overview?${params}`, {
headers: { Authorization: `Bearer ${process.env.LYLI_API_KEY}` },
});
if (!res.ok) throw new Error(`Lyli API: ${res.status}`);
const overview = await res.json();import os
import requests
res = requests.get(
"https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/overview",
params={"period": "30d", "timezone": "Europe/Stockholm"},
headers={"Authorization": f"Bearer {os.environ['LYLI_API_KEY']}"},
timeout=10,
)
res.raise_for_status()
overview = res.json()The examples read your key from an environment variable. We refuse requests from browsers, so your key never has to be in a web page.
- period
today,yesterday,7d,30d,90d,52w, or days like2026-09-01..2026-09-15. Last 30 days if left out.- against
previous,month, oryear: adds the other period’s totals, on every report but Breakdown and Goals & events.- filters
- Any of the dashboards’ 14, such as
country=SEordevice=mobile. - segment, cohort
- A saved segment or cohort, by its ID.
- timezone
- The site’s own, if left out.
{
"site": "s_k3m9x2p7qa",
"period": {
"key": "30d",
"from": "2026-09-09",
"to": "2026-10-08",
"timezone": "Europe/Stockholm",
"interval": "day"
},
"totals": {
"views": 503,
"visits": 259,
"visitors": 258,
"bounce_rate": 52.9,
"visit_duration": 365,
"revenue": null
},
"series": [
{ "date": "2026-09-09", "views": 0, "visits": 0, "visitors": 0 },
{ "date": "2026-09-10", "views": 0, "visits": 0, "visitors": 0 },
// … 27 more days
{ "date": "2026-10-08", "views": 4, "visits": 3, "visitors": 3 }
],
"compared": null
}An example site’s numbers. The daily series is shortened here.
Built to read, and nothing else
Every report
Sites, the Overview, Breakdown, Goals & events, Funnels, Journeys, Attribution, Retention, Performance, and Realtime, with segments and cohorts too.
Keys that only read
Admins create keys for all sites or the ones they pick, with an optional expiration date. We show each key once and store only a hash of it.
600 requests an hour
For the whole workspace, in bursts of up to 50 requests per 10 seconds, on every plan. Every response says how many are left.
Totals only
Keys read totals, never lists of single visits or replays. IP addresses never reach our database, so none can be returned.
One endpoint for each report
Each returns what its report shows, over the same periods the dashboards offer.
The workspace’s sites a key can read, with their IDs and time zones.
The totals, the chart’s series, and the comparison.
Any metric by up to 3 fields, such as country by device.
Custom events, with completions, visitors, and revenue.
Each goal, with its conversions and rate.
A saved funnel: each step, and where visits dropped off.
The paths visits take to or from a page or event.
Conversions and revenue by channel, source, campaign, or entry page.
Who came back, by day, week, or month, for recognized visitors.
The Performance score and the five Web Vitals, by page and device.
How many are online, and the pages they’re on, as totals.
From a key to your first request
- 01
Create a key
In Workspace › Settings › API keys: a name, the sites it can read, and when it expires, if ever. We email every admin about it.
- 02
Copy it once
We show the key once. Store it somewhere safe, such as a password manager or your secrets store. If you lose it, revoke it and create a new one.
- 03
Send it in a header
Authorization: Bearer lyli_…on every request, from a server or a script. We reject keys sent in the URL. - 04
Or start from a report
Every report with an endpoint above has Copy as API request in its Share menu: the same view as a curl request, with its period, comparison, and filters as parameters.
A key reads totals, never replays
The API returns totals from what Lyli records, for the sites a key can read.
Is the API included in my plan?
Yes, on every plan. Requests don’t count toward your allowance.
What happens past 600 requests?
We return 429 Too Many Requests with a Retry-After header until the next hour starts. Every key in the workspace shares the 600, so more keys don’t add requests.
Can a key change anything?
Not yet. Every key is read-only.
Can I send events through the API?
Not yet. To send page views through your own server, use Via your domain.
What if our workspace is paused?
Requests get 402 with workspace_paused, not empty data, until the workspace is active again.
Why is it in beta?
Endpoints may still change while the API is in beta. We list every change in the changelog.
Also on every plan
Bots that identify themselves are left out of every number, and the Overview says how many.
ErrorsThe JavaScript errors your visitors hit, grouped and scrubbed.
MCPConnect an AI assistant such as Claude or ChatGPT to your reports.
All featuresTraffic, reports, replays, performance, links, and pixels, on one plan.



