# MicroPDF > PDF extraction API for agents. Native text and printed English OCR to Markdown and page-organized JSON. Public x402 beta uses Base Sepolia test USDC, not mainnet money. API: https://api.micropdf.dev Website: https://micropdf.dev ## Integration resources - [Guide](https://micropdf.dev/docs/): Runnable x402 and API-key workflows, limits, errors, and recovery. - [Release OpenAPI](https://micropdf.dev/openapi.json): Schema published with this website release. - [Live OpenAPI](https://api.micropdf.dev/openapi.json): Deployed API contract. - [Capabilities](https://api.micropdf.dev/v1/capabilities): Current authentication methods, limits, and prices. - [TypeScript example](https://micropdf.dev/examples/extract.ts): Node.js 24; see guide for pinned packages and environment. Saves timeout recovery privately. Requires a funded test wallet and spending policy. - [Sample PDF](https://micropdf.dev/samples/report.pdf), [actual JSON](https://micropdf.dev/samples/report.json), [Markdown](https://micropdf.dev/samples/report.md). - [Billing](https://micropdf.dev/billing/), [Support](https://micropdf.dev/contact/), [Privacy](https://micropdf.dev/privacy/), [Terms](https://micropdf.dev/terms/), [Status](https://micropdf.dev/status/), [Changelog](https://micropdf.dev/changelog/). ## One-call extraction POST /v1/extract with multipart file or JSON {"url":"https://example.com/report.pdf"}. Query: mode=sync|async (default sync), format=json|markdown (default json), ocr=auto|never (default auto), pages=1,3 (one-based; omit for all). Sync returns 200 with results; async returns 202 with operation metadata after authorization. Sync never silently switches to async. JSON sync responses include operation; async returns the operation directly. Markdown responses expose recovery headers. Anonymous x402: save a secret random UUIDv4 Idempotency-Key before sending. Use @x402/fetch to handle 402 PAYMENT-REQUIRED and replay identical input/options/key with PAYMENT-SIGNATURE. Validate exact EVM scheme, eip155:84532, test USDC asset, intended recipient, resource URL and amount against your spending cap. Never send MicroPDF a private key. Use the returned document token as Authorization: Bearer for status, result, inspection, and deletion. Account keys: operator-provisioned mp_live_ keys use Authorization: Bearer on every request. There is no public signup or checkout. Account keys accept 8–128 safe idempotency characters (letters/digits/dot/underscore/colon/hyphen); retries are scoped to the account and survive key rotation. No anonymous recovery token is returned. Use the account key for status/results. Never combine it with PAYMENT-SIGNATURE. Scopes: documents:read, documents:write, documents:delete, usage:read. GET /v1/account returns available page balance and limits. GET /v1/account/usage?limit=50 returns entries and nextCursor; pass nextCursor as before for more entries. ## Billing x402 quotes: currently 1000 atomic USDC per selected page (0.001 test USDC), same price for native/OCR. Quote is authoritative; expires after 15 minutes or earlier document expiry. x402 refunds are not automatic. Account credits: reserve one per selected page, charge successful pages, release failed-page reservations. 402 INSUFFICIENT_CREDITS has no payment challenge: replenish credits and retry the original operation. Inspection is unpaid and rate-limited. Anonymous x402 has no prepaid balance. No subscriptions or automatic top-ups. ## Limits and recovery Full document: 20 MB / 50 pages. Sync: 5 MB / 10 selected pages / 3 automatically detected OCR pages. Sync waits up to 25 seconds after authorization, in addition to upload, inspection, and payment time. 503 SYNC_BUSY rejects capacity before payment. 409 SYNC_TIMEOUT means processing continues: retry the exact original request/key or GET statusUrl then resultUrl with the original credential. Do not pay again. The TypeScript example saves error operation metadata in .micropdf-.json with private permissions. Poll every 2 seconds initially, backing off to 10 seconds. Honor Retry-After on 429. Stop on failed or 410. Default account limits: 5 pending jobs and 120 requests/minute; upload endpoint: 5/minute. Anonymous limits may be shared behind a proxy. PAYMENT_PENDING or PAYMENT_UNCERTAIN: stop creating payments and contact support with quote ID and transaction reference. Never include tokens, signatures, wallet secrets or anonymous recovery keys in support requests. A changed input/options combination with the same key returns IDEMPOTENCY_CONFLICT. URL retries reuse the initial fetched snapshot. A new operation needs a new key; do not create one to bypass uncertainty about a previous payment. ## Advanced workflow 1. POST /v1/documents: upload/inspect only; extraction has not started. Returns id, documentUrl, quoteUrl, inspection, expiresAt; anonymous requests also receive token. 2. POST /v1/documents/{id}/quotes with credential and optional {"pages":[1,2],"ocr":"auto"}. 3. POST returned executeUrl with credential and stable Idempotency-Key. Account keys reserve credits; anonymous requests follow x402 challenge/sign/retry. 4. GET statusUrl until succeeded or failed. Job ID equals quote ID. 5. GET resultUrl as returned; check partial, page methods and warnings. One-call operation links already include the selected format. If changing it, replace the format query parameter rather than appending a second one. 6. DELETE /v1/documents/{id} to revoke access and remove live content early. All returned URLs are credential-free; provide credentials in Authorization headers. ## Output and data handling JSON pages represent PDF pages, not cursor pagination. Coordinates are PDF points with top-left origin. Native text, OCR and failed pages have explicit methods. Layout/tables are heuristic. Handwriting, complex formulas, image descriptions and semantic accuracy are not guaranteed. Text inside images on otherwise text-rich pages may be omitted. Content expires 24 hours after original upload, including queued work. Ordinary tombstones remain up to 30 days after expiry; unresolved payments until reconciled. Account/usage records outlive content expiry. Logs and backups have separate policies. DELETE is not a promise of immediate erasure from every backup. See Privacy and Security pages.