{"openapi":"3.1.0","info":{"title":"Agent402","version":"0.1.0","summary":"High-accuracy intelligence for AI agents. Pay per request via x402 (HTTP 402 + USDC).","description":"Agent402 sells three intelligence services to AI agents, charged per request via the\n**x402 protocol** — HTTP 402 with USDC on eip155:8453.\n\nNo accounts, no API keys, no subscriptions. Your agent pays only for what it uses.\n\n## x402 Payment Flow\n\n1. **Request without payment** — `POST` to any paid endpoint. Receive `402 Payment Required`\n   with exact requirements in both the JSON body and the `PAYMENT-REQUIRED` response header\n   (base64-encoded x402 `PaymentRequired` object). Capture the `transaction_id`.\n\n2. **Pay and retry** — Sign a USDC EIP-3009 authorization matching those requirements\n   (scheme `exact`, network `eip155:8453`, exact amount, exact payTo).\n   Retry the **identical** request body with your signed payload base64-encoded in the\n   `PAYMENT-SIGNATURE` header. The `@x402/fetch` npm package handles this automatically.\n\n3. **Receive result** — The facilitator verifies the payment, the service runs under a hard\n   cost budget, and settlement happens on-chain only after work succeeds. The response\n   includes your result plus a settlement transaction hash.\n\n## Key Constraints\n\n- A payment is bound to the exact service + request body that generated the quote.\n- Each payment is consumed exactly once. Replaying an identical payment returns the cached\n  result (`replayed: true`) at no extra charge.\n- Work halts if fulfillment would exceed the cost budget; payment is never settled in that case.\n\n## Network\n\n**Mode:** `production` — Base mainnet (eip155:8453) — real USDC payments  \n**Asset:** USDC (6 decimal places — amounts in 402 responses are in atomic units)  \n**Facilitator:** https://api.cdp.coinbase.com/platform/v2/x402\n\n## Client Library (recommended)\n\n```bash\nnpm install @x402/fetch @x402/core @x402/evm viem\n```\n\n```typescript\nimport { wrapFetchWithPayment } from \"@x402/fetch\";\nimport { x402Client } from \"@x402/core/client\";\nimport * as evmClient from \"@x402/evm/exact/client\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nconst signer = privateKeyToAccount(process.env.PAYER_PRIVATE_KEY as `0x${string}`);\nconst client = new x402Client();\nevmClient.registerExactEvmScheme(client, { signer });\nconst fetchWithPay = wrapFetchWithPayment(fetch, client);\n\n// Call any paid endpoint — 402 + payment handled automatically:\nconst res = await fetchWithPay(\"https://402agent.ai/agent402/api/v1/verify\", {\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({ claim: \"...\" }),\n});\nconsole.log(await res.json());\n```","contact":{"name":"Agent402","url":"https://402agent.ai/agent402"},"x-payment-protocol":{"protocol":"x402","x402_version":2,"scheme":"exact","network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","mode":"production","facilitator":"https://api.cdp.coinbase.com/platform/v2/x402","request_header":"PAYMENT-REQUIRED","signature_header":"PAYMENT-SIGNATURE","client_library":"npm:@x402/fetch","note":"Production mode — uses Base mainnet USDC."}},"servers":[{"url":"https://402agent.ai/agent402","description":"Agent402 (production — eip155:8453)"}],"paths":{"/api/v1/health":{"get":{"operationId":"getHealth","tags":["Discovery"],"summary":"Service health and payment mode","description":"Returns service status, version, and current payment mode. No payment required.","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"status":"ok","service":"agent402","version":"0.1.0","payment_mode":"production","time":"2026-10-06T22:44:33.263Z"}}}}}}},"/api/v1/pricing":{"get":{"operationId":"getPricing","tags":["Discovery"],"summary":"Live per-request prices","description":"Returns current prices for all services in USD. Actual amounts in 402 Payment Required responses are in atomic USDC units (multiply USD × 1,000,000). Prices may vary slightly based on real-time cost estimates.","responses":{"200":{"description":"Current pricing for all services","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingResponse"},"example":{"pricing":[{"service":"search","price_usd":0.157,"payment_asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","payment_network":"eip155:8453","payment_mode":"production"},{"service":"read","price_usd":0.047,"payment_asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","payment_network":"eip155:8453","payment_mode":"production"},{"service":"verify","price_usd":0.282,"payment_asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","payment_network":"eip155:8453","payment_mode":"production"}],"note":"Prices are quoted per request via HTTP 402 payment requirements."}}}}}}},"/api/v1/services":{"get":{"operationId":"getServices","tags":["Discovery"],"summary":"Machine-readable service discovery document","description":"Complete service metadata including payment protocol, network, all service endpoints, and current pricing. The canonical discovery document for agents — parse this first to understand available services and how to pay. 402 responses from paid endpoints also embed the official x402 Bazaar discovery extension.","responses":{"200":{"description":"Service discovery document","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServicesDiscovery"}}}}}}},"/api/v1/search":{"post":{"operationId":"search","tags":["Paid Services"],"summary":"Web search — current, ranked, tiered results","description":"Returns current, relevant results for a query — ranked, deduplicated, and tiered by source quality, with publication timestamps where available.\n\n**Price:** ~$0.157 per request  \n**Payment:** x402 — call without `PAYMENT-SIGNATURE` to receive a 402 quote, then retry with payment.","x-price-usd":0.157,"x-x402-required":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"},"example":{"query":"latest NVIDIA earnings announcement"}}}},"responses":{"200":{"description":"Search results (payment accepted and settled on-chain)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchSuccessResponse"}}}},"400":{"description":"Invalid request body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Payment required (x402). Decode the PAYMENT-REQUIRED header or parse the JSON body to get exact payment requirements, then retry with PAYMENT-SIGNATURE.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 PaymentRequired object. Use @x402/core/http decodePaymentRequiredHeader() to decode.","schema":{"type":"string"},"required":true}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequired"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal error or cost budget exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Request cannot be served profitably right now (UNPROFITABLE_REQUEST).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/read":{"post":{"operationId":"read","tags":["Paid Services"],"summary":"Read and extract structured content from a URL","description":"Fetches a public URL and returns structured extraction: title, summary, key points, and stated facts kept separate from inference.\n\n**SSRF protection:** Only public http/https URLs are accepted. Private network ranges (RFC 1918, loopback, link-local) and non-HTTP schemes are rejected.\n\n**Price:** ~$0.047 per request  \n**Payment:** x402 — call without `PAYMENT-SIGNATURE` to receive a 402 quote, then retry with payment.","x-price-usd":0.047,"x-x402-required":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadRequest"},"example":{"url":"https://example.com/article"}}}},"responses":{"200":{"description":"Extracted content (payment accepted and settled on-chain)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadSuccessResponse"}}}},"400":{"description":"Invalid request body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Payment required (x402). Decode the PAYMENT-REQUIRED header or parse the JSON body to get exact payment requirements, then retry with PAYMENT-SIGNATURE.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 PaymentRequired object. Use @x402/core/http decodePaymentRequiredHeader() to decode.","schema":{"type":"string"},"required":true}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequired"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal error or cost budget exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Request cannot be served profitably right now (UNPROFITABLE_REQUEST).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/verify":{"post":{"operationId":"verify","tags":["Paid Services"],"summary":"Fact-check a claim with evidence-weighted verdicts","description":"Returns an evidence-weighed verdict on a claim. Verdicts are honest: `INSUFFICIENT_EVIDENCE` and `CONFLICTING_EVIDENCE` are returned when the evidence warrants it — the service never forces a verdict when the evidence doesn't support one.\n\nVerdicts:\n- `VERIFIED` — strong supporting evidence, no significant contradiction\n- `NOT_VERIFIED` — evidence contradicts the claim\n- `INSUFFICIENT_EVIDENCE` — not enough reliable sources to decide\n- `CONFLICTING_EVIDENCE` — credible sources disagree\n\n**Price:** ~$0.282 per request  \n**Payment:** x402 — call without `PAYMENT-SIGNATURE` to receive a 402 quote, then retry with payment.","x-price-usd":0.282,"x-x402-required":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"},"example":{"claim":"The James Webb Space Telescope launched in December 2021"}}}},"responses":{"200":{"description":"Verification result (payment accepted and settled on-chain)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifySuccessResponse"}}}},"400":{"description":"Invalid request body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Payment required (x402). Decode the PAYMENT-REQUIRED header or parse the JSON body to get exact payment requirements, then retry with PAYMENT-SIGNATURE.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 PaymentRequired object. Use @x402/core/http decodePaymentRequiredHeader() to decode.","schema":{"type":"string"},"required":true}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequired"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal error or cost budget exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Request cannot be served profitably right now (UNPROFITABLE_REQUEST).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string"},"version":{"type":"string"},"payment_mode":{"type":"string","enum":["test","testnet","production"]},"time":{"type":"string","format":"date-time"}},"required":["status","service","version","payment_mode","time"]},"PricingResponse":{"type":"object","properties":{"pricing":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string","enum":["search","read","verify"]},"price_usd":{"type":"number","description":"Approximate price in USD"},"payment_asset":{"type":"string"},"payment_network":{"type":"string"},"payment_mode":{"type":"string"}},"required":["service","price_usd","payment_asset","payment_network","payment_mode"]}},"note":{"type":"string"}},"required":["pricing"]},"ServicesDiscovery":{"type":"object","description":"Canonical discovery document. Parse to discover all services, pricing, and payment requirements.","properties":{"name":{"type":"string"},"tagline":{"type":"string"},"payment":{"type":"object","description":"x402 payment protocol configuration","properties":{"protocol":{"type":"string","enum":["x402"]},"x402_version":{"type":"integer","enum":[2]},"scheme":{"type":"string","enum":["exact"]},"asset":{"type":"string"},"network":{"type":"string"},"mode":{"type":"string"},"facilitator":{"type":"string","nullable":true},"payment_header":{"type":"string"},"note":{"type":"string"}}},"services":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string"},"method":{"type":"string","enum":["POST"]},"url":{"type":"string"},"price_usd":{"type":"number"},"input":{"type":"object"},"output_fields":{"type":"array","items":{"type":"string"}}}}},"endpoints":{"type":"object","properties":{"health":{"type":"string"},"pricing":{"type":"string"},"docs":{"type":"string"},"openapi":{"type":"string"}}}}},"PaymentRequired":{"type":"object","description":"x402 payment requirement. Also base64-encoded in the PAYMENT-REQUIRED response header. Pass the decoded object to @x402/fetch or build a PAYMENT-SIGNATURE manually.","properties":{"transaction_id":{"type":"string","description":"Opaque per-quote ID. The payment is bound to the exact service + request body that generated it. Retrying with a different body requires a new quote.","example":"tx_a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"x402Version":{"type":"integer","enum":[2]},"resource":{"type":"string","description":"Canonical URL of the paid resource."},"accepts":{"type":"array","description":"Ordered list of accepted payment schemes. Use the first matching one.","items":{"type":"object","properties":{"scheme":{"type":"string","enum":["exact"]},"network":{"type":"string","description":"CAIP-2 network identifier.","example":"eip155:8453"},"payTo":{"type":"string","description":"Recipient wallet address (checksummed EVM hex)."},"asset":{"type":"string","description":"USDC contract address on the payment network."},"amount":{"type":"string","description":"Exact payment amount in atomic USDC units (6 decimal places). Divide by 1,000,000 for the USD value.","example":"282000"}},"required":["scheme","network","payTo","asset","amount"]}}},"required":["transaction_id","x402Version","accepts"]},"Settlement":{"type":"object","description":"On-chain settlement details. Present only when replayed is false.","properties":{"transactionHash":{"type":"string","description":"Settlement transaction hash on the payment network.","example":"0x4fba7298581e89e4b5dc8d5fde65ca9df4600a6ddbbc2f7dd41da73ef9d5654d"},"network":{"type":"string","description":"CAIP-2 network where settlement occurred.","example":"eip155:8453"}},"required":["transactionHash","network"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["INVALID_REQUEST","PAYMENT_NOT_VERIFIED","PAYMENT_FAILED","NOT_FOUND","RATE_LIMITED","BUDGET_EXCEEDED","UNPROFITABLE_REQUEST","INTERNAL_ERROR"]},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"SearchRequest":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":2000,"description":"Search query (1–2000 characters)"}},"required":["query"]},"SearchResult":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string","format":"uri"},"snippet":{"type":"string"},"source_tier":{"type":"integer","description":"Source quality tier (1 = highest quality primary source)"},"published_date":{"type":"string","nullable":true}},"required":["title","url","snippet"]},"SearchResult_Result":{"type":"object","properties":{"service":{"type":"string","enum":["search"]},"results":{"type":"array","items":{"$ref":"#/components/schemas/SearchResult"}},"sources":{"type":"array","items":{"type":"string"}},"generated_at":{"type":"string","format":"date-time"}},"required":["service","results","sources","generated_at"]},"SearchSuccessResponse":{"type":"object","properties":{"transaction_id":{"type":"string"},"replayed":{"type":"boolean","description":"True when this payment was already consumed and the cached result is returned. No additional charge; settlement is not included."},"settlement":{"type":"object","description":"On-chain settlement details. Present only when replayed is false.","properties":{"transactionHash":{"type":"string","description":"Settlement transaction hash on the payment network.","example":"0x4fba7298581e89e4b5dc8d5fde65ca9df4600a6ddbbc2f7dd41da73ef9d5654d"},"network":{"type":"string","description":"CAIP-2 network where settlement occurred.","example":"eip155:8453"}},"required":["transactionHash","network"],"nullable":true},"result":{"$ref":"#/components/schemas/SearchResult_Result"}},"required":["transaction_id","replayed","result"],"description":"Successful search response with settlement proof"},"ReadRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":4000,"description":"Public http/https URL to fetch. Private network ranges are blocked (SSRF protection)."}},"required":["url"]},"ReadResult_Result":{"type":"object","properties":{"service":{"type":"string","enum":["read"]},"title":{"type":"string"},"summary":{"type":"string","description":"High-level summary of the page content"},"key_points":{"type":"array","items":{"type":"string"}},"extracted_facts":{"type":"array","items":{"type":"string"},"description":"Stated facts only — inference is kept separate"},"source_url":{"type":"string","format":"uri"}},"required":["service","title","summary","source_url"]},"ReadSuccessResponse":{"type":"object","properties":{"transaction_id":{"type":"string"},"replayed":{"type":"boolean","description":"True when this payment was already consumed and the cached result is returned. No additional charge; settlement is not included."},"settlement":{"type":"object","description":"On-chain settlement details. Present only when replayed is false.","properties":{"transactionHash":{"type":"string","description":"Settlement transaction hash on the payment network.","example":"0x4fba7298581e89e4b5dc8d5fde65ca9df4600a6ddbbc2f7dd41da73ef9d5654d"},"network":{"type":"string","description":"CAIP-2 network where settlement occurred.","example":"eip155:8453"}},"required":["transactionHash","network"],"nullable":true},"result":{"$ref":"#/components/schemas/ReadResult_Result"}},"required":["transaction_id","replayed","result"],"description":"Successful read response with settlement proof"},"VerifyRequest":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":4000,"description":"The claim to fact-check (1–4000 characters)"}},"required":["claim"]},"EvidenceItem":{"type":"object","properties":{"tier":{"type":"string","description":"Source quality tier (A = primary/authoritative)"},"quote":{"type":"string"},"stance":{"type":"string","enum":["supports","contradicts","neutral"]},"statement":{"type":"string"},"source_url":{"type":"string","format":"uri"},"published_date":{"type":"string","nullable":true}},"required":["tier","quote","stance","statement","source_url"]},"VerifyResult_Result":{"type":"object","properties":{"service":{"type":"string","enum":["verify"]},"claim":{"type":"string"},"verdict":{"type":"string","enum":["VERIFIED","NOT_VERIFIED","INSUFFICIENT_EVIDENCE","CONFLICTING_EVIDENCE"],"description":"Evidence-weighted verdict. Honest: INSUFFICIENT_EVIDENCE and CONFLICTING_EVIDENCE are returned when the evidence warrants it rather than forcing a binary answer."},"confidence":{"type":"number","minimum":0,"maximum":1,"description":"Confidence score (0–1). Reflects source quality, agreement, recency, and coverage."},"summary":{"type":"string"},"supporting_evidence":{"type":"array","items":{"$ref":"#/components/schemas/EvidenceItem"}},"contradictory_evidence":{"type":"array","items":{"$ref":"#/components/schemas/EvidenceItem"}},"sources":{"type":"array","items":{"type":"object"}},"source_count":{"type":"integer"},"primary_source_found":{"type":"boolean"},"generated_at":{"type":"string","format":"date-time"}},"required":["service","claim","verdict","confidence","generated_at"]},"VerifySuccessResponse":{"type":"object","properties":{"transaction_id":{"type":"string"},"replayed":{"type":"boolean","description":"True when this payment was already consumed and the cached result is returned. No additional charge; settlement is not included."},"settlement":{"type":"object","description":"On-chain settlement details. Present only when replayed is false.","properties":{"transactionHash":{"type":"string","description":"Settlement transaction hash on the payment network.","example":"0x4fba7298581e89e4b5dc8d5fde65ca9df4600a6ddbbc2f7dd41da73ef9d5654d"},"network":{"type":"string","description":"CAIP-2 network where settlement occurred.","example":"eip155:8453"}},"required":["transactionHash","network"],"nullable":true},"result":{"$ref":"#/components/schemas/VerifyResult_Result"}},"required":["transaction_id","replayed","result"],"description":"Successful verification response with settlement proof"}}},"tags":[{"name":"Discovery","description":"Free endpoints — no payment required. Use these to discover services, pricing, and capabilities."},{"name":"Paid Services","description":"x402-gated endpoints. Call without payment to receive a 402 quote, then retry with a PAYMENT-SIGNATURE header containing a signed USDC EIP-3009 authorization."}]}