PageSpeed Insights API
developer/v1/domain/pagespeedRuns a Lighthouse audit via the Google PageSpeed Insights API. Returns performance, accessibility, best-practices, and SEO scores, plus top optimization opportunities and diagnostics.
What It Does
Submits the domain to Google PageSpeed Insights API for a full Lighthouse audit. Returns category scores (performance, accessibility, best practices, SEO), detailed optimization opportunities with estimated savings, diagnostic information, and real-world loading experience data from CrUX. Supports both mobile and desktop strategies. Category and audit output follows the upstream Lighthouse version; field data is only included when available for the requested page.
Why It's Useful
PageSpeed Insights is the industry standard for web performance measurement. Integrating it via API enables automated performance monitoring, CI/CD gates, and competitive benchmarking without manual browser testing.
Use Cases
Performance Monitoring
Track PageSpeed scores over time to detect performance regressions after deployments.
Catch performance issues before they impact user experience and SEO.
CI/CD Performance Gate
Block deployments when PageSpeed performance score drops below a threshold.
Prevent performance regressions from reaching production.
Competitive Benchmarking
Compare PageSpeed scores against top competitors to identify performance gaps.
Set data-driven performance targets based on competitive landscape.
Parameters
| Name | Location | Type | Required | Description |
|---|---|---|---|---|
domain | query | string | Required | Domain or full URL — accepts `example.com` or `https://example.com/path`.Example: https://example.com |
strategy | query | string | Optional | Audit strategy: mobile or desktop (default: mobile)Example: mobileOptions: mobile, desktop |
Response Fields
Result fields below are inside the JSON data object. Any row named meta describes the sibling response metadata object. See response and error handling for status codes and error responses. Optional observations may be absent or null; inspect warnings and partial-failure fields before treating a missing result as a negative finding.
| Field | Type | Description |
|---|---|---|
domain | string | The audited domain (bare hostname). |
url | string | Full URL that was fetched, echoing the protocol used in the request. |
strategy | string | The audit strategy used (mobile/desktop) |
fetchTime | string | ISO 8601 timestamp when the Lighthouse audit was performed |
scores | object | Category scores: performance, accessibility, bestPractices, seo, and per-metric performance breakdown |
scores.performanceMetrics | object | Per-metric Lighthouse breakdown (lcp, cls, tbt, fcp, si, tti, ttfb) each with numericValue, displayValue, score, and rating (good/needs-improvement/poor) |
opportunities | array | Optimization opportunities with estimated savings (savings string, savingsMs, savingsBytes) |
diagnostics | array | Diagnostic information and display values |
passedAudits | array | Audits that scored a perfect 1.0 — what is already correct |
categoryAudits | object | Failed audits per non-perf category (accessibility, bestPractices, seo) with weight, displayValue, helpUrl — actionable WCAG-mapped list |
redirects | array | Redirect chain with URLs and wasted time per redirect |
loadingExperience | object | Real-world CrUX loading experience metrics |
fieldLabDelta | object | Per-metric (lcp, cls, fcp, ttfb) gap between CrUX field data and Lighthouse lab; fieldWorseThanLab flag identifies real-user issues invisible to synthetic tests |
Code Examples
Replace YOUR_API_KEY with your API key. This endpoint requires the developer plan or higher; see plans and usage limits.
curl --request GET 'https://api.edgedns.dev/v1/domain/pagespeed?domain=https%3A%2F%2Fexample.com' \
--header "Authorization: Bearer YOUR_API_KEY"const response = await fetch(
"https://api.edgedns.dev/v1/domain/pagespeed?domain=https%3A%2F%2Fexample.com",
{
"method": "GET",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
);
if (!response.ok) {
throw new Error(`EdgeDNS returned HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);import requests
response = requests.request(
'GET',
"https://api.edgedns.dev/v1/domain/pagespeed?domain=https%3A%2F%2Fexample.com",
headers={'Authorization': 'Bearer YOUR_API_KEY'},
timeout=60,
)
response.raise_for_status()
data = response.json()
print(data)Read the full PageSpeed Insights guide
Learn the concepts, choose a practical workflow, and interpret the observations from PageSpeed Insights before acting on them. Run supported checks via MCP or through REST.
Read the guide →Related Endpoints
External References
Learn more about the standards and protocols behind this endpoint.
Try This Endpoint
Test the PageSpeed Insights endpoint live in the playground.