Report real-user monitoring samples
POST/api/rum
ingestRum
Accepts a batch of browser-measured samples from the web app — Web Vitals (LCP, INP, CLS, TTFB, FCP), long animation frames, and the API calls behind a page with their cache outcome — and records each as one Prometheus histogram observation. Nothing is stored and no identity is read; anonymous callers are accepted. A request whose `Origin` is another site is answered `204` and records nothing. `route_id` and `api_route` are validated against closed sets (the app's route ids and this server's API path templates); a value outside them is recorded as `unknown`, never echoed into a label. A sample with a negative, non-finite or implausibly large value is dropped. The body is parsed as JSON whatever its `Content-Type`, so a `navigator.sendBeacon` with a plain-text blob works. At most 100 samples per batch (more is `400`); the body is capped at 16 KiB (`413`). Rate limited per IP.
Authentication optional — this operation also accepts anonymous requests. When authenticating, use a bearer token.
curl
curl -X POST 'https://neosource.dev/api/rum' \
-H 'Content-Type: application/json' \
-d '{"samples":[]}'fetch
fetch("https://neosource.dev/api/rum", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"samples":[]}),
});Request bodyrequired
application/json
Responses
204Batch recorded
413The body exceeded the route's 16 KiB cap.
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 429Rate limited — retry after the interval in the `Retry-After` header
- 500Internal server error
- 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
- 504Gateway timeout — the request exceeded the server's handling budget
Schemas
Referenced above. Listed here rather than expanded inline, so the same definition is not repeated at every level.
RumCacheOutcome
Where an API call's answer came from, as the page saw it.
"prefetch""query""network"
RumMetric
What one RUM sample measures.
"lcp""inp""cls""ttfb""fcp""loaf""api"