# Website Performance Auditor — Lighthouse & PageSpeed (`perryay/website-performance-auditor`) Actor

Run Google Lighthouse performance audits via PageSpeed Insights API. Get performance, accessibility, SEO, and best-practices scores for any URL.

- **URL**: https://apify.com/perryay/website-performance-auditor.md
- **Developed by:** [Perry AY](https://apify.com/perryay) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 50.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / actor start

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Website Performance Auditor 🚀 — Run Lighthouse Audits & Track Scores Over Time

**Run Google Lighthouse performance audits via PageSpeed Insights API. Get performance, accessibility, SEO, and best-practices scores for any URL. Audit individual pages, batch-process dozens of URLs, track scores over time with trend analysis, and compare reports side-by-side.**

---

### What does it do?

The Website Performance Auditor uses Google's [PageSpeed Insights API (v5)](https://developers.google.com/speed/docs/insights/v5/about) to run Lighthouse audits on any website URL. It extracts the four core Lighthouse category scores — **Performance**, **Accessibility**, **SEO**, and **Best Practices** — along with detailed audit recommendations (opportunities, diagnostics, and passed audits) and real-user data from Chrome User Experience Report (CrUX).

You can audit a single URL for a quick health check, batch-audit multiple pages concurrently, set up recurring monitoring via the Apify scheduler, compare two sets of URLs to catch regressions, or generate trend reports from stored history.

### Features

**Lighthouse Category Scores.** Every audit returns scores (0–100) for Performance, Accessibility, SEO, and Best Practices. Scores come directly from Google Lighthouse running on PageSpeed Insights servers, identical to what you'd see in Chrome DevTools.

**Detailed Audit Recommendations.** Each result includes up to 20 optimization opportunities (sorted by potential savings) and 30 diagnostic findings. Each audit item has a title, description, score display mode, and numeric value where applicable — the same data that fuels Lighthouse's "Opportunities" and "Diagnostics" sections.

**Real-User Data (CrUX).** The API returns Chrome User Experience Report data showing how real visitors experience your site — overall category rating (fast/average/slow) and key metrics like First Contentful Paint (FCP), Largest Contentful Paint (LCP), and Cumulative Layout Shift (CLS) at the 75th percentile.

**Multiple Audit Modes.**

| Mode | Description |
|------|-------------|
| `single` | Audit one URL with full Lighthouse report |
| `batch` | Audit multiple URLs concurrently (up to 10 at once, configurable) |
| `scheduled` | Like batch, but stores results in the Key-Value Store for trend tracking |
| `compare` | Audit two URL sets and generate per-category score diffs |
| `trend` | Generate trend reports from previously stored KVS history (no new API calls) |

**Concurrent Batch Processing.** In batch mode, URLs are audited concurrently with a configurable concurrency limit (default 5, max 20). Failed audits for individual URLs don't block the rest of the batch — `asyncio.gather(..., return_exceptions=True)` ensures every URL gets a result or an error.

**Historical Trend Tracking.** When using `scheduled` mode, each audit result is appended to a per-URL history list in the default Key-Value Store (KVS). The `trend` mode reads that history without making new API calls, computing min, max, mean, standard deviation, and overall score change per category. History is capped at the last 50 entries per URL.

**Comparison Reports.** The `compare` mode audits two separate URL sets and produces per-URL score diffs for all four categories. Positive values mean improvement, negative values mean regression. Results with a regression of more than 5 points in any category are flagged.

**Mobile & Desktop Strategies.** Choose between `mobile` (Moto G4 emulation on slow 3G — conservative, lower scores) and `desktop` (desktop-class device and network). The same URL can differ significantly between strategies.

### Who is it for?

| Persona | What they use it for |
|---------|----------------------|
| **Web Developer** | Running Lighthouse audits during development to catch performance regressions before they ship. Checking that core web vitals are green before merge. |
| **SEO Specialist** | Tracking SEO scores across a site's key landing pages. Monitoring how page structure changes affect search-optimization scores over weeks and months. |
| **QA Engineer** | Adding PageSpeed score checks to the release pipeline. Running batch audits across an entire site after a template or theme update to confirm no scores dropped. |
| **Site Reliability Engineer** | Scheduling weekly performance audits for critical customer-facing pages. Tracking trend data to catch gradual performance degradation that single-point checks miss. |
| **Product Manager** | Comparing competitor site performance. Running `compare` mode to benchmark against industry leaders and identify performance gaps. |
| **Agency Owner** | Generating performance reports for client sites. Using `scheduled` mode to show month-over-month score improvements from optimization work. |

### Input Parameters

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `mode` | string | No | `"single"` | Operating mode. One of: `single`, `batch`, `scheduled`, `compare`, `trend`. |
| `url` | string | **Yes** | — | Website URL to audit. Used directly in `single` mode. In `batch`/`scheduled` modes, use this with newline-separated URLs, or use the `urls` array instead. |
| `urls` | array of strings | No | — | List of URLs for `batch`, `scheduled`, or `trend` modes. Alternative to newline-separated `url` field. |
| `urlsA` | array of strings | No | — | First URL set for `compare` mode (baseline). |
| `urlsB` | array of strings | No | — | Second URL set for `compare` mode (current). |
| `strategy` | string | No | `"mobile"` | Lighthouse strategy. `"mobile"` (Moto G4 + slow 3G) or `"desktop"`. |
| `apiKey` | string | No | — | Google API key for higher PageSpeed Insights API quota. Create one at [Google Cloud Console](https://console.cloud.google.com/apis/credentials). |
| `concurrency` | integer | No | `5` | Max concurrent API requests in batch/scheduled/compare modes. Range: 1–20. |

### Example Input

#### Minimal: Single URL audit

```json
{
  "mode": "single",
  "url": "https://example.com"
}
````

#### Batch: Audit multiple pages concurrently

```json
{
  "mode": "batch",
  "urls": [
    "https://example.com",
    "https://example.com/about",
    "https://example.com/pricing",
    "https://example.com/docs",
    "https://example.com/blog"
  ],
  "strategy": "mobile",
  "concurrency": 5
}
```

#### Scheduled: Monitor URLs over time

```json
{
  "mode": "scheduled",
  "urls": [
    "https://example.com",
    "https://example.com/pricing"
  ],
  "strategy": "desktop"
}
```

#### Compare: Two URL sets side-by-side

```json
{
  "mode": "compare",
  "urlsA": ["https://example.com"],
  "urlsB": ["https://example.com"],
  "strategy": "mobile"
}
```

#### Trend: Read history without new API calls

```json
{
  "mode": "trend",
  "urls": ["https://example.com"]
}
```

### Output Format

Each audited URL produces a dataset item with these fields:

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | The URL that was audited. |
| `finalUrl` | string | The final URL after any redirects. |
| `strategy` | string | Lighthouse strategy used (`mobile` or `desktop`). |
| `fetchTime` | string | ISO 8601 timestamp from the PageSpeed API. |
| `lighthouseVersion` | string | Lighthouse version used for the audit. |
| `requestedUrl` | string | The originally requested URL. |
| `categoryScores` | object | Object with keys `performance`, `accessibility`, `seo`, `best-practices` and integer values 0–100 (or null if the category failed). |
| `totalAudits` | integer | Total number of audit items in the Lighthouse report. |
| `passedAudits` | integer | Number of audits that passed. |
| `opportunities` | array | Up to 20 optimization opportunities sorted by potential savings. Each has `id`, `title`, `description`, `score`, `scoreDisplayMode`, and optional `numericValue`/`displayValue`. |
| `diagnostics` | array | Up to 30 diagnostic audit items with same structure as opportunities. |
| `loadingExperience` | object | Real-user CrUX data for this URL. Contains `overallCategory` and `metrics` with FCP, LCP, CLS, etc. |
| `originLoadingExperience` | object | CrUX data aggregated at the origin level. Same structure as `loadingExperience`. |
| `error` | string or null | Error message if the audit failed. Null for successful audits. |
| `auditedAt` | string | ISO 8601 timestamp of when the actor ran the audit. |

#### Example Output (healthy audit)

```json
{
  "url": "https://example.com",
  "finalUrl": "https://example.com/",
  "strategy": "mobile",
  "fetchTime": "2026-07-27T12:00:00.000Z",
  "lighthouseVersion": "11.12.1",
  "requestedUrl": "https://example.com",
  "categoryScores": {
    "performance": 87,
    "accessibility": 95,
    "seo": 100,
    "best-practices": 92
  },
  "totalAudits": 124,
  "passedAudits": 108,
  "opportunities": [
    {
      "id": "uses-responsive-images",
      "title": "Properly size images",
      "description": "Serve images that are appropriately-sized...",
      "score": 38,
      "scoreDisplayMode": "opportunity",
      "numericValue": 2450,
      "displayValue": "2.45 s"
    }
  ],
  "diagnostics": [],
  "loadingExperience": {
    "overallCategory": "FAST",
    "metrics": {
      "FIRST_CONTENTFUL_PAINT_MS": 1800,
      "LARGEST_CONTENTFUL_PAINT_MS": 2500,
      "CUMULATIVE_LAYOUT_SHIFT_SCORE": 0.05
    }
  },
  "originLoadingExperience": {
    "overallCategory": "FAST",
    "metrics": {
      "FIRST_CONTENTFUL_PAINT_MS": 1600,
      "LARGEST_CONTENTFUL_PAINT_MS": 2100,
      "CUMULATIVE_LAYOUT_SHIFT_SCORE": 0.03
    }
  },
  "error": null,
  "auditedAt": "2026-07-27T12:00:01.234567+00:00"
}
```

#### Example Summary

The final dataset item is a summary object with `_summary: true`:

```json
{
  "_summary": true,
  "mode": "batch",
  "totalUrls": 5,
  "succeeded": 5,
  "failed": 0,
  "strategy": "mobile",
  "averageCategoryScores": {
    "performance": 82.4,
    "accessibility": 91.2,
    "seo": 96.8,
    "best-practices": 88.6
  },
  "auditedAt": "2026-07-27T12:00:05.678901+00:00"
}
```

### FAQ

**How does this compare to running Lighthouse in the browser?**
The API calls Google PageSpeed Insights, which runs the same Lighthouse engine as Chrome DevTools on Google's infrastructure. Scores are identical — but the API approach scales to many URLs without opening a browser.

**Do I need a Google API key?**
No. The PageSpeed Insights API works without a key for basic usage. If you're running many audits (hundreds per day), add an API key for higher quota. Keys are free from the [Google Cloud Console](https://console.cloud.google.com/apis/credentials).

**What's the difference between mobile and desktop strategy?**
Mobile strategy emulates a Moto G4 device on a slow 3G connection. Desktop strategy uses desktop-class hardware and network. Mobile scores are typically lower and represent the conservative case — Google uses mobile-first indexing, so mobile scores matter more for SEO.

**What is CrUX data?**
The Chrome User Experience Report (CrUX) is a public dataset of real user performance data collected from opted-in Chrome browsers. It shows how actual visitors experienced the page, not just a synthetic Lighthouse run. The `loadingExperience` field contains this data at the URL level; `originLoadingExperience` aggregates across the entire origin.

**How many URLs can I audit in one run?**
There's no hard limit from the actor, but the PageSpeed API rate limits apply. Without an API key, you can make roughly 60 requests per minute. With a key, the quota depends on your Google Cloud project settings (typically 240 queries per minute). The actor's concurrency setting lets you control the request rate.

**How does historical trending work?**
Each audit result in `scheduled` mode is appended to a per-URL list in the default Key-Value Store. Keys follow the pattern `AUDIT_HISTORY_<url-hash>`. History is capped at 50 entries per URL. The `trend` mode reads this history and computes statistics without making new API calls. The `LATEST_AUDITS` KVS record maps every audited URL to its most recent score snapshot.

**What happens if a URL audit fails?**
The URL is recorded with an `error` field describing the failure (timeout, HTTP error, invalid URL) and the actor continues to the next URL. Failed audits are reflected in the summary's `failed` count. `apify-actor-start` is the only auto-charged event — failed individual audits don't incur per-audit charges.

**Can I use this in CI/CD?**
Yes. Call the Apify API with the actor input and parse the dataset output. The structured JSON output includes all category scores and audit items, making it easy to add Lighthouse score gates to your deployment pipeline.

**How do I compare two audit runs?**
Use `compare` mode with `urlsA` (baseline) and `urlsB` (current). The output includes per-URL score diffs for all four categories and flags any regression of 5+ points. You can compare the same URL audited at different times, or different URLs entirely.

**Is the data stored permanently?**
KVS data persists as long as the actor's default store exists. History is capped at 50 entries per URL — older entries are automatically pruned when new ones are added. You can also clear history by deleting the `AUDIT_HISTORY_*` and `LATEST_AUDITS` keys from the KVS via the Apify Console.

***

### MCP Integration

This actor can be used through the [Apify MCP server](https://docs.apify.com/integrations/mcp). Once connected, your MCP client (Claude Desktop, Cursor, etc.) can discover and run this actor from the Apify Store.

#### Quick Start

1. **Install the Apify connector** in your MCP client:
   - **Claude Desktop**: Search for "Apify" in the connector directory, or use the remote server at `https://mcp.apify.com`
   - **Other clients**: See the [Apify MCP server docs](https://docs.apify.com/integrations/mcp) for setup instructions

2. **Ask your AI assistant** to use the actor. For example:

   > "Audit example.com with Lighthouse and tell me the performance score"
   >
   > "Batch audit our top 5 landing pages for mobile performance"
   >
   > "Compare the performance of example.com and example.org side by side"
   >
   > "Show me the performance trend for example.com over the last week using stored data"

#### Claude Desktop Configuration

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/mcp-server"
      ],
      "env": {
        "APIFY_TOKEN": "your-apify-api-token"
      }
    }
  }
}
```

### API Usage

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/perryay~website-performance-auditor/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "single",
    "url": "https://example.com",
    "strategy": "mobile"
  }'
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")

result = client.actor("perryay~website-performance-auditor").call(
    run_input={
        "mode": "batch",
        "urls": [
            "https://example.com",
            "https://example.com/about",
            "https://example.com/pricing",
        ],
        "strategy": "mobile",
        "concurrency": 5,
    }
)

dataset_items = client.dataset(result["defaultDatasetId"]).list_items()
for item in dataset_items.items:
    if not item.get("_summary") and not item.get("_trend"):
        scores = item.get("categoryScores", {})
        perf = scores.get("performance", "N/A")
        acc = scores.get("accessibility", "N/A")
        seo = scores.get("seo", "N/A")
        bp = scores.get("best-practices", "N/A")
        print(f"{item['url']}: P={perf} A={acc} S={seo} BP={bp}")
```

#### Node.js

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const result = await client.actor('perryay~website-performance-auditor').call({
    mode: 'batch',
    urls: ['https://example.com', 'https://example.com/about'],
    strategy: 'mobile',
});

const { items } = await client.dataset(result.defaultDatasetId).listItems();
items.forEach(item => {
    if (!item._summary && !item._trend) {
        const s = item.categoryScores || {};
        console.log(`${item.url}: P=${s.performance} A=${s.accessibility} S=${s.seo} BP=${s['best-practices']}`);
    }
});
```

### Use Cases

- **Performance budget gate in CI.** Add the actor to your CI pipeline. After every deploy, audit the production URL and check that `performance` stays above your budget threshold (e.g., 80). If it drops, the build fails.

- **Weekly performance monitoring via scheduler.** Set up a recurring Apify scheduled task to run `scheduled` mode against your top 10 pages every Monday. Review the `trend` data monthly to catch gradual score decay before it reaches customers.

- **Competitive benchmarking.** Use `batch` mode to audit your site and competitor sites simultaneously. Compare `categoryScores` to identify where competitors outperform you.

- **Post-migration audit.** After a CMS migration, framework upgrade, or CDN switch, run `compare` mode with pre-migration and post-migration URL sets. The score diffs immediately show whether the change improved or regressed each category.

- **Accessibility compliance tracking.** Schedule monthly audits targeting accessibility scores. Track the trend over quarters to demonstrate WCAG compliance improvements to stakeholders or regulators.

- **SEO score monitoring for landing pages.** For e-commerce or SaaS landing pages that drive conversions, run `scheduled` weekly monitoring. A sudden SEO score drop often correlates with accidental noindex tags, broken structured data, or missing meta descriptions.

- **Multi-strategy coverage.** Run the same URL set in both `mobile` and `desktop` strategies. Large gaps between mobile and desktop performance scores highlight pages that need mobile-specific optimization.

***

### Related Tools

- **[URL Health Checker](https://apify.com/perryay/url-health)** — Monitor URL uptime, response times, and HTTP status codes. Complements performance auditing by ensuring the site is actually reachable.
- **[API Health Monitor](https://apify.com/perryay/api-health-monitor)** — Track API endpoint availability, response times, and error rates alongside your frontend performance data.
- **[Website Tech Stack Detector](https://apify.com/perryay/website-tech-stack-detector)** — Identify the technologies powering any website (CMS, frameworks, analytics, CDNs) to understand what may be affecting performance.
- **[All perryay actors](https://apify.com/perryay)** — Browse the full collection of Apify actors by perryay.

### SEO Keywords

website performance auditor, lighthouse audit, pagespeed insights, google pagespeed, core web vitals, seo audit tool, web performance monitoring, lighthouse ci, website speed test, performance score checker, accessibility audit, seo scoring, web vitals checker, cumulative layout shift, largest contentful paint, first input delay, interaction to next paint, batch url auditing, website benchmarking, competitor performance comparison, apify actor, synthetic monitoring, real user monitoring, crux data, chrome user experience report, performance budget ci, seo monitoring tool, website optimization tracker

# Actor input Schema

## `mode` (type: `string`):

Operating mode: 'single' audits one URL, 'batch' audits multiple URLs concurrently, 'scheduled' audits and tracks history for trending, 'compare' compares two URL sets, 'trend' generates trend reports from stored history without new audits.

## `url` (type: `string`):

Website URL to audit. Used directly in 'single' mode. In 'batch' or 'scheduled' modes, use this field with newline-separated URLs, or use the 'urls' array field instead.

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

List of website URLs to audit. Used in 'batch', 'scheduled', and 'trend' modes. Each URL is checked against PageSpeed Insights API concurrently (up to 10 at a time).

## `urlsA` (type: `array`):

First set of URLs for comparison. Used in 'compare' mode to diff scores against URLs in 'urlsB'. Typically the baseline audit results.

## `urlsB` (type: `array`):

Second set of URLs for comparison. Used in 'compare' mode to diff scores against URLs in 'urlsA'. Typically the current audit results.

## `strategy` (type: `string`):

Lighthouse strategy: 'mobile' emulates a Moto G4 on slow 3G, 'desktop' emulates a desktop browser. Mobile scores are typically lower and more conservative.

## `apiKey` (type: `string`):

Optional Google API key for higher PageSpeed Insights API quota. Without a key, the API works but is subject to lower rate limits. Create a key at https://console.cloud.google.com/apis/credentials.

## `concurrency` (type: `integer`):

Maximum number of concurrent PageSpeed API requests in batch/scheduled/compare modes. Higher concurrency completes faster but may hit rate limits.

## Actor input object example

```json
{
  "mode": "single",
  "url": "https://example.com",
  "urls": [
    "https://example.com",
    "https://example.org"
  ],
  "urlsA": [
    "https://example.com"
  ],
  "urlsB": [
    "https://example.com"
  ],
  "strategy": "mobile",
  "concurrency": 5
}
```

# Actor output Schema

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

Per-URL Lighthouse audit records in the default dataset. Each item includes category scores (0-100), Lighthouse opportunities and diagnostics, real-user CrUX data, and fetch metadata.

## `summary` (type: `string`):

Run-level summary with mode, total/succeeded/failed counts, average category scores across all audited URLs, and audit timestamp.

## `trends` (type: `string`):

Historical trend data stored in the default Key-Value Store under AUDIT\_HISTORY\_\* keys. Access per-URL audit history for tracking score changes over time.

## `comparisons` (type: `string`):

Score diffs between two URL sets in compare mode. Each diff entry shows per-category changes (positive = improvement, negative = regression) and flags regressions over 5 points.

# 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 = {
    "mode": "single",
    "url": "https://example.com",
    "urls": [
        "https://example.com",
        "https://example.org"
    ],
    "urlsA": [
        "https://example.com"
    ],
    "urlsB": [
        "https://example.com"
    ],
    "strategy": "mobile",
    "apiKey": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("perryay/website-performance-auditor").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 = {
    "mode": "single",
    "url": "https://example.com",
    "urls": [
        "https://example.com",
        "https://example.org",
    ],
    "urlsA": ["https://example.com"],
    "urlsB": ["https://example.com"],
    "strategy": "mobile",
    "apiKey": "",
}

# Run the Actor and wait for it to finish
run = client.actor("perryay/website-performance-auditor").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "mode": "single",
  "url": "https://example.com",
  "urls": [
    "https://example.com",
    "https://example.org"
  ],
  "urlsA": [
    "https://example.com"
  ],
  "urlsB": [
    "https://example.com"
  ],
  "strategy": "mobile",
  "apiKey": ""
}' |
apify call perryay/website-performance-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=perryay/website-performance-auditor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Website Performance Auditor — Lighthouse & PageSpeed",
        "description": "Run Google Lighthouse performance audits via PageSpeed Insights API. Get performance, accessibility, SEO, and best-practices scores for any URL.",
        "version": "1.0",
        "x-build-id": "pHpkgjZ9LBqaKggmI"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/perryay~website-performance-auditor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-perryay-website-performance-auditor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/perryay~website-performance-auditor/runs": {
            "post": {
                "operationId": "runs-sync-perryay-website-performance-auditor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/perryay~website-performance-auditor/run-sync": {
            "post": {
                "operationId": "run-sync-perryay-website-performance-auditor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "url"
                ],
                "properties": {
                    "mode": {
                        "title": "Audit mode",
                        "enum": [
                            "single",
                            "batch",
                            "scheduled",
                            "compare",
                            "trend"
                        ],
                        "type": "string",
                        "description": "Operating mode: 'single' audits one URL, 'batch' audits multiple URLs concurrently, 'scheduled' audits and tracks history for trending, 'compare' compares two URL sets, 'trend' generates trend reports from stored history without new audits.",
                        "default": "single"
                    },
                    "url": {
                        "title": "URL to audit",
                        "type": "string",
                        "description": "Website URL to audit. Used directly in 'single' mode. In 'batch' or 'scheduled' modes, use this field with newline-separated URLs, or use the 'urls' array field instead."
                    },
                    "urls": {
                        "title": "URLs (array)",
                        "type": "array",
                        "description": "List of website URLs to audit. Used in 'batch', 'scheduled', and 'trend' modes. Each URL is checked against PageSpeed Insights API concurrently (up to 10 at a time)."
                    },
                    "urlsA": {
                        "title": "URL set A (compare mode)",
                        "type": "array",
                        "description": "First set of URLs for comparison. Used in 'compare' mode to diff scores against URLs in 'urlsB'. Typically the baseline audit results."
                    },
                    "urlsB": {
                        "title": "URL set B (compare mode)",
                        "type": "array",
                        "description": "Second set of URLs for comparison. Used in 'compare' mode to diff scores against URLs in 'urlsA'. Typically the current audit results."
                    },
                    "strategy": {
                        "title": "Audit strategy",
                        "enum": [
                            "mobile",
                            "desktop"
                        ],
                        "type": "string",
                        "description": "Lighthouse strategy: 'mobile' emulates a Moto G4 on slow 3G, 'desktop' emulates a desktop browser. Mobile scores are typically lower and more conservative.",
                        "default": "mobile"
                    },
                    "apiKey": {
                        "title": "Google API Key",
                        "type": "string",
                        "description": "Optional Google API key for higher PageSpeed Insights API quota. Without a key, the API works but is subject to lower rate limits. Create a key at https://console.cloud.google.com/apis/credentials."
                    },
                    "concurrency": {
                        "title": "Concurrency limit",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Maximum number of concurrent PageSpeed API requests in batch/scheduled/compare modes. Higher concurrency completes faster but may hit rate limits.",
                        "default": 5
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
