pagespeed.web.dev is fine for one page. For a site audit you want every template, every landing page, mobile and desktop, in a table you can sort. Google exposes the same engine as an API; here is how to use it in bulk without babysitting a script.
The API behind pagespeed.web.dev
The PageSpeed Insights API v5 takes a URL and a strategy (mobile or desktop), runs Lighthouse in Google's data centre and returns a large JSON report: category scores, lab metrics (LCP, CLS, TBT, FCP, Speed Index, TTI), CrUX field data when the page has enough real-user traffic, and every audit with its details. It is free with an API key, up to 25,000 requests a day.
The parts that turn into work: each call takes 10 to 30 seconds, so you need concurrency and retries; the report is several hundred kilobytes and the useful numbers are buried five levels deep; quota errors and pages Lighthouse cannot load need handling; and you want mobile and desktop side by side.
The two-minute version
PageSpeed Insights Audit is an open-source Apify Actor that wraps the official API and reduces each report to the numbers people actually use.
- Paste your URLs into Page URLs, one per line.
- Pick the Device strategy: mobile (what Google ranks on), desktop, or both.
- Optionally switch on Include audit details for the top opportunities and failing audits. Click Start.
100 URLs on mobile finish in about ten minutes. Export as CSV or Excel, or push to Google Sheets.
From code
curl -X POST "https://api.apify.com/v2/acts/josh99smith~pagespeed-insights-audit/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "urls": ["https://example.com", "https://www.wikipedia.org"], "strategy": "both", "includeAuditDetails": true }'
What you get back
One record per URL and strategy (trimmed):
{
"url": "https://example.com",
"strategy": "mobile",
"success": true,
"scores": { "performance": 72, "accessibility": 88, "bestPractices": 96, "seo": 100 },
"labMetrics": { "fcpMs": 2144, "lcpMs": 3413, "cls": 0.042, "tbtMs": 420, "speedIndexMs": 3187, "ttiMs": 4902 },
"fieldData": {
"lcpMs": { "percentile": 2371, "category": "FAST" },
"inpMs": { "percentile": 214, "category": "AVERAGE" },
"cls": { "percentile": 0.05, "category": "FAST" },
"overallCategory": "FAST",
"originFallback": false
},
"opportunities": [
{ "id": "render-blocking-resources", "title": "Eliminate render-blocking resources", "savingsMs": 780 },
{ "id": "unused-javascript", "title": "Reduce unused JavaScript", "savingsMs": 450, "savingsBytes": 120832 }
],
"lighthouseVersion": "12.8.2"
}
fieldData.originFallback: true tells you Google had no page-level CrUX data and used origin-level numbers instead, which matters when you compare pages.
Cost and limits
$0.004 per successful audit (100 URLs on both strategies = 200 audits = $0.80). Pages Google cannot load, invalid URLs and quota errors cost nothing; each run stops at the cost cap you set. Two Lighthouse runs of the same page can differ by a few points; that is Lighthouse, not the Actor, and it is why the field data column exists.
Use it from an AI agent
Add https://mcp.apify.com?tools=josh99smith/pagespeed-insights-audit to your MCP client and ask "audit example.com on mobile and list the top opportunities".
Disclosure: I built this Actor. Source: github.com/josh99smith/pagespeed-insights-audit. PageSpeed Insights and Lighthouse are Google trademarks; the Actor is not affiliated with Google.
Top comments (0)