# PageToAPI > Web data for AI agents. Send a URL and what you need; get clean JSON back. JavaScript rendering, blocking and captchas are handled for you, with built-in support for major retailers and social platforms. Credits are used only when a request succeeds. Full documentation as plain text: https://pagetoapi.com/llms-full.txt ## Get a key POST https://pagetoapi.com/v1/signup {"email":"you@company.com"} -> {"apiKey"}. We email a confirmation link; $1 of free credit is added once it is confirmed. Keys can also be created in the dashboard at https://pagetoapi.com/app (one per agent is recommended). ## Auth - API key as a bearer token: `Authorization: Bearer pta_live_…` (or `X-API-Key: pta_live_…`). - MCP clients that support OAuth (Claude, ChatGPT) sign in on their own; discovery at https://pagetoapi.com/.well-known/oauth-protected-resource/mcp - Missing or invalid key: 401 with code "unauthorized". ## MCP server - URL (Streamable HTTP): https://pagetoapi.com/mcp - Setup guide for Claude, ChatGPT, Cursor and Claude Code (OAuth or API key): https://pagetoapi.com/docs/mcp - Tools: get_data, quote, schedule_data, usage - Claude Code: claude mcp add --transport http pagetoapi https://pagetoapi.com/mcp --header "Authorization: Bearer $PAGETOAPI_KEY" ## Main endpoints - POST https://pagetoapi.com/v1/extract {"url", "ask"?, "fields"?, "schema"?, "maxCredits"?, "maxAgeSec"?, "render"?, "storeId"?, "zip"?} -> result in one call (200 ok, 422 failed and not charged) - POST https://pagetoapi.com/v1/jobs (same body) -> 202 {id}; GET /v1/jobs/{id} to poll, GET /v1/jobs/{id}/events for server-sent events - POST https://pagetoapi.com/v1/quote -> credits a request would use, before running it - POST/GET https://pagetoapi.com/v1/schedules -> run a request on a schedule, results by webhook - GET https://pagetoapi.com/v1/account (balance and usage), POST /v1/keys, DELETE /v1/keys/{key} - GET https://pagetoapi.com/v1/pricing (no key needed), GET /v1/policy - Acceptable use: public pages only. No login/account/checkout pages, people-search, adult or patient-portal sites, or requests for sensitive personal data; robots.txt is honoured on generic fetches. Refused requests return 451 "blocked_by_policy" and are not charged. - Docs: https://pagetoapi.com/docs MCP setup: https://pagetoapi.com/docs/mcp Pricing: https://pagetoapi.com/pricing Agent card: https://pagetoapi.com/.well-known/agent-card.json ## Pricing (credits; $1 = 1,000 credits, no subscription) - Standard page: 1 credit - Social profile or post: 3 credits - JavaScript page: 5 credits - Protected page: 20 credits - AI extraction is included. Failed requests use 0 credits. New accounts get 1000 free credits after confirming their email. - Spending caps: pass maxCredits per request; set a monthly limit per API key (per agent) and per organization. --- # PageToAPI documentation ## Quickstart PageToAPI turns any public URL into JSON for your agent. Send the URL and say what you need. We handle the fetching and extraction, and you only use credits when you get a result. ### 1. Get an API key Create an account in the [dashboard](https://pagetoapi.com/app/#/signup), or let your agent sign itself up: ``` curl -X POST https://pagetoapi.com/v1/signup \ -H "Content-Type: application/json" \ -d '{"email":"you@company.com"}' # → { "accountId": "acct_…", "apiKey": "pta_live_…", "credits": 0, "freeCreditsOnVerify": 1000 } ``` We email the address a confirmation link. New accounts get **1,000 free credits** 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 https://pagetoapi.com/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 https://pagetoapi.com/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](https://pagetoapi.com/app/#/keys), one per agent or environment. Each can have its own monthly limit. - **Self-serve signup.** `POST /v1/signup {"email"}` creates an organization and returns a key. The 1,000 free credits are 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://news.ycombinator.com/", "data": { "stories": [ { "title": "…", "points": 312 } ] }, "credits": 1, // credits used by this request "method": "standard", // standard | social | javascript | protected "cached": false, "fetchedAt": "2026-11-26T…Z", "requestId": "req_…", "jobId": "job_…" } ``` A failed result has `ok: false`, `credits: 0`, an `error` message and a `code`, plus `category` and `retryAfterSec` when they apply. Results served from a recent identical request include `"cached": true`. 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 we couldn't get the data. A 422 uses no credits. | Parameter | Type | Description | | --- | --- | --- | | `url` | string | **Required.** Public http(s) URL. Private and internal addresses are rejected. | | `ask` | string | What you want, in plain language. | | `fields` | string[] | Exact keys to return, e.g. `["title","price","in_stock"]`. Common product fields are filled from structured data without any AI call. | | `schema` | object | JSON Schema the AI extraction must follow exactly. | | `maxCredits` | number | Most credits this request may use. Methods that would cost more are skipped. Without it, a request can use up to 20 credits. | | `maxAgeSec` | number | Accept a cached result up to this age. Default `3600`; `0` forces a fresh fetch. | | `render` | boolean | Treat the page as JavaScript-heavy from the start (5 credits). Usually not needed: we detect it. | | `storeId` | string | Store id for store-level price and stock on supported retailers. | | `zip` | string | ZIP code for local availability where supported. | ``` curl https://pagetoapi.com/v1/extract \ -H "Authorization: Bearer $PAGETOAPI_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html", "fields": ["title", "price", "availability"], "maxCredits": 5 }' ``` ## 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": { "credits": 1, "maxCredits": 20, "method": "standard", "cached": false } } ``` `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`, `t` (ms since start) and a plain-language `message`. | Event | Meaning | | --- | --- | | `received` | Request accepted (`url`) | | `cache_hit` | Served from a recent identical request (`ageSec`) | | `step` | A progress note, e.g. using a direct data source for the site | | `attempt` · `blocked` · `success` | Fetching the page, switching to a stronger method, and the page fetched (`method`, `ms` on success) | | `captcha` · `captcha_result` | A captcha was found and handled (`ok`) | | `policy_blocked` | The run stopped for a policy reason found while running: robots.txt or per-site pacing (`category`). Uses no credits | | `extracting` · `extracted` | Reading your data out of the page | | `done` | Final `result`, the same shape as `/v1/extract` | ``` curl -N https://pagetoapi.com/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 credits, spend limits and the [acceptable-use policy](https://pagetoapi.com/docs#acceptable-use) apply exactly as they do to `/v1/extract`. Only successful runs use credits. Manage schedules in the [dashboard](https://pagetoapi.com/app/#/schedules) or with the API below. `POST /v1/schedules` ``` curl https://pagetoapi.com/v1/schedules \ -H "Authorization: Bearer $PAGETOAPI_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "Book price", "every": "daily", "at": "07:00", "request": {"url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html", "fields": ["price", "availability"]}}' ``` | Field | Type | Description | | --- | --- | --- | | `request` | object | Required. The request to repeat: `url` plus any of `ask`, `fields`, `schema`, `maxCredits`, `render`, `storeId`, `zip`. Checked against the acceptable-use policy when you create it (blocked URLs return `451`). | | `every` | string | `hourly`, `daily` (default), `weekly` or `interval`. | | `at` | string | `HH:MM` in UTC for `daily` and `weekly` (default `07:00`). For `hourly`, only the minute is used. | | `weekday` | number | For `weekly`: `0` Sunday through `6` Saturday (default `1`, Monday). | | `intervalMinutes` | number | For `interval`: minutes between runs, at least 15. | | `name` | string | Optional label; defaults to the site's hostname. | The response includes `cadence` in plain words, `nextRunAt`, and `estimate`: `{ creditsPerRun, creditsPerMonth }`, the expected credits for that site. `GET /v1/schedules` `GET /v1/schedules/{id}` The schedule plus its last 20 runs, each with `ok`, `credits`, `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](https://pagetoapi.com/docs#webhooks) as a `schedule.run` event: `{ scheduleId, name, manual, ok, data, credits, requestId, error }`. Runs also appear in Requests with the key `schedule`. - A successful run uses credits 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 credits for a request without running it. Agents can use it to decide whether to buy. ``` { "url": "…", "credits": 1, "maxCredits": 20, // expected, and the most it can use "method": "standard", "cached": false, "note": "Credits are used only if the request succeeds. AI extraction is included." } ``` Before running any request, your balance must cover `maxCredits`. Pass `maxCredits` on the request to lower it. ## Account & keys `GET /v1/account` Returns `{ credits, last30d: { requests, successes, creditsUsed }, keys }`: your credit balance, the last 30 days of usage 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 the credits each kind of page uses. **$1 = 1,000 credits.** AI extraction is included, and failed requests use no credits. | Kind of page | `method` | Credits | | --- | --- | --- | | Standard page | `standard` | 1 | | Social profile or post | `social` | 3 | | JavaScript page | `javascript` | 5 | | Protected page | `protected` | 20 | ``` { "unit": "credit", "usdPerCredit": 0.001, "creditsPerDollar": 1000, "creditsPerResult": { "standard": 1, "social": 3, "javascript": 5, "protected": 20 }, "labels": { … }, "freeCredits": 1000, "failedRequests": 0 } ``` ## Connect Claude or ChatGPT Add PageToAPI to your AI assistant and ask for web data in plain language. No API key to copy: you sign in to PageToAPI once and choose which organization's credits it uses. - **Claude** (claude.ai, Claude Desktop, Claude mobile): **Settings → Connectors → Add custom connector**, then paste `https://pagetoapi.com/mcp`. - **ChatGPT**: **Settings → Apps → Create app** (developer mode), then paste `https://pagetoapi.com/mcp` and choose OAuth. - **Claude Code**: `claude mcp add --transport http pagetoapi https://pagetoapi.com/mcp`, then run `/mcp` to sign in. Then try: "What's the price and stock of this product? " or "Check this TikTok profile's follower count every morning." Each connection appears in [Keys](https://pagetoapi.com/app#/keys) as a named key, such as Claude connection. Give it its own monthly credit limit, or revoke it to disconnect. Only owners, admins and developers can connect apps. Step-by-step setup for every client, with OAuth and API-key options: [MCP server setup](https://pagetoapi.com/docs/mcp). For developers: standard MCP authorization (OAuth 2.1 with PKCE, dynamic client registration and client ID metadata documents). Discovery is at `https://pagetoapi.com/.well-known/oauth-protected-resource/mcp`. ## MCP PageToAPI is a remote MCP server over Streamable HTTP at `https://pagetoapi.com/mcp` ([setup guide](https://pagetoapi.com/docs/mcp)). Clients that support OAuth sign in on their own (see [Connect Claude or ChatGPT](https://pagetoapi.com/docs#connectors)). Others can send an API key as a bearer token. ``` # Claude Code claude mcp add --transport http pagetoapi https://pagetoapi.com/mcp \ --header "Authorization: Bearer $PAGETOAPI_KEY" # Claude Desktop, Cursor and other clients { "mcpServers": { "pagetoapi": { "type": "http", "url": "https://pagetoapi.com/mcp", "headers": { "Authorization": "Bearer pta_live_…" } } } } ``` | Tool | Arguments | Returns | | --- | --- | --- | | `get_data` | `url`, `ask`, `fields`, `maxCredits`, `maxAgeSec`, `storeId`, `zip` | The extract result. Errors set `isError`. | | `quote` | `url` | Expected credits and the most it can use | | `schedule_data` | `url`, `ask`, `fields`, `every`, `at`, `weekday`, `intervalMinutes`, `name` | The new schedule (see [Schedules](https://pagetoapi.com/docs#schedules)) | | `usage` | none | Credit balance, the last 30 days of usage, and schedule counts | ## Discovery - [`/.well-known/agent-card.json`](https://pagetoapi.com/.well-known/agent-card.json): an A2A agent card with skills, endpoints, auth and credits. - [`/llms.txt`](https://pagetoapi.com/llms.txt): plain-language instructions any LLM agent can follow. ## How credits work **$1 = 1,000 credits.** Each successful request uses credits based on the kind of page it turned out to be. The response tells you which in `method` and `credits`. - **Standard page, 1 credit.** Most websites and product pages. - **Social profile or post, 3 credits.** Creator profiles, posts and videos. - **JavaScript page, 5 credits.** Pages that only load in a browser. - **Protected page, 20 credits.** Pages behind heavy bot protection or captchas. AI extraction is included. Failed requests use no credits. Repeat requests for the same page answered from a recent result (`cached: true`) are free for the first 1,000 per organization each day across all your keys (resets 00:00 UTC), then 1 credit each; set `maxAgeSec: 0` to always fetch fresh. ## Retail & social data Built-in support for retail and social data returns consistent fields without any setup. - **Retail product pages.** Price, stock, promotions and fulfillment. Pass `storeId` or `zip` for store-level price and availability where supported. Online store product pages return their full variant list. - **Social profiles and posts.** Profiles, videos, reels, posts and channels on the major platforms, with live metrics. 3 credits each. When you pass `fields`, the built-in support answers only if it has all of them. Otherwise the page is read like any other. If a built-in source for a site doesn't respond, the request fails and uses no credits. ## Protected pages Bot checks and captchas are handled automatically for protected pages. There's nothing to configure. A protected page uses 20 credits, and only when it succeeds. The `captcha` and `captcha_result` events show it on the [event stream](https://pagetoapi.com/docs#jobs). ## Acceptable use PageToAPI reads **public** web pages. Some requests are refused for every customer, before anything is fetched. Refused requests never use credits. | Category | What's refused | | --- | --- | | `private_area` | Login, sign-up, account, checkout, cart, payment, inbox, admin and settings pages, and URLs carrying tokens, sessions or passwords | | `credentials` | URLs with a username or password embedded (`user:pass@host`) | | `people_search` | People-search and background-check sites, which hold personal data about private individuals | | `adult` | Adult content sites | | `patient_portals` | Patient portals, which hold protected health information | | `dark_web` | `.onion` and `.i2p` hidden services | | `sensitive_data` | Asks 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_rule` | A site we've been asked not to serve | | `org_rule` | A site your organization blocked in [Settings › Site access](https://pagetoapi.com/app/#/settings) | | `org_allowlist` | Your organization only allows listed sites, and this isn't one of them | | `robots_txt` | The 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 When we fetch a page directly, 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 retail and social support](https://pagetoapi.com/docs#playbooks) uses vetted integrations and isn'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, using no credits, 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](https://pagetoapi.com/app/#/settings). It must use https, except `http://localhost` for testing. We POST JSON events: | Event | When | | --- | --- | | `job.succeeded` / `job.failed` | An async job from `POST /v1/jobs` finishes. `data`: `{ jobId, requestId, result }` | | `schedule.run` | A [schedule](https://pagetoapi.com/docs#schedules) ran. `data`: `{ scheduleId, name, manual, ok, data, credits, requestId, error }` | | `schedule.paused` | A schedule paused itself after 5 failed runs in a row | | `balance.low` | Balance falls below your alert threshold | | `spend.limit_80` | This month's usage passes 80% of your org limit | | `recharge.failed` | An auto-recharge charge failed | | `webhook.test` | You clicked "Send test" in the dashboard | ``` { "id": "evt_…", "type": "job.succeeded", "created": 1795680000, "data": { … } } ``` ### Verifying signatures Each delivery carries `X-PageToAPI-Signature: t=,v1=`, 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"?: "…" }`. | Status | Code | Meaning | | --- | --- | --- | | `400` | `invalid_url` | Missing, malformed or private URL, or a body that isn't valid JSON | | `401` | `unauthorized` | Missing, invalid or revoked API key | | `402` | `insufficient_funds` | Not enough credits for the most this request can use (`maxCredits` in the quote), or an org or key monthly limit was reached. Add credits or pass a lower `maxCredits` | | `404` | | Unknown endpoint, or a job that doesn't exist or has expired | | `405` | | Wrong method (e.g. `GET /mcp`) | | `413` | | Request body over 1 MB | | `422` | | We couldn't get the data. **Uses no credits.** | | `429` | `host_rate_limited` | We're pacing requests to that site (see [Acceptable use](https://pagetoapi.com/docs#acceptable-use)). **Uses no credits.** Retry after `retryAfterSec`. | | `429` | `rate_limited` | Your organization sent too many requests. Wait `retryAfterSec` | | `451` | `blocked_by_policy` | The request is outside our [acceptable-use policy](https://pagetoapi.com/docs#acceptable-use); `category` says why. **Uses no credits.** | | `500` | | Our 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](https://pagetoapi.com/#contact). ## Billing - **Prepaid credits.** $1 buys 1,000 credits; buy any amount from $5. A request runs only if your balance covers the most it can use, and credits are taken 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 usage passes 80% of the monthly limit. - **Auto-recharge.** After your first card top-up, top up automatically when the balance runs low. - **Enterprise.** Volume pricing and invoicing. [Contact us](https://pagetoapi.com/#contact).