Skip to content
Documentation

Quickstart

PageToAPI turns any public URL into JSON for your agent. Send the URL and say what you need. We pick the cheapest method that works and charge only when you get a result.

1. Get an API key

Create an account in the dashboard, or let your agent sign itself up:

curl -X POST {{ORIGIN}}/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email":"you@company.com"}'

# → { "accountId": "acct_…", "apiKey": "pta_live_…", "balance": 0, "creditOnVerify": 1 }

We email the address a confirmation link. New accounts get $1 of free credit as soon as the email is confirmed. The key is shown once. Store it as PAGETOAPI_KEY. Disposable email addresses are not accepted.

2. Make your first request

curl {{ORIGIN}}/v1/extract \
  -H "Authorization: Bearer $PAGETOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://news.ycombinator.com/","ask":"Top 5 stories with title, url and points"}'

3. Or connect your agent over MCP

claude mcp add --transport http pagetoapi {{ORIGIN}}/mcp \
  --header "Authorization: Bearer $PAGETOAPI_KEY"

Authentication

Every API request needs a key, sent as a bearer token. X-API-Key: pta_live_… also works.

Authorization: Bearer pta_live_…
  • Dashboard keys. Create named keys in API keys, one per agent or environment. Each can have its own monthly spend limit.
  • Self-serve signup. POST /v1/signup {"email"} creates an organization and returns a key. The $1 credit is added once the emailed confirmation link is clicked. Each email can sign up once. Organizations in their first 24 hours, or without a confirmed email, are limited to 30 requests a minute.
  • Revocation takes effect immediately. Keys are stored as SHA-256 hashes and can't be shown again.

Requests without a valid key get 401 with code: "unauthorized".

Response shape

A successful result:

{
  "ok": true,
  "url": "https://www.walmart.com/ip/…/10450114",
  "data": { "title": "Great Value Whole Vitamin D Milk, Gallon", "price": 3.62 },
  "meta": {
    "tier": "playbook",          // method that succeeded
    "playbook": "walmart-mobile",  // when a playbook answered
    "extraction": "playbook",    // playbook | structured-data | llm | heuristic | auto
    "attempts": [ … ],            // ladder attempts with status and timing
    "fetchedAt": "2026-11-26T…Z"
  },
  "price": 0.0005,                 // USD charged for this result
  "priceBreakdown": { "fetch": 0.0005, "extraction": 0 },
  "requestId": "req_…",
  "jobId": "job_…"
}

Results served from cache include "cached": true and meta.servedFrom, the method that originally fetched them. Every response also carries an x-request-id header. Include it when you contact support.

Extract

POST/v1/extract

Fetches the page, extracts what you asked for, and returns the result in one call. It returns 200 on success, and 422 with ok: false when no allowed method could get the data. You aren't charged for a 422.

ParameterTypeDescription
urlstringRequired. Public http(s) URL. Private and internal addresses are rejected.
askstringWhat you want, in plain language.
fieldsstring[]Exact keys to return, e.g. ["title","price","in_stock"]. Common product fields are filled from structured data without any AI call.
schemaobjectJSON Schema the AI extraction must follow exactly.
maxPricenumberMost you'll pay for this request, in USD. The ladder never climbs to a method priced above it.
maxTierstringHighest rung allowed: direct, stealth, browser or fortress (default).
maxAgeSecnumberAccept a cached result up to this age. Default 3600; 0 forces a fresh fetch.
renderbooleanStart at the browser rung for pages that need JavaScript.
storeIdstringRetailer store for store-level price and stock (Walmart, Home Depot).
zipstringZIP code where supported (Home Depot).
ladderFallbackbooleanIf a playbook fails, fall back to the generic ladder. Off by default. See Playbooks.
curl {{ORIGIN}}/v1/extract \
  -H "Authorization: Bearer $PAGETOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.walmart.com/ip/Great-Value-Whole-Vitamin-D-Milk-Gallon-128-fl-oz/10450114",
    "fields": ["title", "price", "availability", "aisle"],
    "storeId": "3081",
    "maxPrice": 0.002
  }'

Async jobs & SSE

For long or batched work, start a job and either stream its progress or wait for a webhook.

POST/v1/jobs

Takes the same body as /v1/extract, plus an optional webhook: false to skip the completion webhook. Returns 202 immediately:

{ "id": "job_…", "requestId": "req_…", "status": "running",
  "events": "/v1/jobs/job_…/events", "poll": "/v1/jobs/job_…",
  "quote": { "expectedTier": "direct", "price": 0.0004, "priceCeiling": 0.0198, … } }
GET/v1/jobs/{id}

Returns { id, status, result }, where status is running, done or failed. Jobs are kept for 15 minutes.

GET/v1/jobs/{id}/events

A Server-Sent Events stream. It replays earlier events, then streams new ones until done. Each event is JSON with type and t (ms since start).

EventMeaning
receivedRequest accepted
cache_hitServed from cache (ageSec)
playbook / playbook_missA playbook matched, or couldn't answer
plan · memoryStarting rung and ceiling; domain memory skipped rungs
attempt · blocked · error · successEach rung of the ladder
captcha · captcha_try · captcha_failover · captcha_resultCaptcha detected, sent to a solver, failed over to the next solver, and the outcome (fortress)
policy_blockedThe run stopped for a policy reason found while running: robots.txt or per-site pacing (category, reason). Not charged
extracting · extractedExtraction method, model and token usage
doneFinal result, the same shape as /v1/extract
curl -N {{ORIGIN}}/v1/jobs/job_…/events -H "Authorization: Bearer $PAGETOAPI_KEY"

Schedules

Run the same request on a timetable: a price every morning, a creator's stats every hour, a page every week. Each run goes through the normal engine, so pricing, spend limits and the acceptable-use policy apply exactly as they do to /v1/extract. You pay for successful runs only. Manage schedules in the dashboard or with the API below.

POST/v1/schedules
curl {{ORIGIN}}/v1/schedules \
  -H "Authorization: Bearer $PAGETOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Milk price", "every": "daily", "at": "07:00",
       "request": {"url": "https://www.walmart.com/ip/10450114",
                   "fields": ["price", "availability"]}}'
FieldTypeDescription
requestobjectRequired. The request to repeat: url plus any of ask, fields, schema, maxPrice, maxTier, render, storeId, zip. Checked against the acceptable-use policy when you create it (blocked URLs return 451).
everystringhourly, daily (default), weekly or interval.
atstringHH:MM in UTC for daily and weekly (default 07:00). For hourly, only the minute is used.
weekdaynumberFor weekly: 0 Sunday through 6 Saturday (default 1, Monday).
intervalMinutesnumberFor interval: minutes between runs, at least 15.
namestringOptional label; defaults to the site's hostname.

The response includes cadence in plain words, nextRunAt, and estimate: the expected price per run and per month, based on the route that usually works for that site.

GET/v1/schedules
GET/v1/schedules/{id}

The schedule plus its last 20 runs, each with ok, price, requestId, error and a preview of the data (up to 4 KB).

PATCH/v1/schedules/{id}

Change any field above, or pause and resume with {"paused": true} / {"paused": false}. Resuming clears the failure count and schedules the next run from now.

POST/v1/schedules/{id}/run

Run it now, outside its timetable. Returns { run, schedule } when the run finishes.

DELETE/v1/schedules/{id}

Results, billing and failures

  • Scheduled runs always fetch fresh unless the request sets maxAgeSec.
  • Each run is sent to your webhook as a schedule.run event: { scheduleId, name, manual, ok, data, price, requestId, error }. Runs also appear in Requests with the key schedule.
  • A successful run is billed like a normal request. Failed runs are free.
  • After 5 failed runs in a row, a schedule pauses itself and you get a schedule.paused notification and webhook.
  • Up to 50 schedules per organization. Times are UTC.

Quote

POST/v1/quote

Free. Returns the expected method and price for a request without running it. Agents can use it to decide whether to buy.

{ "url": "…", "expectedTier": "playbook", "price": 0.0005,
  "priceCeiling": 0.0198,   // worst case at your maxTier / maxPrice, incl. AI extraction
  "extraction": "free when structured data or a playbook answers; …" }

Before running any request, your balance must cover priceCeiling. Set maxPrice or maxTier to lower it.

Account & keys

GET/v1/account

Returns the balance, the last 30 days of usage (requests, successes, spend, breakdown by method) and your keys.

POST/v1/keys

Creates another key for the same organization. Body: {"name"} (optional). Returns { apiKey }, shown once.

DELETE/v1/keys/{prefix}

Revokes a key by its 14-character prefix (e.g. pta_live_Qet9CS). Returns { revoked: 1 }.

Pricing

GET/v1/pricing

No key needed. Returns USD per 1,000 successful results for each method, plus the extraction model and markup.

MethodPer 1,000Per request
Loading…

MCP

PageToAPI is a remote MCP server over Streamable HTTP at {{ORIGIN}}/mcp. Authenticate with the same bearer key.

# Claude Code
claude mcp add --transport http pagetoapi {{ORIGIN}}/mcp \
  --header "Authorization: Bearer $PAGETOAPI_KEY"

# Claude Desktop, Cursor and other clients
{ "mcpServers": { "pagetoapi": {
    "type": "http", "url": "{{ORIGIN}}/mcp",
    "headers": { "Authorization": "Bearer pta_live_…" } } } }
ToolArgumentsReturns
get_dataurl, ask, fields, maxPrice, maxAgeSec, storeId, zipThe extract result. Errors set isError.
quoteurl, maxTierExpected method, price and ceiling
schedule_dataurl, ask, fields, every, at, weekday, intervalMinutes, nameThe new schedule (see Schedules)
usagenoneBalance, the last 30 days of usage, and schedule counts

Discovery

Playbooks

When a URL matches a playbook, it answers directly, without HTML scraping or AI. Playbook results come back with meta.tier: "playbook" (or "social") and the playbook's id.

PlaybookMatchesNotes
walmart-mobilewalmart.com/ip/…/{itemId}Optional storeId. Without one, the store Walmart assigns is used and returned as store_id.
homedepot-mobilehomedepot.com/p/…/{itemId}Optional storeId and zip. Returns pricing, promotion, clearance and fulfillment.
shopify-jsonAny /products/{handle} pageFull variant list. Falls through to the ladder if the store doesn't expose product JSON.
socialtiktok.com, instagram.com, youtube.com, youtu.be, x.com, twitter.comProfiles, videos, reels, posts and channels with live metrics. Priced at the social rate.
Exclusive playbooks. Walmart, Home Depot and social playbooks are exclusive. If one fails, the request returns an error, is not charged, and does not fall through to the generic ladder, because those sites block generic scraping and retrying only burns money. Pass ladderFallback: true to opt in anyway.

When you pass fields, a playbook answers only if it has all of them. Otherwise the request moves on.

The escalation ladder

URLs without a playbook start on the cheapest rung and move up only when a block is detected: Cloudflare, DataDome, PerimeterX, Akamai, Kasada, reCAPTCHA, hCaptcha, Turnstile, or an empty JavaScript shell.

RungHow
directHTTPS with a real Chrome TLS and HTTP/2 fingerprint
stealthThe same, through rotating datacenter proxies
browserHeadless Chrome on residential IPs, with images, fonts and media blocked
fortressHeadless Chrome on mobile IPs, with captcha solving

Domain memory records which rung worked for each host. The next request starts there, which skips attempts that would fail.

Extraction runs in this order: playbook data, then structured data on the page (JSON-LD, OpenGraph), then AI extraction over a compacted version of the page. AI extraction is billed at token cost × the markup in /v1/pricing.

Captchas

The fortress rung detects captchas and anti-bot challenges in the page, sends them to a solving provider, applies the answer in the live browser and re-checks the page. If a second challenge appears, it gets one more round.

KindHow the answer is used
reCAPTCHA v2, v3 and EnterpriseToken written to g-recaptcha-response; the page's callback is called, or the form submitted
hCaptchaToken written to h-captcha-response; callback or form submit
Cloudflare TurnstileToken written to cf-turnstile-response; callback or form submit
Cloudflare challenge pagecf_clearance cookie, then reload
Arkose Labs / FunCaptchaToken written to the page's verification-token field
GeeTest v3 and v4Validation fields written to the form
DataDomeDataDome cookie, then reload
AWS WAFaws-waf-token cookie, then reload
Image captchasRecognized text typed into the captcha field
  • Several providers, automatic failover. We route each captcha to a solving service that supports it and fail over to the next one if it can't solve it (up to three per captcha). Providers that run out of balance or reject a key are paused automatically.
  • IP-bound answers. DataDome and Cloudflare challenge answers only work from the IP that requested them, so they're solved through the same proxy the browser is using.
  • Included in the price. Solving is part of the fortress price. You still pay only when the request succeeds.
  • Watch it live. The captcha, captcha_try, captcha_failover and captcha_result events show each step on the event stream.

Acceptable use

PageToAPI reads public web pages. Some requests are refused for every customer, before anything is fetched. Refused requests are never charged.

CategoryWhat's refused
private_areaLogin, sign-up, account, checkout, cart, payment, inbox, admin and settings pages, and URLs carrying tokens, sessions or passwords
credentialsURLs with a username or password embedded (user:pass@host)
people_searchPeople-search and background-check sites, which hold personal data about private individuals
adultAdult content sites
patient_portalsPatient portals, which hold protected health information
dark_web.onion and .i2p hidden services
sensitive_dataAsks or fields requesting government ID numbers, card or bank details, other people's passwords or session cookies, health records, private home addresses or personal phone numbers, or bulk personal contact data. AI extraction also leaves these out if they appear on a page.
platform_ruleA site we've been asked not to serve
org_ruleA site your organization blocked in Settings › Site access
org_allowlistYour organization only allows listed sites, and this isn't one of them
robots_txtThe site's robots.txt disallows the page (generic fetches only, see below)

Checks that need no network happen before the request runs and return 451:

HTTP/1.1 451 Unavailable For Legal Reasons
{ "error": "PageToAPI only reads public pages. Login, account, checkout and inbox pages, and URLs carrying tokens, are not allowed.",
  "code": "blocked_by_policy", "category": "private_area", "requestId": "req_…", "docs": "/docs#acceptable-use" }

robots.txt

On the generic ladder (direct through fortress) we follow each site's robots.txt rules for PageToAPI or, failing that, *, including Crawl-delay up to 30 seconds. Robots files are cached for 6 hours; a missing robots.txt means no restrictions. Built-in playbooks use vetted integrations and aren't subject to it.

Per-site pacing

Across all customers, each site gets at most 4 requests at a time and 120 per minute by default. A request waits up to 15 seconds for a slot.

robots.txt and pacing are decided while the request runs, so they come back as a failed result, not charged, with code blocked_by_policy (category robots_txt) or host_rate_limited (with retryAfterSec). /v1/extract returns them with HTTP 451 (robots.txt) or 429 (pacing), the same as blocks caught before the run. On the event stream they appear as policy_blocked.

See your policy

GET/v1/policy

Returns { robotsMode, domainMode, rules, blockedCategories, hostLimits } for your organization, so agents can check what they may fetch. domainMode is open or allowlist; rules lists your organization's block and allow rules.

Webhooks

Set a webhook URL in Settings. It must use https, except http://localhost for testing. We POST JSON events:

EventWhen
job.succeeded / job.failedAn async job from POST /v1/jobs finishes. data: { jobId, requestId, result }
schedule.runA schedule ran. data: { scheduleId, name, manual, ok, data, price, requestId, error }
schedule.pausedA schedule paused itself after 5 failed runs in a row
balance.lowBalance falls below your alert threshold
spend.limit_80This month's spend passes 80% of your org limit
recharge.failedAn auto-recharge charge failed
webhook.testYou clicked "Send test" in the dashboard
{ "id": "evt_…", "type": "job.succeeded", "created": 1795680000, "data": { … } }

Verifying signatures

Each delivery carries X-PageToAPI-Signature: t=<unix>,v1=<hex>, where v1 is HMAC-SHA256 of "{t}.{raw body}" keyed with your webhook secret. Reject any delivery whose signature doesn't match or whose timestamp is more than 5 minutes old. Failed deliveries are retried up to 3 times.

// Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
  const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest();
  const got = Buffer.from(parts.v1 || '', 'hex');
  return got.length === expected.length && timingSafeEqual(got, expected);
}
# Python
import hmac, hashlib, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > 300:
        return False
    expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))

Errors

Errors are JSON: { "error": "…", "requestId": "req_…", "code"?: "…" }.

StatusCodeMeaning
400invalid_urlMissing, malformed or private URL, or a body that isn't valid JSON
401unauthorizedMissing, invalid or revoked API key
402insufficient_fundsThe balance can't cover the request's worst-case price, or an org or key monthly spend limit was reached
404Unknown endpoint, or a job that doesn't exist or has expired
405Wrong method (e.g. GET /mcp)
413Request body over 1 MB
422No allowed method could get the data, or a playbook failed. Not charged.
429host_rate_limitedWe're pacing requests to that site (see Acceptable use). Not charged. Retry after retryAfterSec.
429rate_limitedYour organization sent too many requests. Wait retryAfterSec
451blocked_by_policyThe request is outside our acceptable-use policy; category says why. Not charged.
500Our fault. Share the requestId with support

Rate limits

The default is 120 requests per minute per organization, shared across all of its keys. Need more? Talk to us.

Billing

  • Prepaid credits. A request runs only if your balance covers its worst-case price. You're then charged the actual price, only on success.
  • Spend controls. Set an org monthly limit and per-key monthly limits in the dashboard. Requests that would exceed them get 402.
  • Alerts. You're notified (in-app and by webhook) when the balance drops below your threshold or spend passes 80% of the monthly limit.
  • Auto-recharge. After your first card top-up, top up automatically when the balance runs low.
  • Enterprise. Postpaid credit limits and invoicing. Contact sales.