Intents Swap
POST
/v0/swap/ordersStart a swap
Create the order for a swap quote. Manual mode needs recipient and refundTo and returns the deposit address, exact amount and expiry. Wallet mode needs sender and returns the steps to sign.
Authentication
Section titled “Authentication”None. Intents Swap is public: it runs in the browser with no key, and is rate-limited per IP.
Body parameters
Section titled “Body parameters”quoteIdstringRequiredrecipientstringOptionalWhere the swapped funds go, on the destination network. Required in manual mode
refundTostringOptionalWhere a refund goes, on the source network. Required in manual mode; defaults to
senderin wallet modesenderstringOptionalWallet mode: the connected wallet that signs. Required there
contextobjectOptionalWhere the swap started, for analytics (SPEC-swap §8). Never an address.
context.landingUrlstringOptionalcontext.refstringOptionalcontext.pageTypestringOptional
Responses
Section titled “Responses”- 200The existing order for this quote
- 201Order created
- 400Invalid request (
INVALID_REQUEST,UNSUPPORTED_ASSET) - 403
SWAP_REFUSED: we can't route this swap (no reason is given) - 404
NOT_FOUND,NO_ROUTE - 409
QUOTE_DRIFT: the price moved;details.quoteis the new quote - 410
QUOTE_EXPIRED - 422
TRANSFER_MODE_UNAVAILABLE,SWAP_PRICE_IMPACT_TOO_HIGH - 429
RATE_LIMITED - 503
SWAP_UNAVAILABLE: swap is not configured on this deployment
Request
Section titled “Request”curl https://api.intents.fi/v0/swap/orders \ -X POST \ -H 'content-type: application/json' \ -d '{ "quoteId": "q_Hn4tQ8vLmZ2kR7wXc9bJpD3s", "recipient": "bc1qszaek42mdc0056apvpa8xs69v8vwhp3hydnq8s", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }'const response = await fetch("https://api.intents.fi/v0/swap/orders", { method: "POST", headers: { "content-type": "application/json", }, body: JSON.stringify({ "quoteId": "q_Hn4tQ8vLmZ2kR7wXc9bJpD3s", "recipient": "bc1qszaek42mdc0056apvpa8xs69v8vwhp3hydnq8s", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" }),});
if (!response.ok) { const { error } = await response.json(); throw new Error(`${error.code}: ${error.message}`);}const data = await response.json();import httpx
response = httpx.post( "https://api.intents.fi/v0/swap/orders", json={ "quoteId": "q_Hn4tQ8vLmZ2kR7wXc9bJpD3s", "recipient": "bc1qszaek42mdc0056apvpa8xs69v8vwhp3hydnq8s", "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764" },)response.raise_for_status()data = response.json()Errors
Section titled “Errors”{ "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } }Switch on code, not on the message: every code has a page under Error codes. Base URL https://api.intents.fi; the whole reference is on one page.