Skip to main content

GET /api/sites

Returns all distinct domains that have ingested at least one event. The dashboard uses this endpoint on load to populate the site picker dropdown.
This endpoint requires no query parameters. It returns the full list of all known domains and their associated site IDs.

Response

Returns a JSON array of site stat objects, ordered alphabetically by domain.
domain
string
The domain recorded in event payloads (e.g. example.com). This is the primary filter axis for all other analytics endpoints.
site_id
string
The site ID associated with this domain. Computed as COALESCE(NULLIF(site_id, ''), domain) — falls back to the domain value if no site_id was provided in the event payload.
Response shape
[
  { "domain": "example.com",  "site_id": "my-site"       },
  { "domain": "staging.example.com", "site_id": "staging.example.com" }
]

SQL logic

SELECT DISTINCT domain, COALESCE(NULLIF(site_id, ''), domain) AS effective_site_id
FROM events
WHERE domain != ''
ORDER BY domain ASC
The query deduplicates rows by domain. The COALESCE(NULLIF(site_id, ''), domain) expression means:
  • If a site_id was configured in the SDK, it is returned as-is.
  • If site_id is an empty string, the domain value is used as a fallback.
StatusMeaning
200 OKQuery succeeded (empty array if no events have been ingested)
500 Internal Server ErrorDatabase query failed

Examples

curl "https://your-iris-host/api/sites"
The dashboard calls this endpoint on load and selects the first domain automatically. If no sites appear, ensure the Iris SDK has been initialised and that at least one event has been recorded.

Build docs developers (and LLMs) love