{"openapi":"3.1.0","info":{"title":"AgentDocs","version":"0.2.0","description":"PDF extraction for AI agents. Missing/uncertain fields return null. x402 v2 USDC payment; obtain current network, recipient and price from the 402 challenge. Reuse the identical payment, PDF and random Idempotency-Key on retries. Do not generate another payment on an ambiguous timeout."},"servers":[{"url":"https://agentdocs-dev.agentdocs.workers.dev"}],"paths":{"/health":{"get":{"responses":{"200":{"description":"Process health only"}}}},"/v1/payments/info":{"get":{"responses":{"200":{"description":"Current payment configuration; mainnet_enabled must be true for real purchases"}}}},"/v1/extract":{"post":{"summary":"Extract one PDF","operationId":"extractPdf","parameters":[{"in":"header","name":"Idempotency-Key","description":"Required for paid requests; random UUID or 32–128 letters/digits/hyphen/underscore. Keep unchanged on retries.","schema":{"type":"string","minLength":32,"maxLength":128}},{"in":"header","name":"PAYMENT-SIGNATURE","description":"Base64 x402 v2 exact EIP-3009 payload. Omit on first request to receive PAYMENT-REQUIRED.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"Structured extraction; PAYMENT-RESPONSE carries the settlement receipt on paid requests"},"400":{"description":"Invalid PDF or missing idempotency key"},"402":{"description":"Payment required/declined; PAYMENT-REQUIRED contains the x402 v2 challenge"},"409":{"description":"Payment in progress, replay conflict, expired result or reconciliation required. Do not sign another payment automatically."},"413":{"description":"Upload exceeds limit"},"415":{"description":"application/pdf required"},"422":{"description":"Page/cost limit exceeded; no settlement attempted"},"429":{"description":"Rate or AI budget limit reached"},"502":{"description":"Document extraction failed"},"503":{"description":"Service/payment unavailable or settlement outcome unknown; reconcile before paying again"}}}},"/v1/extract-json":{"post":{"summary":"Extract one PDF from base64 JSON (Bazaar discoverable)","operationId":"extractPdfJson","parameters":[{"in":"header","name":"Idempotency-Key","description":"Required for paid requests; random UUID or 32–128 letters/digits/hyphen/underscore. Keep unchanged on retries.","schema":{"type":"string","minLength":32,"maxLength":128}},{"in":"header","name":"PAYMENT-SIGNATURE","description":"Base64 x402 v2 exact EIP-3009 payload. Omit on first request to receive PAYMENT-REQUIRED.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"pdf_base64":{"type":"string","contentEncoding":"base64","contentMediaType":"application/pdf","maxLength":1398104,"description":"One PDF, at most 1 MiB and 3 pages, encoded as standard base64 without a data URL prefix."}},"required":["pdf_base64"],"additionalProperties":false}}}},"responses":{"200":{"description":"Structured extraction; PAYMENT-RESPONSE carries the settlement receipt on paid requests"},"400":{"description":"Invalid base64 JSON, PDF or idempotency key"},"402":{"description":"Payment required/declined; PAYMENT-REQUIRED contains the x402 v2 challenge"},"409":{"description":"Payment in progress, replay conflict, expired result or reconciliation required. Do not sign another payment automatically."},"413":{"description":"Upload exceeds limit"},"415":{"description":"application/json required"},"422":{"description":"Page/cost limit exceeded; no settlement attempted"},"429":{"description":"Rate or AI budget limit reached"},"502":{"description":"Document extraction failed"},"503":{"description":"Service/payment unavailable or settlement outcome unknown; reconcile before paying again"}}}}}}