Find something... ⌘K

API reference / Routes

Order routes

The routes that place an order and act on it. Maxy never signs or sends: each answers what the user's wallet does next. Each takes a secret or a publishable key. Samples continue from Sign (quote.json, INTENT_SIG); answers are real sandbox answers, trimmed.

POST /orders

The body: the quote's order and the signatures its steps asked for, keyed by step id.

FieldRequiredMeaning
orderyesThe quote's order, unchanged
signaturesper routeevm-btc-escrow, evm-btc-bridge and btc-evm: intent. evm-btc-gasless: witness, and permit when asked. sol-btc: quote. btc-sol and cross-evm: none
externalId, externalCustomerIdnoYour own ids, stored as given and returned on the order
partnerFeeBps, partnerFeeRecipient, partnerFeeTokennoThe quote's partner fee; a different one is invalid_partner_fee
scenarionoTest keys only: Test scenarios

With an Idempotency-Key, a retry gets the first answer (Idempotent-Replayed: true); another body under it is 409 idempotency_conflict, so key on the signatures too, as the SDKs do:

curl Copy
curl -s -X POST "$BASE/orders" -H "x-maxy-key: $MAXY_API_KEY" -H "content-type: application/json" \ -H "Idempotency-Key: $(jq -r .quoteId quote.json):s$(printf %s "$INTENT_SIG" | shasum -a 256 | cut -c1-16)" \ -d "$(jq -c --arg sig "$INTENT_SIG" '{order: .order, signatures: {intent: $sig}, externalId: "inv-1042"}' quote.json)" > placed.json
json Copy
{ "orderId": "0x53414e44424f58a49f0bbb2d2bcbf46eb1bd3426e8ce29151d06ec8bcdc327d0", "route": "evm-btc-escrow", "expiresAt": 1795143713, "expiresAtIso": "2026-11-20T03:01:53.000Z", "refundAt": 1795143713, "transaction": { "chainId": 8453, "from": "0x8Ee2E7ceC006347C829a031D9F8eecBfA92B69cB", "to": "0x0000000000000000000000000000000000000000", "data": "0x4d4158592053414e44…", "value": "0", "gas": "1", "simulatedHash": "0x53414e44424f58126a0b…", "simulated": true, "sandbox": true }, "simulation": { "ok": true }, "next": { "method": "POST", "path": "/orders/submit", "body": { "order": "…", "signatures": { "intent": "0x66b0c535…" }, "txHash": "<transaction.simulatedHash>" } }, "sandbox": true }
RouteAnswerThen
evm-btc-escrowtransaction to send and its simulation; with a fee, partnerFee.transaction tooSend it, then POST /orders/submit, then the fee: Partner fees
evm-btc-gaslesssubmitted: true: the solver opens the escrowTrack the order
evm-btc-bridgeThe swap leg's transaction, then escrow.transactionAny token to BTC
btc-evmThe payout locked, and next: the deposit routeGET /orders/{id}/deposit
sol-btcsteps: the deposit to signPOST /orders/{id}/steps
btc-solsteps: the open to signPOST /orders/{id}/steps
cross-evmtransaction to sendPOST /orders/submit

If simulation.ok is false, do not send the transaction. A sandbox transaction is never sent: use its simulatedHash.

POST /orders/submit

After the escrow or bridge transaction is sent: tells the solver at once. An escrow opened inside a contract is not seen on chain, so a contract always calls this: From a contract. Body: next.body from POST /orders, with txHash (on evm-btc-bridge, first bridgeTxHash).

curl Copy
curl -s -X POST "$BASE/orders/submit" -H "x-maxy-key: $MAXY_API_KEY" -H "content-type: application/json" \ -d "$(jq -c --arg tx "$(jq -r .transaction.simulatedHash placed.json)" '.next.body + {txHash: $tx}' placed.json)"
json Copy
{ "orderId": "0x53414e44424f58a49f0bbb2d2bcbf46eb1bd3426e8ce29151d06ec8bcdc327d0", "route": "evm-btc-escrow", "notified": true, "status": "/status?orderId=0x53414e44424f58a49f0bbb2d2bcbf46eb1bd3426e8ce29151d06ec8bcdc327d0&chainId=8453&route=evm-btc-escrow", "sandbox": true }

POST /orders/{id}/signature

POST /orders with the order id in the path and one signature: { order, signature }. Use signatures for a route with two.

POST /orders/{id}/cancel

The transaction that takes back an escrow no solver has committed to, for the user's wallet to send, while a buy is pending.

Parameters: chainId (required) and from (default the maker).

A fresh order, not yet submitted, with the Buy BTC setup:

curl Copy
curl -sG -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" > fresh.json SIG=$(cast wallet sign --private-key "$TEST_WALLET_KEY" --data "$(jq -c '.steps[] | select(.id == "intent") | .typedData' fresh.json)") ORDER_ID=$(curl -s -X POST -H "x-maxy-key: $MAXY_API_KEY" -H "content-type: application/json" "$BASE/orders" \ -d "$(jq -c --arg sig "$SIG" '{order: .order, signatures: {intent: $sig}}' fresh.json)" | jq -r .orderId) curl -s -X POST -H "x-maxy-key: $MAXY_API_KEY" "$BASE/orders/$ORDER_ID/cancel?chainId=8453"
json Copy
{ "orderId": "0x53414e44424f5815f86ca4ae8d7a410a16951c05d78f483e7c75555ea684d324", "state": "pending", "cancellable": true, "function": "cancelBuyEscrow", "allowedStates": ["pending"], "explanation": "Takes back the escrow: no solver has committed yet. Sandbox: nothing to send; the order now reads cancelled.", "transaction": { "chainId": 8453, "to": "0x0000000000000000000000000000000000000000", "data": "0x4d4158592053414e44…", "value": "0", "simulated": true }, "sandbox": true }

After a solver commits: 409 order_state; the order then pays out, or refunds after its deadline.

GET /orders/{id}/refund

The transaction that takes an expired escrow back to the user, for the user's wallet to send. Parameters: chainId (required) and from. Before the deadline it answers refundable: false, a reason and unlocksAt. Flow: When it fails.

Selling BTC: deposit, claim, bridge

RouteParametersAnswers
GET /orders/{id}/depositThe query in next.path from POST /ordersready: false and retryAfterSeconds while the payout locks; then address, sats, bitcoinUri, expiresAt, read from the settler
GET /orders/{id}/claimchainId; btcTxid and from optionalThe proof as a transaction any wallet may send; the payout still goes only to the user
GET /orders/{id}/bridgechainId, toChainId, toToken; toAddress optionalFor a coin with no settler: the bridge transaction, once the settler has paid (to Tron or Sui: LI.FI's, to toAddress there)
GET /orders/{id}/bridge?route=btc-soloutMint, wallet, solPayoutRaw, from the quote's swap stepBTC to a Solana coin no settler pays: the Solana swap of the paid SOL, checked, for the wallet to sign

The sample reads sell.json from Sell BTC.

curl Copy
curl -s -H "x-maxy-key: $MAXY_API_KEY" "$BASE$(jq -r .next.path sell.json)"
json Copy
{ "orderId": "0x53414e44424f584474e48333e1992976d077d8f06addf17b97781dad85d7a34d", "route": "btc-evm", "state": "NONE", "ready": false, "reason": "The solver is locking the payout in the settler. Do not send BTC. Ask again in a few seconds.", "retryAfterSeconds": 3, "sandbox": true }

409 from the deposit route (window closed, or paid out) or 422 deposit_address_unverified (the escrow does not match the order): do not pay.

Solana: GET and POST /orders/{id}/steps

A Solana order's state and what the wallet signs next. GET takes route (sol-btc or btc-sol). POST takes { order, signatures, transaction }: the signed transaction, base64, which Maxy checks against the deposit it built before sending it. The flow: Pay with SOL.

Errors

HTTPcodeWhen
400invalid_inputThe order was changed, a signature is malformed, or a field is missing
400wallet_mismatchSigned by a wallet other than the quote's
409quote_expiredThe quote is over 60 seconds old. details.freshQuote holds a new quote for the same swap
409quote_mismatch, order_state, idempotency_conflictThe price moved; not allowed in this state; a reused Idempotency-Key
422order_cap_exceeded, insufficient_liquidity, insufficient_fundsOver your cap; Maxy cannot fill this size now; the wallet holds too little