PageSpeed InsightsJSONExportAPIDeveloper Guide

How to Export PageSpeed Insights Results as JSON

Three methods to export Google PageSpeed Insights results as JSON — the PSI API, the CLI, and PageSpeed Exporter — with full instructions for each and a guide to the output format.

PageSpeed Exporter··8 min read

Google PageSpeed Insights does not have an export button. If you run an audit at pagespeed.web.dev you can see your scores, read the recommendations, and share a URL — but you cannot download a structured file with the raw data.

This is a problem when you want to track performance over time, feed results into a CI/CD pipeline, or use an AI agent to analyze your site and produce code-level fixes. For all of those workflows, you need the full Lighthouse JSON output.

There are three ways to get it.


Method 1: The PageSpeed Insights API (Free, Full JSON)

Google provides a free REST API for PageSpeed Insights. With an API key you can retrieve the complete JSON response for any public URL, including all Lighthouse audits, Core Web Vitals metrics, and CrUX field data.

Step 1: Get a Google API Key

  1. Go to the Google Cloud Console
  2. Create a new project (or select an existing one)
  3. Navigate to APIs & Services → Library
  4. Search for "PageSpeed Insights API" and enable it
  5. Go to APIs & Services → Credentials and click Create Credentials → API key
  6. Copy your API key

The PSI API is free with no per-request cost. Google's standard quota is 500 requests per 100 seconds, with a daily limit of 25,000 requests.

Step 2: Make the API Request

The basic endpoint structure is:

https://www.googleapis.com/pagespeedonline/v5/runPagespeed
  ?url=https://example.com
  &key=YOUR_API_KEY
  &strategy=mobile

Parameters:

| Parameter | Values | Description |

|---|---|---|

| url | Any public URL | The page to audit. Must be URL-encoded. |

| strategy | mobile or desktop | The analysis strategy. Defaults to mobile. |

| key | Your API key | Required for reliable access. |

| category | performance, accessibility, best-practices, seo | Which Lighthouse categories to run. Multiple category params allowed. Defaults to performance only. |

| locale | en, fr, etc. | Language for audit descriptions. |

Example with curl:
curl "https://www.googleapis.com/pagespeedonline/v5/runPagespeed\
?url=https://example.com\
&key=YOUR_API_KEY\
&strategy=mobile\
&category=performance\
&category=accessibility" \
-o pagespeed-result.json
Example with JavaScript (Node.js or browser):
const url = encodeURIComponent('https://example.com');
const apiKey = 'YOUR_API_KEY';
const strategy = 'mobile';

const response = await fetch(
  `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}&key=${apiKey}&strategy=${strategy}`
);

const data = await response.json();
console.log(JSON.stringify(data, null, 2));

Step 3: Understand the Output

The response is a JSON object with two main sections:

{
  "kind": "pagespeedonline#result",
  "id": "https://example.com/",
  "loadingExperience": { ... },   // CrUX field data
  "originLoadingExperience": { ... },  // Origin-level CrUX
  "lighthouseResult": { ... },    // Full Lighthouse audit
  "analysisUTCTimestamp": "..."
}

The lighthouseResult object contains everything Lighthouse produces: scores, audits, metric timings, category scores, and stack packs. The full response for a typical page is 500KB to 2MB because it includes base64-encoded screenshots, resource maps, and render-blocking analysis data.

Limitations of the Raw API Response

The raw PSI API response is complete but unwieldy for AI workflows:

  1. Size: 500KB–2MB is too large to paste into a chat window and may exceed context windows
  2. Binary data: Base64-encoded screenshots and DOM snapshots are expensive tokens that add no analytical value
  3. No prompt templates: You still need to write your own prompt asking the AI what to do with the data

Method 2: The Lighthouse CLI (Local Runs, Offline Support)

If you want to audit a URL without hitting a remote API, or you need to test behind authentication, you can run Lighthouse locally using the CLI tool.

Install Lighthouse

npm install -g lighthouse

Requires Node.js 18+.

Run a JSON Export

lighthouse https://example.com \
  --output=json \
  --output-path=./report.json \
  --only-categories=performance \
  --chrome-flags="--headless"

Options:

| Flag | Description |

|---|---|

| --output=json | Output format. Also accepts html and csv. |

| --output-path=./report.json | Where to save the output. |

| --only-categories=performance | Comma-separated list of categories to run. |

| --chrome-flags="--headless" | Run Chrome headlessly. |

| --emulated-form-factor=mobile | mobile or desktop. Defaults to mobile. |

| --throttling-method=simulate | simulate (default), devtools, or provided. |

The CLI output is identical to the Lighthouse JSON format used by PSI — the same lighthouseResult schema.

Running Against Authenticated Pages

To test a page that requires a login:

# Start Chrome with remote debugging
google-chrome --remote-debugging-port=9222 &

# Log in manually in the browser, then run Lighthouse against the port
lighthouse https://app.example.com/dashboard \
  --output=json \
  --port=9222

CI/CD Integration

In a GitHub Actions workflow:

- name: Run Lighthouse audit
  run: |
    npm install -g lighthouse
    lighthouse ${{ env.SITE_URL }} \
      --output=json \
      --output-path=./lighthouse-report.json \
      --chrome-flags="--headless --no-sandbox" \
      --only-categories=performance

- name: Upload Lighthouse report
  uses: actions/upload-artifact@v4
  with:
    name: lighthouse-report
    path: lighthouse-report.json

Method 3: PageSpeed Exporter (No API Key, AI-Ready Output)

PageSpeed Exporter provides a web UI that runs the PSI API behind the scenes and gives you a download button — no API key setup, no CLI installation, no credential management.

The exported file is not the raw 2MB PSI response. It is an AIReport — a stripped-down version that:

  • Removes all screenshots, bitmaps, and binary data
  • Preserves every actionable audit (description, score, savings in ms, savings in bytes)
  • Includes CrUX field data (URL-level and origin-level)
  • Includes StackPack hints (WordPress, React, Angular, etc.)
  • Keeps estimated savings sorted by impact
  • Is under 50KB — small enough to paste into any AI chat window

How to Export

  1. Go to speedexporter.com
  2. Enter your URL and click Analyze
  3. Wait 15–30 seconds for the audit to complete
  4. Click Download JSON on the results page

Free accounts get 5 exports per month. No credit card required.

The AIReport Structure

{
  "meta": {
    "url": "https://example.com",
    "fetchTime": "2026-04-18T10:22:00Z",
    "strategy": "mobile",
    "lighthouseVersion": "12.0.0"
  },
  "scores": {
    "performance": 72,
    "accessibility": 94,
    "bestPractices": 88,
    "seo": 91
  },
  "metrics": {
    "fcp": { "value": 2100, "score": 0.72, "displayValue": "2.1 s" },
    "lcp": { "value": 3800, "score": 0.41, "displayValue": "3.8 s" },
    "tbt": { "value": 420, "score": 0.45, "displayValue": "420 ms" },
    "cls": { "value": 0.08, "score": 0.97, "displayValue": "0.08" },
    "speedIndex": { "value": 3100, "score": 0.60, "displayValue": "3.1 s" }
  },
  "fieldData": {
    "lcp": { "percentile": 4200, "category": "NEEDS_IMPROVEMENT" },
    "fid": { "percentile": 18, "category": "GOOD" },
    "cls": { "percentile": 0.09, "category": "GOOD" },
    "inp": { "percentile": 240, "category": "NEEDS_IMPROVEMENT" }
  },
  "issues": [
    {
      "id": "uses-optimized-images",
      "type": "opportunity",
      "title": "Efficiently encode images",
      "description": "Optimized images load faster and consume less data.",
      "score": 0.42,
      "savings_ms": 1840,
      "savings_bytes": 312000,
      "performanceWeight": 0
    },
    {
      "id": "render-blocking-resources",
      "type": "opportunity",
      "title": "Eliminate render-blocking resources",
      "description": "Resources are blocking the first paint of your page.",
      "score": 0.35,
      "savings_ms": 760,
      "performanceWeight": 0
    }
  ]
}

Choosing the Right Method

| Use Case | Recommended Method |

|---|---|

| Automated CI/CD pipeline | PSI API or Lighthouse CLI |

| Bulk URL auditing | PSI API (batch requests) |

| Testing behind authentication | Lighthouse CLI |

| One-off analysis, no setup | PageSpeed Exporter |

| AI agent optimization workflow | PageSpeed Exporter (AIReport format) |

| Local development audits | Lighthouse CLI |

| Official Core Web Vitals score | PSI API or PageSpeed Exporter |


Using the Exported JSON with AI Agents

Once you have your JSON file (via any method), you can paste it into an AI agent chat with a prompt like:

I'm attaching my Lighthouse JSON performance report for [your-site.com].

Please:
1. Identify the top 5 issues by estimated time savings (ms)
2. For each issue, provide the exact code fix needed
3. Note which framework-specific hints apply (StackPacks)
4. Tell me which single fix will have the greatest impact on my performance score

I'm using [Next.js / WordPress / plain HTML].

For the best results on this workflow, use the AIReport format from PageSpeed Exporter. The stripped-down file fits easily in any AI context window, and every actionable field is already surfaced — no need to navigate 2MB of nested JSON to find what matters.


Automating Exports for Multiple URLs

If you need to run audits on tens or hundreds of URLs, the PSI API is the right tool. Here is a simple Node.js script that batches requests with rate limiting:

import { writeFileSync } from 'fs';

const API_KEY = process.env.GOOGLE_PSI_API_KEY;
const URLS = [
  'https://example.com',
  'https://example.com/products',
  'https://example.com/blog',
];

async function auditUrl(url) {
  const encoded = encodeURIComponent(url);
  const resp = await fetch(
    `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${encoded}&key=${API_KEY}&strategy=mobile`
  );
  return resp.json();
}

// Rate-limit: PSI has 500 requests / 100s quota
function delay(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

for (const url of URLS) {
  const result = await auditUrl(url);
  const filename = url.replace(/[^a-z0-9]/gi, '_') + '.json';
  writeFileSync(filename, JSON.stringify(result, null, 2));
  console.log(`Saved: ${filename}`);
  await delay(1000); // 1 request/second to stay well within quota
}

For agencies running audits across many client sites, PageSpeed Exporter's Pro plan includes batch ZIP export — run multiple URLs from the web UI and download all reports in a single ZIP archive.


Try it yourself

Run a free Lighthouse audit on any URL and get the full JSON report for your AI agent — no account required.

Analyze a URL for free