Breakdown
BetaVisitors, 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.
Parameters
channel, source, page, entry, hostname, country, city, device, browser, os, campaign, medium, term, content. country,device if left out.visitors, visits, views, bounce_rate, or visit_duration. visitors if left out.desc for the highest first, or asc. desc if left out.today, yesterday, 7d, 30d, 90d, 52w, or a range of days or hours. The last 30 days if left out. PeriodsAmerica/New_York. The site’s own if left out.country=SE. They combine. FiltersA 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.
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// Node 18 or later, on your server
const url = "https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/breakdown";
const params = new URLSearchParams({
by: "country,device",
period: "30d",
timezone: "Europe/Stockholm",
});
const res = await fetch(`${url}?${params}`, {
headers: { Authorization: `Bearer ${process.env.LYLI_API_KEY}` },
});
if (!res.ok) throw new Error(`Lyli API: ${res.status}`);
const { total, rows } = await res.json();import os
import requests
res = requests.get(
"https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/breakdown",
params={
"by": "country,device",
"period": "30d",
"timezone": "Europe/Stockholm",
},
headers={"Authorization": f"Bearer {os.environ['LYLI_API_KEY']}"},
timeout=10,
)
res.raise_for_status()
rows = res.json()["rows"]Response
{
"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.
sort in dir order, then by visitors and by name. At most the first 1,000.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.page or hostname in by, the views of that page or hostname only.null with fewer than 50 visits.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
nullbecause 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
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.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.