# Bulk Lighthouse & PageSpeed Insights - Website Speed Test (`api-co/lighthouse-pagespeed`) Actor

Bulk Google Lighthouse and PageSpeed Insights audits without an API key: Performance, Accessibility, Best Practices and SEO scores, Core Web Vitals (LCP, CLS, TBT, INP field data), website speed test metrics and top opportunities, mobile and desktop.

- **URL**: https://apify.com/api-co/lighthouse-pagespeed.md
- **Developed by:** [Emilio Cisneros](https://apify.com/api-co) (community)
- **Categories:** SEO tools, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.80 / 1,000 audits

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Bulk Lighthouse & PageSpeed Insights - Website Speed Test

Run **Google Lighthouse audits in bulk** and get one clean row per URL and device:

- **Scores (0-100)**: Performance, Accessibility, Best Practices and SEO.
- **Lab metrics**: LCP, FCP, TBT, CLS, Speed Index, TTI, server response time, total page weight, request count, DOM size, third-party blocking time and the LCP element.
- **Core Web Vitals pass/fail**: from real-user field data when available, otherwise from lab data.
- **Top opportunities** with estimated savings (ms and KB), plus the failed accessibility, best-practices and SEO audits.
- **Mobile and desktop** in one run.
- **No API key needed**: Lighthouse runs in our own headless Chrome. Add your free PageSpeed Insights key to also get **Chrome UX Report field data** (real-user p75 LCP, INP, CLS, FCP, TTFB for the URL and the origin).
- Optional **full Lighthouse JSON** per audit in the key-value store.

### How to use

1. Paste the URLs to audit into **URLs**.
2. Choose mobile, desktop or both. Optionally add your free PageSpeed Insights key for real-user Chrome UX Report data.
3. Click **Start** and get one row per URL and device with scores, Core Web Vitals and the top opportunities.

### Why this Actor

| | This Actor | Typical PageSpeed Actors |
|---|---|---|
| API key | **Optional** (local Lighthouse) | Usually required |
| Field data (CrUX) | Yes, with a key | Varies |
| Opportunities + failed audits | **Yes** | Scores only |
| Price | **$6 / 1,000 audits** | $8 to $100 / 1,000 |

### Input

```json
{ "urls": ["https://example.com/", "https://example.com/pricing"], "strategies": ["mobile", "desktop"] }
```

With field data:

```json
{ "urls": ["https://example.com/"], "psiApiKey": "YOUR_FREE_KEY" }
```

### Output

```json
{ "url": "https://books.toscrape.com", "strategy": "mobile", "engine": "lighthouse-local", "performance": 99, "accessibility": 87, "bestPractices": 75, "seo": 91,
  "lcpMs": 1830, "fcpMs": 1200, "tbtMs": 0, "cls": 0, "speedIndexMs": 1500, "serverResponseMs": 40, "totalByteWeightKb": 410,
  "coreWebVitals": { "source": "lab", "passed": true },
  "opportunities": [{ "id": "uses-optimized-images", "title": "Efficiently encode images", "savingsMs": 300, "savingsKb": 120 }],
  "failedAudits": [{ "category": "accessibility", "id": "color-contrast", "title": "Background and foreground colors do not have a sufficient contrast ratio." }],
  "fieldData": { "overall": "FAST", "lcp": { "p75": 1900, "category": "FAST" }, "inp": { "p75": 120, "category": "FAST" }, "cls": { "p75": 0.02, "category": "FAST" } } }
```

### Pricing (pay per event)

**$0.006 per audit** (one URL on one device). Failed audits are free error records.

### How much does it cost?

You only pay for results, never for compute time:

| You get | You pay (Starter/Bronze plan price) |
|---|---|
| 100 audits | $0.60 |
| 1,000 audits | $6.00 |
| 10,000 audits | $60.00 |

Apify's **free plan includes $5 of usage every month**, and free-plan users pay **half price** on this Actor, so that covers about **1,666 audits** at no cost. Paid plans get volume discounts (Silver -10%, Gold -20%). Set a *maximum cost per run* and the Actor stops cleanly at your limit.

### Notes

- Local lab scores come from a cloud machine with simulated throttling, so they can differ a few points from PageSpeed Insights. Use one engine consistently for monitoring.
- Schedule daily or weekly runs to track Core Web Vitals over time.

### Use cases

- **SEO and web agencies**: bulk performance reports for many client pages at once.
- **Core Web Vitals monitoring**: scheduled audits that catch regressions after deploys.
- **Competitor benchmarking**: compare page speed across competitors' sites.
- **Accessibility checks**: failed accessibility audits per page.

### Run it from code (API, Python, JavaScript)

```bash
curl -X POST "https://api.apify.com/v2/acts/api-co~lighthouse-pagespeed/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" -d '{"urls": ["https://example.com/"], "strategies": ["mobile", "desktop"]}'
```

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("api-co/lighthouse-pagespeed").call(run_input={"urls": ["https://example.com/"], "strategies": ["mobile", "desktop"]})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('api-co/lighthouse-pagespeed').call({"urls": ["https://example.com/"], "strategies": ["mobile", "desktop"]});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

It also works from **AI agents through the Apify MCP server**, and with Zapier, Make, n8n, Google Sheets and webhooks. You can schedule it in the Apify Console.

### FAQ

**Do I need a Google PageSpeed API key?**
No. Lighthouse runs in our own headless Chrome. A free key is optional and only adds real-user field data (CrUX).

**Why do scores differ from PageSpeed Insights?**
Lab scores depend on the machine and network. Use one engine consistently when you monitor trends.

**Can I monitor Core Web Vitals over time?**
Yes. Schedule the Actor daily or weekly and send results to Google Sheets or a dashboard.

**How many URLs can I audit?**
As many as you like; each URL and device is one audit.

# Actor input Schema

## `urls` (type: `array`):

Pages to audit, e.g. https://example.com/ or example.com/pricing.

## `urlsText` (type: `string`):

Paste many URLs, one per line.

## `strategies` (type: `array`):

Run a mobile audit (Moto G Power, throttled 4G), a desktop audit, or both. Each URL x device is one audit.

## `categories` (type: `array`):

Which Lighthouse categories to score.

## `engine` (type: `string`):

auto = PageSpeed Insights if you provide an API key (adds real-user CrUX field data), otherwise Lighthouse in our own headless Chrome (no key needed).

## `psiApiKey` (type: `string`):

Free Google API key. With it you also get Chrome UX Report field data (real-user LCP, INP, CLS, FCP, TTFB).

## `maxOpportunities` (type: `integer`):

Top performance opportunities (estimated savings) to include.

## `saveFullReports` (type: `boolean`):

Store each full Lighthouse report in the key-value store (free).

## `retries` (type: `integer`):

Retries per failed audit.

## `maxItems` (type: `integer`):

Stop after this many audits.

## Actor input object example

```json
{
  "urls": [
    "https://example.com/"
  ],
  "strategies": [
    "mobile"
  ],
  "categories": [
    "performance",
    "accessibility",
    "best-practices",
    "seo"
  ],
  "engine": "auto",
  "maxOpportunities": 8,
  "saveFullReports": false,
  "retries": 1
}
```

# Actor output Schema

## `results` (type: `string`):

One item per URL and device with Lighthouse scores, Core Web Vitals and top opportunities.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://example.com/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-co/lighthouse-pagespeed").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": ["https://example.com/"] }

# Run the Actor and wait for it to finish
run = client.actor("api-co/lighthouse-pagespeed").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://example.com/"
  ]
}' |
apify call api-co/lighthouse-pagespeed --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api-co/lighthouse-pagespeed"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/R7ngXtGYGLMGmLcOR/builds/hIhs6fnLCKB67hpK3/openapi.json
