pagehaul from your own code.
Everything the website does, as three endpoints. A key acts as you and spends from the same allowance your account page shows.
Keys
Make a key on your account page. It is shown once; pagehaul keeps only a hash of it. Send it as a bearer token:
Authorization: Bearer ph_live_…
The API comes with Scanner (2 keys), Pro (5) and Studio (10). Scans are unlimited on every paid plan; teardowns count against the plan’s monthly teardowns exactly as they do on the website. Each key is limited to 60 requests a minute.
Scan a page
curl https://pagehaul.app/api/v1/scan \
-H "Authorization: Bearer $PAGEHAUL_KEY" \
-H "content-type: application/json" \
-d '{"url": "stripe.com", "deep": true}'deep: false reads the markup in seconds; deep: true opens the page in a real browser (15 to 40 seconds) and adds the palette, typography and design tokens. The response is the same object the website draws:
{
"target": "https://stripe.com/",
"pages": [{ "url": "…", "title": "…", "ok": true }],
"assets": [{
"id": "…", "url": "https://…", "kind": "image",
"format": "WEBP", "displayName": "Hero illustration",
"width": 2400, "height": 1350, "bytes": 182311,
"variants": [{ "url": "…", "label": "1200w" }]
}],
"palette": [{ "hex": "#635bff", "count": 412, "role": "accent" }],
"typography": [{ "family": "Sohne", "weights": ["400","600"], "sizes": ["16px","48px"] }],
"tokens": [{ "name": "--color-primary", "value": "#635bff" }],
"ms": 21840,
"notes": []
}kind is one of image, screenshot, svg, video, audio, font, model, document, code, data or api. Files come back as addresses: fetch them yourself, straight from their origin.
Crawl a whole site
curl https://pagehaul.app/api/v1/scan \
-H "Authorization: Bearer $PAGEHAUL_KEY" \
-H "content-type: application/json" \
-d '{"url": "stripe.com", "site": true}'Deep-scans the page given in a real browser and reads up to 24 more pages of the same site, nearest first: the site’s own links, then its sitemap, honouring its robots.txt. "crawl": true means the same thing. Each file’s fromPage names the page it was first found on, and seenOn lists every page it appears on when there is more than one. A whole-site scan counts as one deep scan.
Tear down a site
curl https://pagehaul.app/api/v1/teardown \
-H "Authorization: Bearer $PAGEHAUL_KEY" \
-H "content-type: application/json" \
-d '{"url": "abcplumbing.com"}'Returns the full measured analysis: Core Web Vitals, resources, SEO, mobile, accessibility, the design measurements, findings, and screenshots as data URLs. Allow up to two and a half minutes.
Your allowance
curl https://pagehaul.app/api/v1/me -H "Authorization: Bearer $PAGEHAUL_KEY"
The plan, and what is left of each allowance (null means unlimited), so a script can check before starting a batch.
Errors
Every refusal carries a code to act on:
| 401 | invalid_api_key | The key is wrong or incomplete. |
| 401 | api_key_revoked | The key was revoked. Make a new one. |
| 402 | api_not_on_plan | The key's account is not on a plan with the API. |
| 402 | out_of_month | The month's teardowns are spent; the date they return is in the message. |
| 403 | verify_email | The account has not confirmed its email address. |
| 429 | rate_limited | Over 60 requests a minute. Retry-After says when. |
| 422 | The page itself could not be read: the message says why. |
Repeat requests for the same address and depth within five minutes are answered from a cache and still count, as they do on the website.