GET /api/vitals
Returns average Core Web Vitals scores across all$web_vital events for the given domain and optional date range. Each row represents one metric with its average value over the requested window.
Web vitals are automatically captured by the Iris SDK’s
vitals.ts module via the web-vitals library. Each browser reports LCP, INP, and CLS once per page load as $web_vital events with the metric name and value stored in the p (properties) field.How vitals are stored
Each$web_vital event carries a p (properties) object with the following keys:
| Property key | Description |
|---|---|
$name | Metric name: LCP, INP, or CLS |
$val | Numeric metric value (milliseconds for LCP/INP, unitless score for CLS) |
$rating | Browser-assigned rating: good, needs-improvement, or poor |
$id | Browser-generated unique ID for the measurement |
/api/vitals endpoint uses json_extract(properties, '$.$name') and AVG(CAST(json_extract(properties, '$.$val') AS REAL)) to compute averages per metric.
Query parameters
The domain to query (e.g.
example.com). Must match the d field sent in event payloads exactly.Start of the date range, inclusive. ISO 8601 date string (
YYYY-MM-DD). If omitted, results cover all time up to to.End of the date range, inclusive. ISO 8601 date string (
YYYY-MM-DD). If omitted, results cover all time from from.Response
Returns a JSON array — one entry per vital metric that has data. If no$web_vital events exist for the domain, an empty array is returned.
Metric name:
LCP, INP, or CLS.Average value of the metric across all events in the window. LCP and INP are in milliseconds; CLS is a unitless decimal.
Response shape
| Status | Meaning |
|---|---|
200 OK | Query succeeded (empty array if no vitals data) |
400 Bad Request | domain query parameter is missing |
500 Internal Server Error | Database query failed |