# Core Web Vitals (Chrome UX Report) API

> Real-user Core Web Vitals from the Chrome UX Report: LCP, INP, CLS, FCP, TTFB at p75, good / poor shares, pass / fail, by device, weekly history.

- Endpoint: `GET | POST https://apibox.io.vn/v1/web-vitals`
- Category: Web & SEO
- HTML docs: https://apibox.io.vn/docs/web-vitals/ (Vietnamese: https://apibox.io.vn/vi/docs/web-vitals/)
- Online tool: https://apibox.io.vn/tools/web-vitals/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Lab tools like Lighthouse measure one synthetic load; Google's ranking signal and the "Core Web Vitals assessment" in PageSpeed Insights use field data from real Chrome users, published in the Chrome UX Report (CrUX). This endpoint queries the CrUX API for a `url` (one page) or an origin (`scope=origin`, or any URL without a path) and returns, for LCP, INP, CLS, FCP and TTFB, the 75th percentile, a rating (`good`, `needs_improvement`, `poor`) against Google's thresholds and the share of visits in each band, plus the Core Web Vitals verdict (`passed` when LCP, INP and CLS are all good at p75), p75 round-trip time, navigation types, the device mix and the 28-day collection period.

Filter by device with `form_factor=phone|desktop|tablet`, or get all three with `form_factor=each`. `history=1` returns up to 40 weekly data points (`weeks`, default 25) from the CrUX History API, ready to chart with `chart-image`. Send up to 10 URLs at once with `urls`. Results are cached for 6 hours (CrUX updates daily with a lag of about two days).

Pages and origins need enough Chrome traffic to be in CrUX: small sites get `found: false` (try the origin instead of one page). Data: Chrome UX Report by Google, licensed CC BY 4.0.

Bring your own Google API key: pass it as `crux_key` (or the `X-Crux-Key` header). Creating one is free in Google Cloud (enable the Chrome UX Report API); the key is only forwarded to Google for that request and never stored or logged. APIBox does not resell access to Google APIs.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `crux_key` | query | string | yes |  | Your Google API key with the Chrome UX Report API enabled (or header `X-Crux-Key`). Forwarded to Google only, never stored. |
| `url` | query | string | yes |  | Page URL or origin (`example.com` = origin). |
| `scope` | query | string | no | `auto` | `auto` (origin when the URL has no path), `url` or `origin`. |
| `form_factor` | query | string | no | `all` | `all`, `phone`, `desktop`, `tablet` or `each` (three results). |
| `history` | query | boolean | no |  | `1`: weekly p75 series from the CrUX History API. |
| `weeks` | query | number | no | `25` | History length, 1–40 weekly periods. |
| `urls` | body | array | no |  | Batch: up to 10 URLs / origins (array or comma-separated). |

## Example request

```bash
curl "https://apibox.io.vn/v1/web-vitals?url=https://example.vn" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Example response

```json
{
  "origin": "https://example.vn",
  "source": "Chrome UX Report (CrUX), 28-day rolling window of real Chrome users; CrUX data by Google, CC BY 4.0",
  "form_factor": "all",
  "found": true,
  "key": {
    "origin": "https://example.vn"
  },
  "core_web_vitals": "passed",
  "cwv_metrics_used": [
    "lcp",
    "inp",
    "cls"
  ],
  "metrics": {
    "lcp": {
      "p75": 2480,
      "unit": "ms",
      "rating": "good",
      "distribution": {
        "good": 0.7871,
        "needs_improvement": 0.1371,
        "poor": 0.0758
      },
      "thresholds": {
        "good": 2500,
        "poor": 4000
      }
    },
    "inp": {
      "p75": 150,
      "unit": "ms",
      "rating": "good",
      "distribution": {
        "good": 0.8,
        "needs_improvement": 0.15,
        "poor": 0.05
      },
      "thresholds": {
        "good": 200,
        "poor": 500
      }
    },
    "cls": {
      "p75": 0.03,
      "rating": "good",
      "distribution": {
        "good": 0.9,
        "needs_improvement": 0.06,
        "poor": 0.04
      },
      "thresholds": {
        "good": 0.1,
        "poor": 0.25
      }
    },
    "fcp": {
      "p75": 1700,
      "unit": "ms",
      "rating": "good",
      "distribution": {
        "good": 0.7,
        "needs_improvement": 0.2,
        "poor": 0.1
      },
      "thresholds": {
        "good": 1800,
        "poor": 3000
      }
    },
    "ttfb": {
      "p75": 950,
      "unit": "ms",
      "rating": "needs_improvement",
      "distribution": {
        "good": 0.6,
        "needs_improvement": 0.3,
        "poor": 0.1
      },
      "thresholds": {
        "good": 800,
        "poor": 1800
      }
    }
  },
  "round_trip_time_p75_ms": 180,
  "navigation_types": {
    "navigate": 0.8,
    "reload": 0.05,
    "back_forward": 0.1
  },
  "form_factors": {
    "phone": 0.7,
    "desktop": 0.28,
    "tablet": 0.02
  },
  "collection_period": {
    "first": "2026-10-16",
    "last": "2026-11-12"
  }
}
```

## Use cases

- Weekly Core Web Vitals report for client sites in Google Sheets or Looker Studio
- Alert when a release pushes INP or LCP into "poor"
- Compare mobile and desktop experience of competitors
- Track progress of a performance project over 25 weeks

## FAQ

### Why does my page have no data?

CrUX only publishes pages and origins with enough eligible Chrome visits. Query the origin (scope=origin), which aggregates all pages.

### How is "passed" decided?

Like PageSpeed Insights: the p75 of LCP, INP and CLS must all be in the good range (2.5 s, 200 ms, 0.1). When INP has no data, LCP and CLS decide.

### Why do results differ from Lighthouse?

Lighthouse is one lab run on a simulated device; CrUX is 28 days of real visits on real devices and networks.
