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

Quote a swap

Exact-input quote for Intents Swap: every route is asked, the best one for the mode is returned with the all-in cost. Public, no API key, rate-limited per IP. Addresses are optional here; the order asks for them.

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

  • fromstringRequired

    CAIP-19 of the asset you send

  • tostringRequired

    CAIP-19 of the asset you receive

  • amountstringRequired

    Exact input, in the from asset's base units

  • modemanual \| walletOptional

    manual = send to a deposit address (the default); wallet = connect and sign

  • senderstringOptional

    Wallet mode: the source wallet

  • recipientstringOptional
  • refundTostringOptional
  • slippageBpsintegerOptional

    Override; omitted = automatic (50 bps, 100 on long-tail tokens)

  • contextobjectOptional

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

  • context.landingUrlstringOptional
  • context.refstringOptional
  • context.pageTypestringOptional
  • 200The best quote for the mode
  • 400Invalid request (INVALID_REQUEST, UNSUPPORTED_ASSET)
  • 403SWAP_REFUSED: we can't route this swap (no reason is given)
  • 404NOT_FOUND, NO_ROUTE
  • 422TRANSFER_MODE_UNAVAILABLE: no deposit address for this pair
  • 429RATE_LIMITED
  • 503SWAP_UNAVAILABLE: swap is not configured on this deployment
curl
curl https://api.intents.fi/v0/swap/quote \
-X POST \
-H 'content-type: application/json' \
-d '{
"from": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"to": "bip122:000000000019d6689c085ae165831e93/slip44:0",
"amount": "100000000",
"mode": "manual"
}'
TypeScript
const response = await fetch("https://api.intents.fi/v0/swap/quote", {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
"from": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"to": "bip122:000000000019d6689c085ae165831e93/slip44:0",
"amount": "100000000",
"mode": "manual"
}),
});
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/quote",
json={
"from": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"to": "bip122:000000000019d6689c085ae165831e93/slip44:0",
"amount": "100000000",
"mode": "manual"
},
)
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.