Skip to content
APIIncludedBeta

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.

Example data · Workspace › Settings › API keys: the base URL, this hour’s requests, and every key
One request

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.

Request
Your terminal
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

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 like 2026-09-01..2026-09-15. Last 30 days if left out.
against
previous, month, or year: adds the other period’s totals, on every report but Breakdown and Goals & events.
filters
Any of the dashboards’ 14, such as country=SE or device=mobile.
segment, cohort
A saved segment or cohort, by its ID.
timezone
The site’s own, if left out.
Response
200 OK · application/json
{
  "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.

What you get

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.

Endpoints

One endpoint for each report

Each returns what its report shows, over the same periods the dashboards offer.

GET/sites

The workspace’s sites a key can read, with their IDs and time zones.

GET/sites/{site}/overview

The totals, the chart’s series, and the comparison.

GET/sites/{site}/breakdown

Any metric by up to 3 fields, such as country by device.

GET/sites/{site}/events

Custom events, with completions, visitors, and revenue.

GET/sites/{site}/goals

Each goal, with its conversions and rate.

GET/sites/{site}/funnels/{funnel}

A saved funnel: each step, and where visits dropped off.

GET/sites/{site}/journeys

The paths visits take to or from a page or event.

GET/sites/{site}/attribution

Conversions and revenue by channel, source, campaign, or entry page.

GET/sites/{site}/retention

Who came back, by day, week, or month, for recognized visitors.

GET/sites/{site}/performance

The Performance score and the five Web Vitals, by page and device.

GET/sites/{site}/realtime

How many are online, and the pages they’re on, as totals.

How it works

From a key to your first request

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Example data · Share › Copy as API request, on an Overview filtered to Sweden on desktop. The request reads your API key from an environment variable.
Privacy and data

A key reads totals, never replays

The API returns totals from what Lyli records, for the sites a key can read.

DataVerdictHow
ReportstotalsThe numbers, charts, and lists your dashboards show, for the key’s sites, over the same periods, from what Lyli recorded: history imported from Google Analytics counts only in your dashboards.
Single visitsnot through a keyKeys read totals, never lists of single visits. Totals can be small: in a short period or a narrow breakdown, a row can count a single visit.
ReplaysneverNo key, and no option, reads a replay.
IP addressesnever returnedWe never store them in our database, so no request can return one.
The keya hashWe store a hash of each key to check requests against, and when it was last used. Never the key itself.
Questions

Questions about the API

Something else? Write to support@lyli.io.

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.

Send your first request

Create a key in Workspace › Settings › API keys. The API is included in every plan.

30 days free, every feature. No card needed.

Designed to help you meet GDPR and UK GDPRCookieless by defaultNo IP addresses in our databaseDatabase in Frankfurt, Germany (EU)How we handle data