Webhooks


You can configure webhooks so your platform can get notified when a test series is completed, if a budget changes status, or if there is a change in the performance opportunities for your website.

All calls are POSTs with a JSON body, and your platform must respond within 10 seconds with a 2xx status code (example "200 OK").

Enable the webhooks

Go to your website's settings page and click Integrations. Then, under "Webhooks", click "Enable".

API keys

We currently support two webhook events: "Test series completed" and "Multistep test completed".

Type in the URL of your webhook(s). If you just want to check how the webhooks works, you can use a webhook from https://webhook.site.

API keys

When you hit Done, PageVitals will fire a test call to the URL that you added and verify that it returns an HTTP status code within the 200-299 range.

Test series completed

When a test series completes or fails, PageVitals can fire an API call to your webhook URL that includes the test result. This is how the call looks like:

POST {your-webhook-url}
{
"seriesId": "12345678",
"created": "2023-06-28T12:34:45Z",
"status": "completed",
"initiative": "manual",
"testCount": 10,
"failedTests": 0,
"results": [
{
"testId": "9i4sfoikw0wbm7id",
"pageId": "12345678",
"url": "https://pagevitals.com/",
"device": "desktop",
"created": "2023-06-28T12:35:15Z",
"status": "completed",
"lighthouse": {
"version": "10.3.0",
"location": "us-west2",
"fcp": 234,
"lcp": 1234,
"tbt": 1850,
"cls": 0.1,
"ttfb": 345,
"speed_index": 2636,
"tti": 12504,
"performance_score": 89,
"accessibility_score": 100,
"best_practices_score": 83,
"seo_score": 92,
"bytes_total": 2745,
"cpu_total": 2371,
"opportunities": 12,
"budgets_exceeded": 3,
"budgets_at_risk": 0,
"validation_errors": 45
},
"crux": {
"lcp": 1234,
"fcp": 234,
"fid": 3,
"cls": 0.1,
"inp": 340,
"ttfb": 780,
"passed": true
}
},
...
]
}

More information about the data sent:

PropertyData typeDescription
seriesIdstringThe internal ID of the test series
createddatetimeThe UTC date (ISO 8601) when the test series was started
statusstringThe status of the test series - completed or failed
initiativestringThe initiator of the test series - first, manual or scheduled
testCountintegerThe number of tests in the test series
failedTestintegerThe number of failed tests, if any, in the series
resultsarrayThe list of test results. See below.

Each item of the results array has these properties:

PropertyData typeDescription
testIdstringThe internal ID of the test
pageIdstringThe internal ID of the page tested
urlstringThe absolute URL of the page tested
devicestringThe device used for the test - desktop or mobile
createddatetimeThe UTC date (ISO 8601) when the test was run
statusstringThe status of the test - completed or failed
errorstringIf the test failed, the error is shown here.
lighthouseobjectThe Lighthouse test results. See below.
cruxobjectThe Chrome UX Report (CrUX) results, if available. See below.

The lighthouse object has these properties:

PropertyData typeDescription
versionstringThe Lighthouse software version used
locationstringThe location of the data center where the test was run
fcpintegerFirst Contentful Paint (ms)
lcpintegerLargest Contentful Paint (ms)
tbtintegerTotal Blocking Time (ms)
clsfloatCumulative Layout Shift (unitless)
ttfbintegerTime To First Byte (ms)
speed_indexintegerSpeed Index (ms)
ttiintegerTime To Interactive (ms)
performance_scoreintegerPerformance Score (ms)
accessibility_scoreintegerAccessibility Score (ms)
best_practices_scoreintegerBest Practices Score (ms)
seo_scoreintegerSEO Score (ms)
bytes_totalintegerTotal transfer size (bytes)
cpu_timeintegerTotal CPU time (ms)
budgets_exceededintegerNumber of budgets exceeded
budgets_at_riskintegerNumber of budgets within 10% of exceeding
opportunitiesintegerNumber of opportunities / recommendations identified by Google Lighthouse
validation_errorsintegerNumber of HTML validation W3C errors found

The crux object is available if the page and device has an entry in the Chrome UX Report that is managed by Google. The object has these properties:

PropertyData typeDescription
lcpintegerLargest Contentful Paint (ms)
fidintegerFirst Input Delay (ms)
clsintegerCumulative Layout Shift (unitless)
fcpintegerFirst Contentful Paint (ms)
ttfbintegerTime To First Byte (ms)
inpintegerInteraction To Next Paint (ms)
passedbooleanTrue if Core Web Vitals passed, otherwise false

Multistep test completed

When a Multistep test completes or fails, PageVitals can fire an API call to your webhook URL that includes the test result. This is how the call looks like:

POST {your-webhook-url}
{
"multistepTest": "jpe1el3j5y",
"runId": "12345678",
"website": "12345678",
"created": "2023-06-28T12:34:45Z",
"device": "mobile",
"status": "completed",
"location": "europe-west-1",
"duration": 134400,
"error": "",
"fail_step": 0,
"bytes_total": 450340,
"cpu_total": 12340,
"inp": 450,
"tbt": 2340,
"cls": 0.13,
"lighthouse_version": "11.4",
"chrome_version": "121"
}

More information about the data sent:

PropertyData typeDescription
runIdstringThe internal ID of the test run
multistepTeststringThe internal ID of the multistep test
createddatetimeThe UTC date (ISO 8601) when the test run was started
devicestringEither desktop or mobile
statusstringThe status of the test series - completed or failed
locationstringThe location of the data center where the test was run
durationintegerThe duration of the test run in ms
errorstringIf the test fails, the error message appears in this field
fail_stepintegerIf the test fails, the failing step number is shown here
cpu_totalintegerTotal ms used by the CPU when loading the page
bytes_totalintegerTotal transfer size (bytes)
inpintegerInteraction To Next Paint (ms)
tbtintegerTotal Blocking Time (ms)
clsfloatCumulative Layout Shift (unitless)
lighthouse_versionstringThe Lighthouse software version used
chrome_versionstringThe Chrome browser version used