{"openapi":"3.1.0","info":{"title":"x402 Swap API","version":"1.0.0","description":"Free quotes. One cent to build. 10 bps included when you swap."},"servers":[{"url":"https://x402swaps.com"}],"paths":{"/v1/quotes":{"post":{"operationId":"getSwapQuote","summary":"Get free all-in swap quotes","description":"No x402 payment is required. Unsafe routes are blocked. Net output includes the 10 bps service fee; affiliate is optional.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteRequest"}}}},"responses":{"200":{"description":"Quote routes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}}}}},"/v1/swaps/build":{"post":{"operationId":"buildSwapTransaction","summary":"Build an unsigned swap transaction for $0.01 USDC","description":"Pass a routeHandle from the free quote endpoint. x402 exact payment is verified before construction and settled only after construction succeeds.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuildRequest"}}}},"responses":{"200":{"description":"Unsigned transaction, payment receipt, and tracking token"},"402":{"description":"$0.01 USDC x402 exact payment required on Base or Solana"}}}},"/v1/swaps/track":{"post":{"operationId":"trackSwap","summary":"Track a built swap for free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackRequest"}}}},"responses":{"200":{"description":"Normalized THORChain or MAYAChain state"}}}},"/v1/assets":{"get":{"operationId":"listSupportedAssets","summary":"List supported assets for free","responses":{"200":{"description":"Active direct-provider pools with canSell and canBuy capabilities"}}}}},"components":{"schemas":{"QuoteRequest":{"type":"object","required":["sellAsset","buyAsset","sellAmount"],"properties":{"sellAsset":{"type":"string","example":"BTC.BTC"},"buyAsset":{"type":"string","example":"ETH.ETH"},"sellAmount":{"type":"string","example":"0.01"},"maximumSlippageBps":{"type":"integer","default":300},"routePreference":{"enum":["recommended","cheapest","fastest"]},"providerFilters":{"type":"object"},"maxExecutionTimeSeconds":{"type":"integer"},"sourceAddress":{"type":"string"},"destinationAddress":{"type":"string"},"affiliate":{"type":"string","description":"Optional THOR/MAYA address or short registered name. Never required; inspect the quote for memo limitations."},"affiliateProtocol":{"enum":["THORCHAIN","MAYACHAIN"],"description":"Required only when affiliate is a short name."}}},"QuoteResponse":{"type":"object","properties":{"quoteAccessFee":{"type":"string","example":"0.00"},"transactionConstructionFee":{"type":"string","example":"0.01 USDC"},"serviceFeeBps":{"type":"integer","const":10},"serviceFeeIncluded":{"type":"boolean","const":true},"routes":{"type":"array","items":{"type":"object","properties":{"quoteAccessFee":{"type":"string","example":"0.00"},"transactionConstructionFee":{"type":"string","example":"0.01 USDC"},"serviceFeeBps":{"type":"integer","const":10},"serviceFeeIncluded":{"type":"boolean","const":true},"platformFeeBps":{"type":"integer"},"affiliate":{"type":"object"},"liquidity":{"type":"object"}}}},"liquidityRejections":{"type":"array"}}},"BuildRequest":{"type":"object","required":["routeHandle","sourceAddress","destinationAddress"],"properties":{"routeHandle":{"type":"string"},"sourceAddress":{"type":"string"},"destinationAddress":{"type":"string"}}},"TrackRequest":{"type":"object","required":["trackingToken","transactionHash","chainId"],"properties":{"trackingToken":{"type":"string"},"transactionHash":{"type":"string"},"chainId":{"type":"string"}}}}}}