Skip to content

Sites

Beta

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

GET/api/v1/sites

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

Your terminal
curl https://app.lyli.io/api/v1/sites \
  -H "Authorization: Bearer $LYLI_API_KEY"

Response

200 OK · application/json
{
  "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.

FieldWhat it holds
sitesEvery site your key can read, oldest first. An empty list when there are none.
sites[].idThe site’s ID, which every report’s path takes, as in /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.
sites[].domainThe site’s domain, as Site settings shows it.
sites[].nameThe site’s name in Site settings: its domain unless you renamed it.
sites[].timezoneThe site’s reporting time zone. Reports read days and hours in it unless you pass timezone. Time zones

Which 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

StatusCodeWhen
400invalid_parameterAny parameter: this endpoint takes none.
402workspace_pausedThe workspace is paused.

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