Sites
BetaThe sites your key can read, with the ID every report’s path takes. Start here when you need a site’s ID in your code.
Parameters
None. This endpoint lists every site your key can read, so it takes no period, filters, or time zone. Sending any parameter returns a 400, such as “Unknown parameter: period.”
Request
curl https://app.lyli.io/api/v1/sites \
-H "Authorization: Bearer $LYLI_API_KEY"// Node 18 or later, on your server
const res = await fetch("https://app.lyli.io/api/v1/sites", {
headers: { Authorization: `Bearer ${process.env.LYLI_API_KEY}` },
});
const { sites } = await res.json();import os
import requests
res = requests.get(
"https://app.lyli.io/api/v1/sites",
headers={"Authorization": f"Bearer {os.environ['LYLI_API_KEY']}"},
timeout=10,
)
sites = res.json()["sites"]Response
{
"sites": [
{
"id": "s_k3m9x2p7qa",
"domain": "harbor.example",
"name": "harbor.example",
"timezone": "Europe/Stockholm"
},
{
"id": "s_q7w2n8d4ve",
"domain": "quietpages.example",
"name": "quietpages.example",
"timezone": "Europe/Berlin"
}
]
}An example workspace with two sites.
/sites/{site}/overview. It’s also in the site’s address in the app, app.lyli.io/sites/<id>, and next to Site ID in Site settings › General.timezone. Time zonesWhich sites a key reads
An admin chooses a key’s sites when they create it in Workspace › Settings › API keys:
- All sites reads every site in the workspace, including sites added later.
- Pick sites reads only the sites ticked when the key was made.
The list of keys shows which sites each one reads. A key reads only its workspace’s own sites, never another workspace’s and never the sample sites the app shows.
Asking a report about a site your key can’t read returns 403 site_not_allowed when the site is in your workspace but not on the key, and 404 not_found otherwise, so another workspace’s sites look the same as sites that don’t exist.
A site’s ID isn’t a secret. It’s in the script tag on every page of your site. What keeps your reports private is the key, so keep it on your server.
Errors
Every endpoint can also return 401 (missing, revoked, or expired key) and 429 (rate limit reached). All errors