How the Reporting API works
How the browser queues, batches, and delivers reports out of band to the endpoint you declare.
Last update:
The Reporting API separates the thing that produces a report (a policy like CSP or COOP) from the thing that delivers it (the browser's report queue). A policy flags an event, the browser collects it, batches it with others, and sends it to your endpoint later, independent of the page. That decoupling is why a report can still arrive after the page has navigated away or crashed.
How the Reporting API delivers reports
The producers are the policies and platform features: Content Security Policy, Cross-Origin-Opener-Policy (COOP), Cross-Origin-Embedder-Policy (COEP), Permissions-Policy, Document-Policy, Integrity-Policy, Network Error Logging, and the implicit features that emit deprecation, intervention, and crash reports. Each of these decides when something is worth reporting.
The Reporting API is the shared machinery underneath them. It defines no policy behavior of its own; it only structures each report into a common envelope, queues it, and delivers it. That is the key idea: the same transport carries a CSP violation, a COOP report, and a deprecation warning, so you configure delivery once and those producers all use it.
Declaring where reports go
You declare endpoints with one response header, Reporting-Endpoints, mapping a
name to an HTTPS URL. A policy then references that name to route its reports.
Reporting-Endpoints: default="https://<Endpoint-ID>.report.centralcsp.com"CSP names an endpoint with its report-to directive; COOP and COEP use a
report-to= parameter; Integrity-Policy uses endpoints=(); and the implicit
report types go to the default reporting endpoint. The full syntax is in the
Headers section.
Network Error Logging is the exception. It cannot reference a Reporting-Endpoints
name. The NEL header's report_to field names a group declared in the legacy
Report-To header, and
Chromium delivers network-error reports only to groups declared that way. A site
that collects NEL sends both headers: Reporting-Endpoints for every other
producer, Report-To for NEL.
Queueing, batching, and delivery
When a report is generated, the browser does not send it on its own. It adds the
report to a queue, groups queued reports by endpoint URL, by the origin they
describe and, for Reporting-Endpoints, by the document that generated them, and
delivers each group as a single HTTP POST with
Content-Type: application/reports+json. One delivery can therefore carry several
reports of different types.
When the endpoint is on another origin than the page, Chromium first sends a CORS
preflight (OPTIONS). The endpoint must answer it with a 2xx status,
Access-Control-Allow-Origin set to * or the page origin, and
Access-Control-Allow-Headers set to * or Content-Type. If the preflight fails,
the upload counts as a failed attempt. Reports are always sent without cookies to a
cross-origin endpoint.
Timing is up to the browser, not the spec. Chromium runs a delivery pass about once a minute on every platform, so a report you trigger now may wait up to a minute. When a document goes away, Chromium sends the queued reports of that document right away. That is normal; design your endpoint to accept reports whenever they show up rather than expecting them in real time.
Chromium also caps the queue. It keeps at most 100 queued reports and evicts the oldest beyond that, discards a report that has waited more than 15 minutes, and clears the queue when the browser restarts or the network changes.
Best-effort, not guaranteed
The spec is explicit that delivery is best-effort. Reporting is not a reliable communications channel, and the spec leaves retries to the browser, so do not build logic that depends on every report arriving.
Chromium does retry, within limits. Any status other than 2xx (or a failed CORS
preflight) counts as a failed attempt: the reports stay queued and are retried, up to
five attempts in total, and still expire after 15 minutes. Each failure also puts the
endpoint in an exponential backoff that starts at one minute and doubles, so a
failing endpoint is tried less and less often.
An HTTP 410 Gone response removes the endpoint from the browser cache, but in
current Chromium only for endpoints declared with the legacy
Report-To header.
Reporting-Endpoints endpoints are declared again by every response, so a 410
does not stop them. Return a 2xx status from your receiver, and stop sending the
header itself if you want the browser to stop sending reports.
See also
- The report delivery format
- Report-To vs Reporting-Endpoints
- Headers
- Collect and aggregate every report type with CentralCSP reporting.