Overview
DEX swaps execute on-chain through smart contracts. Unlike CEX swaps, DEX swaps require users to connect their wallet, sign transactions, and broadcast them to the blockchain. In API v2, DEX swaps use the same/quotes and /exchanges endpoints as CEX swaps — pass types=dex to get only DEX quotes, or filter the response by type: "dex". The quoteId is the single identifier passed through the entire flow — no route objects required.
Best For: Users who want true decentralized swaps, keep custody of their funds, and interact directly with on-chain liquidity sources like Uniswap, CowSwap, and 1inch.
Looking for the v1 DEX swap guide? See API v1 — DEX Swap.
Fixed rate is not available for DEX swaps. For guaranteed output amounts, use a Fixed Rate Standard Swap (CEX-based).
Supported Networks
- EVM (Ethereum, BSC, Polygon, etc.)
- Solana
- SUI
- TRON
- TON
- Stellar
Key Differences from CEX Swaps
How It Works
1
Get Tokens
Bulk fetch DEX-supported tokens and cache to your DB, or search by name/symbol. Note each token’s
id.2
Get Quotes
Call
GET /quotes with token IDs and optional slippage. Select the quote with type: "dex".3
Check Approvals (if requiresApproval: true)
If the quote has
requiresApproval: true, call POST /dex/approve with quoteId and addressFrom. Returns on-chain approval transactions and/or signatures needed. Skip this step if requiresApproval: false.4
Handle Approvals (if needed)
Broadcast approval transactions via user’s wallet.
5
Handle Signatures (if needed)
Have user sign EIP-712 typed data. For chained signatures, call
POST /dex/chainSignatures until isComplete: true.6
Create Order
Call
POST /exchanges with quoteId, addressTo, addressFrom, and any collected signatures.7
Broadcast & Confirm
If not off-chain, have user broadcast the transaction. Then call
POST /dex/confirmTx with the transaction hash.8
Monitor Status
Poll
GET /orders/{houdiniId} until statusLabel is FINISHED.Integration Guide
Step 1: Get Tokens
There are two approaches for getting tokens. Choose the one that fits your integration:- Bulk Fetch + Cache
- Token Search
Fetch all DEX-supported tokens once and store them in your backend database.
Step 2: Get DEX Quote
CallGET /quotes with token IDs and optional slippage. Select the quote with type: "dex".
Quotes Response (DEX quote)
quoteId: Pass to/dex/approveand/exchangestype:"dex"for on-chain swapsrequiresApproval: Iftrue, call the approve/allowance flow (Step 3). Iffalse, skip directly to Step 6.markupSupported: Whether a fee markup can be applied to this routeapiMarkupValue/markupType: Markup amount and type ("bp"= basis points)restrictedCountries: List of country codes where this route is unavailable
Step 3: Check Approvals and Signatures
Only run this step if
requiresApproval: true on the selected quote. If requiresApproval is false, skip Steps 3–5 and go directly to Step 6: Create Order.POST /dex/approve with just the quoteId and user’s wallet address:
approvals: Array of{ data, to, from, fromChain }transactions to broadcast (may be empty)signatures: Array of EIP-712 typed data objects to sign (may be empty)
You may receive both
approvals and signatures. Handle approvals first, then signatures.Signature Types
- SINGLE: User signs once — collect the result and proceed
- CHAINED (e.g., CowSwap): User signs → call
/dex/chainSignatures→ user signs again → repeat untilisComplete: true
Step 4: Send Approval Transactions (if needed)
Step 5: Process Signatures (if needed)
- SINGLE: Collect one signature and move on
- CHAINED: Sign →
/dex/chainSignatures→ sign again → repeat untilisComplete: true. Only the final result is passed to/exchanges
Step 6: Create Order
CallPOST /exchanges with the quoteId, addresses, and any collected signatures:
quoteId(required): From/quotesaddressTo(required): Destination wallet addressaddressFrom(optional): Source wallet address — required for DEX swapssignatures(optional): Collected from Step 5destinationTag(optional): Memo for chains that require it
houdiniId: Use for status pollingmetadata.offChain:trueif Houdini backend broadcasts (e.g., CowSwap)metadata.to: DEX router address (whenoffChain: false)metadata.data: Encoded swap calldata (whenoffChain: false)metadata.value: ETH value for native swaps (whenoffChain: false)
Step 7: Broadcast Transaction and Confirm
- On-Chain (offChain: false)
- Off-Chain (offChain: true)
User broadcasts the transaction, then confirm with Houdini:
Step 8: Monitor Order Status
PollGET /orders/{houdiniId} to track progress, or subscribe via the WebSocket API for real-time updates:
Example Repositories
See full working integrations on GitHub:Next.js Example
Full Next.js integration showing standard, private, and DEX swap flows
Node.js Example
Backend Node.js integration with token fetching, quoting, and order tracking
Next Steps
Standard Swaps
Fast single-hop CEX swaps
Private Swaps
Multi-hop privacy swaps
Order Lifecycle
Understand all order statuses
Error Handling
Handle errors and edge cases