Realtime
BetaWho’s on a site right now, as counts: how many are online, the last 30 minutes’ page views per minute, the pages being read, and where the last half hour’s visits came in. For a status board or an alert in your own code.
Parameters
Only the site. Realtime always reads the last 30 minutes, so it takes no period, time zone, filters, segment, or cohort.
app.lyli.io/sites/<id>. /sites lists the ones your key can read.Request
An example site, now.
curl https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/realtime \
-H "Authorization: Bearer $LYLI_API_KEY"// Node 18 or later, on your server
const res = await fetch("https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/realtime", {
headers: { Authorization: `Bearer ${process.env.LYLI_API_KEY}` },
});
if (!res.ok) throw new Error(`Lyli API: ${res.status}`);
const { online, pages } = await res.json();import os
import requests
res = requests.get(
"https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/realtime",
headers={"Authorization": f"Bearer {os.environ['LYLI_API_KEY']}"},
timeout=10,
)
res.raise_for_status()
online = res.json()["online"]Response
{
"site": "s_k3m9x2p7qa",
"at": "2026-11-23T08:55:02.121Z",
"online": 4,
"views_per_minute": [
0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 3, 2, 1, 0
],
"pages": [
{ "page": "/docs", "visitors": 2 },
{ "page": "/pricing", "visitors": 2 }
],
"arrivals": {
"visits": 9,
"sources": [
{ "source": "google.com", "visits": 6 },
{ "source": "direct", "visits": 3 }
],
"entry_pages": [
{ "page": "/", "visits": 5 },
{ "page": "/docs", "visits": 3 },
{ "page": "/blog/cookieless-analytics", "visits": 1 }
]
}
}An example site’s numbers, with nine visits in the half hour before.
at.direct for none), most visits first.What it never returns
Counts only, whatever the site’s Individual visits setting: never a visit, a visitor’s ID, a city, or a country. The Realtime page in the app can show places on its globe; the API doesn’t. Requests our bot filter leaves out aren’t stored, so they aren’t counted here either.
Asking often
Every answer is counted fresh, never cached, and every request counts toward the workspace’s 600 an hour, shared by all its keys. Asking once a minute uses 60 of them; asking every 6 seconds would use all 600. Rate limits
Errors
Sending timezone, for example:
{
"error": {
"code": "invalid_parameter",
"message": "Unknown parameter: timezone."
}
}Every endpoint can also return 401 (missing, revoked, or expired key) and 429 (rate limit reached). All errors
Start from a report
In the app, open Realtime, then the Share menu’s Copy as API request: this request for the site, as curl. It reads your API key from the LYLI_API_KEY environment variable, so a copied request never contains a key.