{"openapi":"3.1.0","info":{"title":"xpay — Pay-Per-Use API Tools for AI Agents","version":"1.0.0","description":"xpay gives AI agents pay-per-use access to 1,000+ API tools from 80+ providers, lets developers monetize any API or MCP server, and adds spending controls so autonomous agents never overspend.","contact":{"name":"xpay","url":"https://www.xpay.sh","email":"support@xpay.sh"},"license":{"name":"Proprietary","url":"https://www.xpay.sh/legal/terms-of-use"}},"externalDocs":{"description":"xpay Developer Documentation","url":"https://docs.xpay.sh"},"servers":[{"url":"https://mcp.xpay.sh","description":"xpay MCP Proxy — 1,000+ API tools via MCP or REST"},{"url":"https://facilitator.xpay.sh","description":"xpay x402 Facilitator — payment verification and settlement on Base"}],"tags":[{"name":"Tools","description":"Pay-per-use API tool access"},{"name":"Facilitator","description":"x402 payment verification and settlement"}],"paths":{"/mcp":{"get":{"operationId":"mcpConnection","summary":"MCP connection endpoint","description":"Connect via MCP to access 1,000+ API tools. Use as: https://mcp.xpay.sh/mcp?key=YOUR_API_KEY","tags":["Tools"],"parameters":[{"name":"key","in":"query","required":true,"schema":{"type":"string"},"description":"Your xpay API key"}],"responses":{"200":{"description":"MCP session established"}}}},"/{tool-slug}":{"post":{"operationId":"callTool","summary":"Call any tool via REST","description":"Call any of the 1,000+ tools by slug. Pass tool-specific inputs in the request body. Pay-per-call pricing.","tags":["Tools"],"parameters":[{"name":"tool-slug","in":"path","required":true,"schema":{"type":"string"},"description":"Tool slug (e.g., exa-search, hunter-email-finder)"}],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Tool-specific input parameters"}}}},"responses":{"200":{"description":"Tool execution result"},"401":{"description":"Invalid or missing API key"},"402":{"description":"Insufficient credits"}}}},"/health":{"get":{"operationId":"getHealth","summary":"Facilitator health check","description":"Returns facilitator status, wallet address, and supported networks.","tags":["Facilitator"],"responses":{"200":{"description":"Facilitator is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"status":"ok","facilitator":"0x2772F7F74ac0aCA38C6238aA5EcE72B27bEB8C17","networks":["eip155:8453","eip155:84532"],"versions":["v1","v2"]}}}}}}},"/verify":{"post":{"operationId":"verifyPayment","summary":"Verify an x402 payment","description":"Validates an x402 payment header. Checks signature, nonce, expiry, and sufficient authorization amount. Does NOT transfer funds.","tags":["Facilitator"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}},"400":{"description":"Invalid request"}}}},"/settle":{"post":{"operationId":"settlePayment","summary":"Settle an x402 payment on-chain","description":"Submits an EIP-3009 `transferWithAuthorization` transaction to move USDC from buyer to seller. Gas is sponsored by xpay (~$0.0001 on Base). Non-custodial — funds flow directly peer-to-peer.","tags":["Facilitator"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettleRequest"}}}},"responses":{"200":{"description":"Settlement result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettleResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Settlement failed"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"xpay API key"}},"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"facilitator":{"type":"string","description":"Facilitator wallet address","example":"0x2772F7F74ac0aCA38C6238aA5EcE72B27bEB8C17"},"networks":{"type":"array","items":{"type":"string"},"description":"Supported CAIP-2 network identifiers","example":["eip155:8453","eip155:84532"]},"versions":{"type":"array","items":{"type":"string"},"description":"Supported x402 protocol versions","example":["v1","v2"]}}},"VerifyRequest":{"type":"object","required":["x402Version","paymentPayload","paymentRequirements"],"properties":{"x402Version":{"type":"integer","description":"x402 protocol version (1 or 2)","example":1},"paymentPayload":{"type":"object","description":"Signed payment authorization from the buyer"},"paymentRequirements":{"type":"object","description":"Payment requirements from the seller (amount, recipient, network, etc.)"}}},"VerifyResponse":{"type":"object","properties":{"isValid":{"type":"boolean","description":"Whether the payment is valid"},"invalidReason":{"type":"string","nullable":true,"description":"Reason for rejection (null if valid)"},"payer":{"type":"string","description":"Buyer wallet address"}}},"SettleRequest":{"type":"object","required":["x402Version","paymentPayload","paymentRequirements"],"properties":{"x402Version":{"type":"integer","description":"x402 protocol version (1 or 2)","example":1},"paymentPayload":{"type":"object","description":"Signed payment authorization from the buyer"},"paymentRequirements":{"type":"object","description":"Payment requirements from the seller"}}},"SettleResponse":{"type":"object","properties":{"success":{"type":"boolean"},"txHash":{"type":"string","description":"On-chain transaction hash","nullable":true},"network":{"type":"string","description":"CAIP-2 network where settlement occurred"},"payer":{"type":"string","description":"Buyer wallet address"},"errorMessage":{"type":"string","nullable":true}}}}},"x-xpay-products":{"toolDiscovery":{"name":"Tool Discovery","description":"1,000+ API tools from 80+ providers — search, enrichment, scraping, AI models, finance. Pay-per-call, no subscriptions.","url":"https://xpay.tools","pricing":[{"tier":"Free","price":"$5 free credits on signup","limits":"Pay-per-call after credits used"}]},"smartProxy":{"name":"Smart Proxy","description":"Financial guardrails for AI agents — per-agent budgets, rate limits, allowed tools, real-time alerts","url":"https://www.xpay.sh/smart-proxy"},"paywall":{"name":"Paywall-as-a-Service","description":"Turn any API into a paid endpoint with pay-per-call pricing","url":"https://www.xpay.sh/paywall"},"mcpMonetization":{"name":"MCP Server Monetization","description":"Register your MCP server, set per-tool pricing, get a proxy endpoint listed on xpay.tools","url":"https://xpay.tools"}}}