← Back to PageGuard

PageGuard API Docs

Integrate website health scanning into your workflow. REST API, JSON responses, no fuss.

Quick Start — 3 steps

Step 1 — Get a free API key

curl -X POST https://pageguard.qiudeqiu.workers.dev/api/keys \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@example.com"}'

# Response: {"key":"pg_xxx...","tier":"free","limits":{"daily":50}}

Step 2 — Trigger a scan

curl -X POST https://pageguard.qiudeqiu.workers.dev/api/v1/scan \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: pg_xxx...' \
  -d '{"url":"https://example.com"}'

# Response: {"scan_id":"abc123","status":"pending","poll_url":"..."}

Step 3 — Poll for results (~30s)

curl https://pageguard.qiudeqiu.workers.dev/api/v1/scan/abc123 \
  -H 'X-API-Key: pg_xxx...'

# When complete: {"scan_id":"abc123","status":"complete","scores":{...},"issues":[...],"ai_report":"..."}

API Reference

POST /api/keys Generate API Key

Generate a free API key. Email is optional but recommended for key recovery.

Request Body (JSON, optional)

{ "email": "you@example.com" }

Response

{
  "key": "pg_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef",
  "tier": "free",
  "limits": { "daily": 50 }
}

curl Example

curl -X POST https://pageguard.qiudeqiu.workers.dev/api/keys \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@example.com"}'
POST /api/v1/scan Submit a Scan

Submit a URL for scanning. Returns immediately with a scan_id — use the poll endpoint to get results.

Headers

X-API-Key: pg_xxx...
Content-Type: application/json

Request Body

{ "url": "https://example.com" }

Response (202 Accepted)

{
  "scan_id": "abc1234xyz",
  "status": "pending",
  "poll_url": "https://pageguard.qiudeqiu.workers.dev/api/v1/scan/abc1234xyz"
}

Error Responses

401Missing or invalid API key
400Missing or invalid URL in body
429Daily limit exceeded (free: 50/day)

curl Example

curl -X POST https://pageguard.qiudeqiu.workers.dev/api/v1/scan \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: pg_xxx...' \
  -d '{"url":"https://example.com"}'
GET /api/v1/scan/:id Get Scan Results

Poll for scan status and results. Scans typically complete in 20–40 seconds. Poll every 3–5 seconds.

Headers

X-API-Key: pg_xxx...

Response — Pending / Scanning

{ "scan_id": "abc1234xyz", "status": "scanning" }

Response — Complete

{
  "scan_id": "abc1234xyz",
  "status": "complete",
  "url": "https://example.com",
  "scores": {
    "performance": 0.91,
    "accessibility": 0.95,
    "seo": 0.87,
    "best_practices": 0.92
  },
  "issues": [
    {
      "id": "render-blocking-resources",
      "title": "Eliminate render-blocking resources",
      "description": "Resources are blocking the first paint...",
      "score": 0.5,
      "category": "performance"
    }
  ],
  "ai_report": "Your site scores well overall. The main issue is...",
  "created_at": "2026-02-23T10:00:00.000Z"
}

Response — Error

{ "scan_id": "abc1234xyz", "status": "error", "error": "Failed to fetch URL" }

curl Example

curl https://pageguard.qiudeqiu.workers.dev/api/v1/scan/abc1234xyz \
  -H 'X-API-Key: pg_xxx...'

Free

$0
  • 50 scans per day
  • Full scan results (scores + issues)
  • AI plain-English report
  • No credit card required
Get Free Key

Pro

$29/mo
  • 1,000 scans per day
  • Everything in Free
  • Priority processing
  • Webhook notifications

Get your free API key

Email optional. Key is generated instantly. Save it — we don't store it in recoverable form.