The Google PageSpeed Insights API (PSI API) is the fastest way to automate performance audits, monitor Core Web Vitals, and run bulk URL tests at scale. This guide explains everything: what PSI is, what the API returns, its use cases, pricing, limits, integrations, and batch testing. Below this article, you will find an interactive PSI API Playground where users can:
- Run PSI API requests
- Add their own API key
- View raw JSON dump data
- Test multiple URLs
- Experiment with automated performance reporting
What is PageSpeed Insights API?
The PageSpeed Insights API is a REST API by Google that returns Lighthouse performance data for any URL. It delivers the same results you see in the PageSpeed Insights UI, but fully automated and accessible programmatically.
The current version is PageSpeed Insights API v5, powered by Lighthouse and Chrome UX Report (CrUX).
What the API returns
- Core Web Vitals (LCP, FID, INP, CLS, FCP, TTFB)
- Lighthouse scores and audits
- Lab + Field data
- Diagnostics and opportunities
- Device-specific reports (Mobile / Desktop)
- CrUX user experience metrics
What PSI (PageSpeed Insights) itself is
PageSpeed Insights is Google’s tool for analyzing site performance and user experience quality. It merges synthetic data (Lighthouse) and real user data (CrUX) to provide optimization recommendations.
PageSpeed Insights API Pricing and Limits
Pricing
The API is 100% free. Google does not offer a paid version.
Daily limits
- Default: 25,000 requests/day per Google Cloud project
- Increase requires quota request approval
Per-minute rate limits
- 240 requests/minute by default
Cost
- pagespeed insights api cost → $0
- google pagespeed insights paid api → does not exist
For heavy batch testing (50k–500k URLs), you can rotate across multiple Cloud projects.
Making Your First PageSpeed API Request
Endpoint
https://www.googleapis.com/pagespeedonline/v5/runPagespeed
Example request
https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://example.com&strategy=mobile&key=YOUR_API_KEY
Parameters
| Param | Description |
|---|---|
url | URL to audit |
strategy | mobile or desktop |
key | Your Google API key |
This is all you need to start using the API.
Understanding the PageSpeed API Response
The API returns a structured JSON with the following key sections:
1. Lighthouse Performance Score
lighthouseResult.categories.performance.score
2. Core Web Vitals (Field Data)
loadingExperience.metrics
originLoadingExperience.metrics
3. Lab Data Metrics
lighthouseResult.audits['largest-contentful-paint']
lighthouseResult.audits['cumulative-layout-shift']
lighthouseResult.audits['speed-index']
4. Opportunities & Diagnostics
lighthouseResult.audits['unused-css-rules']
In the playground section, users can view the raw JSON dump to learn the structure quickly.
Use Cases & Where the API Shines
1. Monitoring Core Web Vitals
Automate daily or weekly performance checks for many websites.
2. SEO Audits
Quickly extract LCP, INP, CLS, TTFB across hundreds/thousands of URLs.
3. Performance Optimization Workflows
Integrate PSI into CI/CD pipelines.
4. Technical SEO Tools
Create your own scoring dashboards, heatmaps, and issue trackers.
5. Client Reporting
Automate Lighthouse snapshots for agencies.
6. Learning & Debugging
Perfect for developers wanting to inspect raw Lighthouse data.
Your PSI Playground below is designed to solve all these categories in one place.
Python Implementation Guide (Optional Addition)
Example outline:
import requests
url = "https://www.googleapis.com/pagespeedonline/v5/runPagespeed"
params = {
"url": "https://example.com",
"strategy": "mobile",
"key": "YOUR_API_KEY"
}
response = requests.get(url, params=params).json()
print(response["lighthouseResult"]["categories"]["performance"]["score"])
JavaScript / Node.js Implementation (Optional Addition)
import fetch from "node-fetch";
const endpoint = "https://www.googleapis.com/pagespeedonline/v5/runPagespeed";
async function run() {
const res = await fetch(`${endpoint}?url=https://example.com&strategy=mobile&key=YOUR_API_KEY`);
const data = await res.json();
console.log(data.lighthouseResult.categories.performance.score);
}
run();
Google Sheets Integration
Use Apps Script:
function runPageSpeed(url) {
var endpoint =
"https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=" +
encodeURIComponent(url) +
"&strategy=mobile&key=YOUR_API_KEY";
var response = UrlFetchApp.fetch(endpoint);
var data = JSON.parse(response.getContentText());
return data.lighthouseResult.categories.performance.score;
}
Then in Sheets:
=runPageSpeed(A2)
Screaming Frog Integration
Steps:
- Configuration → API Access → PageSpeed Insights
- Add your Google API key
- Choose strategy (mobile/desktop)
- Select desired metrics
- Crawl your site
You’ll get:
- Lighthouse scores
- Diagnostics
- Opportunities
- Core Web Vitals
Batch Testing Multiple URLs
For large-scale analysis:
- Loop URLs in Python or Node.js
- Apply delays to respect rate limits
- Use multiple API keys
- Export results to Sheet or database
This powers your multi-URL testing tool below.
Integrated PSI API Playground (Below This Article)
This article is designed to work together with your tool at
suleymanaliyev.com/tools/pagespeed-insight-api.
Your playground will allow users to:
- Enter a URL
- Provide their API key
- Run PSI API requests in real-time
- View raw JSON dump data
- Analyze metrics
- Test multiple URLs in batch
- Learn how the API works by experimenting interactively
This turns the article + tool into a complete multi-purpose PSI learning hub.