# Google PageSpeed Insights API

> Google PageSpeed Insights returns page speed, accessibility, best practices and SEO data as a workflow and API.

Google PageSpeed Insights, also called Google PSI, tests web pages for speed, accessibility, best practices and SEO on mobile or desktop.

- Page: https://fous.com/tools/google-pagespeed-insights
- Handle: `@google-pagespeed-insights`
- Category: [Marketing](https://fous.com/tools/category/marketing)
- Source website: https://pagespeed.web.dev
- Last verified: Sep 30, 2026

## Methods

### Check page speed

Operation `check_page_speed`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Test a web page for speed, accessibility, best practices and SEO on mobile or desktop. Real-user data and savings estimates appear only when available; tests may take up to 60 seconds.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `device` | string | no | `"desktop"` | Device type, such as mobile. |
| `page_url` | string | yes | `"example.com"` | Address of the page to test, such as example.com. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "page_url"
  ],
  "properties": {
    "device": {
      "enum": [
        "mobile",
        "desktop"
      ],
      "type": "string",
      "default": "mobile",
      "description": "Device type, such as mobile.",
      "examples": [
        "desktop"
      ]
    },
    "page_url": {
      "type": "string",
      "description": "Address of the page to test, such as example.com.",
      "examples": [
        "example.com",
        "example.org"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "page_url": "example.com"
    },
    {
      "device": "desktop",
      "page_url": "example.org"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `device` | string | `"mobile"` | Device type tested. |
| `seo_score` | number or null | `80` | SEO score out of 100. |
| `lab_results` | object |  | Results measured by Lighthouse. |
| `lab_results.speed_index_seconds` | number or null | `0.783` | Lab speed index in seconds. |
| `lab_results.total_blocking_time_ms` | number or null | `0` | Lab total blocking time in milliseconds. |
| `lab_results.first_contentful_paint_seconds` | number or null | `0.783` | Lab first contentful paint in seconds. |
| `lab_results.largest_contentful_paint_seconds` | number or null | `0.783` | Lab largest contentful paint in seconds. |
| `report_link` | string | `"https://pagespeed.web.dev/analysis/https-example-com/eu9v402hfw?form_factor=mobile"` | Link to the full PageSpeed Insights report. |
| `tested_link` | string | `"https://example.com/"` | Final page address tested. |
| `suggested_fixes` | array |  | Up to five relevant suggested fixes. |
| `suggested_fixes[].fix` | string | `"Use efficient cache lifetimes"` | Suggested improvement. |
| `suggested_fixes[].estimated_saving` | string or null | `"Est savings of 2 KiB"` | Estimated saving shown by PageSpeed, if any. |
| `performance_score` | number or null | `100` | Performance score out of 100. |
| `real_user_results` | object or null |  | Real-user experience when available. |
| `real_user_results.scope` | string | `"URL"` | Whether data describes the URL or its origin. |
| `real_user_results.passed` | boolean or null | `true` | Whether Core Web Vitals passed. |
| `real_user_results.cumulative_layout_shift` | number or null | `0` | Real-user cumulative layout shift. |
| `real_user_results.interaction_to_next_paint_ms` | number or null | `80` | Real-user interaction to next paint in milliseconds. |
| `real_user_results.largest_contentful_paint_seconds` | number or null | `0.941` | Real-user largest contentful paint in seconds. |
| `accessibility_score` | number or null | `96` | Accessibility score out of 100. |
| `best_practices_score` | number or null | `100` | Best practices score out of 100. |

**Example input**

```json
{
  "page_url": "example.com"
}
```

**Example output**

```json
{
  "device": "mobile",
  "seo_score": 80,
  "lab_results": {
    "speed_index_seconds": 0.783,
    "total_blocking_time_ms": 0,
    "first_contentful_paint_seconds": 0.783,
    "largest_contentful_paint_seconds": 0.783
  },
  "report_link": "https://pagespeed.web.dev/analysis/https-example-com/eu9v402hfw?form_factor=mobile",
  "tested_link": "https://example.com/",
  "suggested_fixes": [
    {
      "fix": "Use efficient cache lifetimes",
      "estimated_saving": "Est savings of 2 KiB"
    },
    {
      "fix": "Network dependency tree",
      "estimated_saving": null
    }
  ],
  "performance_score": 100,
  "real_user_results": {
    "scope": "URL",
    "passed": true,
    "cumulative_layout_shift": 0,
    "interaction_to_next_paint_ms": 80,
    "largest_contentful_paint_seconds": 0.941
  },
  "accessibility_score": 96,
  "best_practices_score": 100
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@google-pagespeed-insights",
  "visibility": "public",
  "operation": "check_page_speed",
  "version": 1,
  "input": {
    "page_url": "example.com"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@google-pagespeed-insights\",\n  \"visibility\": \"public\",\n  \"operation\": \"check_page_speed\",\n  \"version\": 1,\n  \"input\": {\n    \"page_url\": \"example.com\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@google-pagespeed-insights",
  "visibility": "public",
  "operation": "check_page_speed",
  "version": 1,
  "input": {
    "page_url": "example.com"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/google-pagespeed-insights`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `check_page_speed`: Check page speed. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-google-pagespeed-insights https://api.fous.com/mcp/tools/google-pagespeed-insights --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Compare page speed scores on mobile and desktop.
- Review accessibility and best practices scores for a web page.
- Check whether real-user Core Web Vitals passed when data is available.
- Prioritize page improvements using suggested fixes and estimated savings.
- Check a page’s SEO score.

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this Google PageSpeed Insights tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a Google PageSpeed Insights account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from pagespeed.web.dev when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 30, 2026.

### What is this page’s performance score?

Check page speed returns a performance score out of 100.

### Did this page pass Core Web Vitals?

Check page speed returns whether Core Web Vitals passed when real-user results are available.

### What improvements does this page need?

Check page speed returns up to five relevant suggested fixes.

## Related

- [SSL Labs API](https://fous.com/tools/ssl-labs.md): Qualys SSL Labs tests the security of public HTTPS servers.
- [Google Search API](https://fous.com/tools/google-search.md): Google Search returns public web, image, job, event, related-question, and autocomplete results in Google’s order, with answers and details when available; results may be fewer, omit information, or be empty.
- [Similarweb API](https://fous.com/tools/similarweb.md): Similarweb provides website traffic estimates and digital market intelligence, including monthly traffic, rankings, engagement, top countries, and category and country leaders; anonymous access may limit results.
- [Google Play API](https://fous.com/tools/google-play.md): Google Play helps people discover Android apps and games, view public listings and search results, read reviews when available by app and region, and see country-specific top charts.
- [Google Lens API](https://fous.com/tools/google-lens.md): Identify images and find visually similar pages online.
- [Google Public DNS API](https://fous.com/tools/google-public-dns.md): Public DNS lookups and DNS-over-HTTPS from Google.
- [Google Patents API](https://fous.com/tools/google-patents.md): Google Patents searches public records and provides patent details and company summaries; legal status is estimated, and citations, claims, and company breakdowns have record limits.
- [Google Trends API](https://fous.com/tools/google-trends.md): Google Trends compares relative search interest over time and by region, shows related searches and current trends, with daily peaks for seven-day views.
- [All Marketing tools](https://fous.com/tools/category/marketing)
