Skip to content

Breakdown

Beta

Visitors, visits, views, bounce rate, and visit duration for every combination of up to three fields, such as country by device, as the Breakdown report counts them.

GET/api/v1/sites/{site}/breakdown

Parameters

NameWhat it does
siteIn the path, requiredThe site’s ID. Sites lists the ones your key can read.
byOptionalUp to 3 fields, comma-separated, each once. A field is any filter’s name: channel, source, page, entry, hostname, country, city, device, browser, os, campaign, medium, term, content. country,device if left out.
sortOptionalvisitors, visits, views, bounce_rate, or visit_duration. visitors if left out.
dirOptionaldesc for the highest first, or asc. desc if left out.
periodOptionaltoday, yesterday, 7d, 30d, 90d, 52w, or a range of days or hours. The last 30 days if left out. Periods
timezoneOptionalA time zone name, such as America/New_York. The site’s own if left out.
channel … contentOptionalAny of the 14 filters, such as country=SE. They combine. Filters
segment, cohortOptionalA saved segment’s or cohort’s ID.

A breakdown doesn’t compare periods, so sending against returns a 400.

Request

An example site by country and device, the last 30 days, read in its own time zone.

Your terminal
curl -G https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/breakdown \
  -H "Authorization: Bearer $LYLI_API_KEY" \
  -d by=country,device \
  -d period=30d \
  -d timezone=Europe/Stockholm

Response

200 OK · application/json
{
  "site": "s_k3m9x2p7qa",
  "period": {
    "key": "30d",
    "from": "2026-10-24",
    "to": "2026-11-22",
    "timezone": "Europe/Stockholm",
    "interval": "day"
  },
  "by": ["country", "device"],
  "sort": "visitors",
  "dir": "desc",
  "total": {
    "visitors": 261,
    "visits": 284,
    "views": 484,
    "bounce_rate": 54.6,
    "visit_duration": 52
  },
  "count": 18,
  "rows": [
    {
      "values": { "country": "SE", "device": "desktop" },
      "visitors": 45,
      "visits": 48,
      "views": 84,
      "bounce_rate": null,
      "visit_duration": 57
    },
    {
      "values": { "country": "DE", "device": "desktop" },
      "visitors": 40,
      "visits": 45,
      "views": 82,
      "bounce_rate": null,
      "visit_duration": 60
    },
    {
      "values": { "country": "SE", "device": "mobile" },
      "visitors": 27,
      "visits": 30,
      "views": 46,
      "bounce_rate": null,
      "visit_duration": 42
    },
    // … 14 more rows
    {
      "values": { "country": "NL", "device": "tablet" },
      "visitors": 2,
      "visits": 3,
      "views": 4,
      "bounce_rate": null,
      "visit_duration": 41
    }
  ]
}

An example site’s numbers. The rows are shortened here; the response has all 18.

FieldWhat it holds
periodThe period read, in the same shape as the Overview’s.
by, sort, dirThe fields the rows are broken down by and how they’re sorted, with the defaults filled in.
totalThe same five numbers for every visit the rows come from, each visit counted once.
countHow many combinations there are in all.
rowsThe combinations, sorted by sort in dir order, then by visitors and by name. At most the first 1,000.
rows[].valuesEach field’s value, written as its filter takes it: a country code, SE; a city with its country, SE:Stockholm; a channel, search; a device, mobile; a path, /pricing. An empty string for visits without that campaign tag, and for page views whose hostname wasn’t recorded.
rows[].visitorsDistinct visitors in the combination.
rows[].visitsVisits in the combination.
rows[].viewsPage views. With page or hostname in by, the views of that page or hostname only.
rows[].bounce_rateThe share of visits with one page view and no custom events, in percent. null with fewer than 50 visits.
rows[].visit_durationThe average visit duration, in seconds.

How it’s counted

Every visit that starts in the period and matches your filters, segment, and cohort counts in the row its values make. A row has the numbers the Overview shows with its values as filters: the row for SE and desktop counts what country=SE&device=desktop counts.

  • Most fields have one value per visit, such as its channel, entry page, country, or device, so each visit counts in one row.
  • Pages and hostnames count per page view. A visit counts once for each page it viewed, each hostname, or with both fields each page on a hostname, so the rows can add up to more visits than total. A row’s bounce rate and duration still describe the whole visit.
  • Sorting by bounce rate uses each row’s rate, even where the response shows null because the row has fewer than 50 visits.
  • A row’s values work as filters. Pass them to the Overview endpoint to get that row’s series. An empty value has no filter: sending one returns a 400.

Limits

A response lists at most 1,000 rows; count says how many there are. Past 50,000 combinations, the request returns a 400: break down by fewer fields or a shorter period.

A narrow row can be a single visit. With several fields or a short period, a row can count one visit, so treat what a key reads as your visitors’ data. What we keep

Errors

StatusCodeWhen
400invalid_parameterA field we don’t know or one named twice, more than 3 fields, a sort or dir we don’t know, against, more than 50,000 combinations, a segment or cohort the site doesn’t have, or a period, filter, or time zone we can’t parse.
402workspace_pausedThe workspace is paused.
403site_not_allowedYour key doesn’t have access to this site.
404not_foundNo site with this ID in the workspace.

Every endpoint can also return 401 (missing, revoked, or expired key) and 429 (rate limit reached). All errors

Start from a report

Open the site’s Reports › Breakdown, choose its fields and sort, and select Copy as API request in the Share menu. You get the breakdown on your screen as a curl request: by, sort, and dir, then its period, filters, segment, cohort, and time zone. It reads your API key from the LYLI_API_KEY environment variable, so a copied request never contains a key.

A saved breakdown’s request carries its fields: the API doesn’t take a saved breakdown’s ID.