Find something... ⌘K

API reference / Routes

Quote routes

The routes that say what an amount gets. A price is for browsing; a quote is for placing an order: an id, the steps, valid for 60 seconds: Price vs quote. Each takes a secret or a publishable key. Samples use the setup from Get a quote; answers are real sandbox answers, trimmed.

Name the swap

/price, /quote, /quotes/batch, /prices/stream and /prices/stream-ticket take the same parameters.

ParameterMeaning
from, toThe coins, in words: ETH on base, USDC on arbitrum, BNB, SOL, BTC, or a CAIP-19 id
amountWhat the user sends, in whole coins; decimals past the coin's are dropped
fromAmountThe same in the smallest unit (wei, sats, 6-decimal units). Alias sellAmount
receive, toAmountBuying BTC only: the BTC wanted, in whole BTC or in sats, in place of amount. Alias of toAmount: buyAmount
fromChain, fromToken, toChain, toTokenInstead of from and to: a chain id, name or CAIP-2 id, and a token address or symbol. Aliases chainId, sellToken, buyToken
partnerFeeBps, partnerFeeRecipient, partnerFeeTokenYour own fee on top, on evm-btc-escrow, evm-btc-bridge, two-leg btc-evm sales and evm-btc-gasless: Partner fees
scenario, simulateTest keys only: Test scenarios

Give one amount: amount, fromAmount, receive or toAmount. Answers give amounts in the smallest unit, as strings; formatted in words.

GET /price

What an amount gets now. No wallet, nothing reserved; the same question within 3 seconds is one read. It answers at any size above the route's minimum: the quote checks the order size.

curl Copy
curl -s -G -H "x-maxy-key: $MAXY_API_KEY" "$BASE/price" --data-urlencode "from=ETH on base" -d to=BTC -d amount=0.004
json Copy
{ "route": "evm-btc-escrow", "liquidityAvailable": true, "from": { "chain": 8453, "chainName": "Base", "token": "0x0000000000000000000000000000000000000000", "symbol": "ETH", "decimals": 18, "caip2": "eip155:8453", "assetId": "eip155:8453/slip44:60" }, "to": { "chain": "bitcoin", "chainName": "Bitcoin", "token": "BTC", "symbol": "BTC", "decimals": 8, "caip2": "bip122:000000000019d6689c085ae165831e93", "assetId": "bip122:000000000019d6689c085ae165831e93/slip44:0" }, "fromAmount": "4000000000000000", "toAmount": "10800", "toAmountMin": "10800", "formatted": { "send": "0.004 ETH on Base", "receive": "0.000108 BTC", "pair": "ETH on Base → BTC" }, "expiresAt": 1795468322, "expiresAtIso": "2026-11-23T21:12:02.000Z", "limits": { "minSats": 546 }, "requiredConfirmations": 1, "sandbox": true }

toAmountMin equals toAmount on a settler route (lower after a swap or bridge leg), with every cost in; two-leg routes add legs. On a buy, requiredConfirmations is the Bitcoin confirmations before the solver is paid: 1 below $2,000, 2 from $2,000, 3 from $20,000. When no price can be made, the answer is a 200 with liquidityAvailable: false, a message and route: null.

GET /quote

The quote for an order about to be placed: who pays, who receives, valid for 60 seconds.

ParameterRequiredMeaning
fromAddressyesThe paying wallet. Selling BTC: any Bitcoin address of the payer. Alias taker
toAddressyesWhere the coins go: a bc1q… address when buying BTC. Alias recipient
slippageBpsnoThe price band in basis points, 0 to 1000; default 50 (Price band)
evmAddressTron and SuiThe user's EVM wallet between the two legs (Tron and Sui)
refundRecipientnoA contract fromAddress only: who the settler refunds (Opening an escrow from a contract)
shapenoSandbox only: live gives the real intent on the Base Sepolia test settler
curl Copy
curl -s -G -H "x-maxy-key: $MAXY_API_KEY" "$BASE/quote" --data-urlencode "from=ETH on base" -d to=BTC -d amount=0.004 \ -d fromAddress="$WALLET" -d toAddress="$MY_BTC_ADDRESS"
json Copy
{ "quoteId": "0x53414e44424f58457cd806dde2c268ed65fc50cca1b1cb876e867f5069b07af8", "route": "evm-btc-escrow", "toAmount": "10797", "expiresAt": 1795468344, "requiredConfirmations": 1, "order": { "route": "evm-btc-escrow", "orderId": "0x53414e44424f5845…", "chainId": 8453, "btcAddress": "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4", "intent": "…", "quote": "…", "status": "…" }, "issues": { "balance": null, "allowance": null, "orderCap": null }, "steps": [ { "id": "intent", "kind": "signature", "typedData": "…", "hash": "…" }, { "id": "order", "kind": "post", "method": "POST", "path": "/orders", "body": "…" }, { "id": "escrow", "kind": "transaction", "chainId": 8453, "transaction": null } ], "signing": { "kind": "eip712", "payloads": "…", "approval": null, "after": { "method": "POST", "path": "/orders" } }, "sandbox": true }

The price fields are there too, with fees.partner and totalFromAmount when you ask a fee. quoteId becomes the order id. Send order back unchanged to POST /orders. steps lists what the wallet does, in order: signature, post (call this API) or transaction. signing gives the first thing the wallet is asked for, in one shape on every route.

WhenThe quote shows
Over your key's order size capThe amounts, issues.orderCap, steps: null
Maxy cannot fill this size nowThe amounts, liquidityAvailable: false, steps: null
The wallet holds too littleissues.balance
USDC needs a one-time approvalissues.allowance and an approve step
No provable swap leg (two legs)routeAvailable: false, steps: null

POST /quotes/batch

Up to 20 prices or quotes in one call: each request is GET /price's query as JSON, a quote with fromAddress and toAddress. Each answer has its own status.

curl Copy
curl -s -X POST "$BASE/quotes/batch" -H "x-maxy-key: $MAXY_API_KEY" -H "content-type: application/json" \ -d '{ "requests": [{ "from": "ETH on base", "to": "BTC", "amount": "0.004" }, { "from": "PEPE on base", "to": "BTC", "amount": "1" }] }'
json Copy
{ "results": [ { "index": 0, "status": 200, "requestId": "adfc71f1-d098-49d6-8bc4-a9237046b88c", "quote": { "route": "evm-btc-escrow", "fromAmount": "4000000000000000", "toAmount": "10853", "formatted": "…" } }, { "index": 1, "status": 400, "requestId": "a0f5af3f-1c42-4246-b6b3-1de95039e9f6", "error": { "code": "invalid_input", "message": "PEPE is not a coin Maxy swaps on Base. On Base it swaps ETH, USDC, USDT. GET /pairs (swap.pairs() in the SDK) lists every pair.", "retryable": false, "docs": "https://maxy.co/docs/error-codes#invalid_input" } } ] }

GET /prices/stream

GET /price as server-sent events every few seconds: price, error and end. A connection lasts two minutes at most, then reconnect.

ParameterRequiredMeaning
intervalSecondsno5 to 60; default 5
ticketnoIn place of the key, from a browser: see below
curl Copy
curl -sN -G -H "x-maxy-key: $MAXY_API_KEY" "$BASE/prices/stream" --data-urlencode "from=ETH on base" -d to=BTC -d amount=0.01
text Copy
retry: 5000 event: price data: {"route":"evm-btc-escrow","liquidityAvailable":true,"fromAmount":"10000000000000000","toAmount":"27816",…}

POST /prices/stream-ticket

EventSource cannot send a header, and a key never goes in a URL: ask a ticket from your server, then open the stream with it. A ticket opens one pair's stream for 10 minutes, and carries your key's id, never the key.

curl Copy
curl -s -X POST -G -H "x-maxy-key: $MAXY_API_KEY" "$BASE/prices/stream-ticket" --data-urlencode "from=ETH on base" -d to=BTC -d amount=0.01
json Copy
{ "ticket": "mst1.eyJrIjoicCIsInQ…", "expiresAt": 1795137555, "expiresAtIso": "2026-11-20T01:19:15.000Z", "stream": "https://openapi.maxy.co/v1/prices/stream?from=ETH+on+base&to=BTC&amount=0.01&ticket=mst1.…", "sandbox": true }
TypeScript Copy
const source = new EventSource(ticket.stream); source.addEventListener('price', (e) => console.log(JSON.parse(e.data).formatted.receive));

A changed, expired or other pair's ticket answers 401 invalid_ticket: ask a new one.

Errors

HTTPcodeWhen
400invalid_inputNo amount or two, an unknown coin, or a quote without fromAddress and toAddress
400unsupported_routeA pair Maxy does not swap, such as SOL to ETH
422amount_out_of_rangeBelow the smallest order: details.minSats
429rate_limitedOver your limit. Price reads count apart, at ten times your limit

Errors: Error codes.