# 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/workflows/google-pagespeed-insights
- Handle: `@google-pagespeed-insights`
- Category: [Marketing](https://fous.com/workflows/category/marketing)
- Source website: https://pagespeed.web.dev
- Last verified: Sep 30, 2026
- Fous is not affiliated with Google PageSpeed Insights.

## Methods

### Check page speed

Operation `check_page_speed`, version 1. 1 credit per call.

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

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_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.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

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=120) 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.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_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);
```

Or describe the data in plain language: send `{"api":"@google-pagespeed-insights","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## 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

### Is Fous affiliated with Google PageSpeed Insights?

No. Fous is not affiliated with Google PageSpeed Insights. This workflow reads the public pagespeed.web.dev website and returns its data.

### How much does it cost?

Each run costs 1 credit. 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; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check 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/workflows/ssl-labs.md): Qualys SSL Labs tests the security of public HTTPS servers.
- [Google Search API](https://fous.com/workflows/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/workflows/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/workflows/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/workflows/google-lens.md): Identify images and find visually similar pages online.
- [Google Public DNS API](https://fous.com/workflows/google-public-dns.md): Public DNS lookups and DNS-over-HTTPS from Google.
- [Google Patents API](https://fous.com/workflows/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/workflows/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 workflows](https://fous.com/workflows/category/marketing)
