Skip to content
Intents Swap
POST/v0/swap/orders

Start 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.

None. Intents Swap is public: it runs in the browser with no key, and is rate-limited per IP.

  • quoteIdstringRequired
  • recipientstringOptional

    Where the swapped funds go, on the destination network. Required in manual mode

  • refundTostringOptional

    Where a refund goes, on the source network. Required in manual mode; defaults to sender in wallet mode

  • senderstringOptional

    Wallet mode: the connected wallet that signs. Required there

  • contextobjectOptional

    Where the swap started, for analytics (SPEC-swap §8). Never an address.

  • context.landingUrlstringOptional
  • context.refstringOptional
  • context.pageTypestringOptional
  • 200The existing order for this quote
  • 201Order created
  • 400Invalid request (INVALID_REQUEST, UNSUPPORTED_ASSET)
  • 403SWAP_REFUSED: we can't route this swap (no reason is given)
  • 404NOT_FOUND, NO_ROUTE
  • 409QUOTE_DRIFT: the price moved; details.quote is the new quote
  • 410QUOTE_EXPIRED
  • 422TRANSFER_MODE_UNAVAILABLE, SWAP_PRICE_IMPACT_TOO_HIGH
  • 429RATE_LIMITED
  • 503SWAP_UNAVAILABLE: swap is not configured on this deployment
curl
curl https://api.intents.fi/v0/swap/orders \
-X POST \
-H 'content-type: application/json' \
-d '{
"quoteId": "q_Hn4tQ8vLmZ2kR7wXc9bJpD3s",
"recipient": "bc1qszaek42mdc0056apvpa8xs69v8vwhp3hydnq8s",
"refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
}'
TypeScript
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();
Python
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()
{ "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.