The DEX Aggregator API supports two integration shapes. They produce equivalent on-chain transactions; the difference is when the routing engine runs.Documentation Index
Fetch the complete documentation index at: https://docs.o1.exchange/llms.txt
Use this file to discover all available pages before exploring further.
Two-step
/quote → human reviews price → /submit → broadcast.Best for swap UIs.One-step
/execute → broadcast.Best for one-click flows and bots.Two-step (recommended for swap UIs)
Use this flow when a user reviews the quoted price before they commit.Pros
- User confirms the price they see; no last-second surprise.
- You can run validation between quote and submit (e.g. “is this trade > $X? require a confirm dialog”).
- Clean separation between read (quote) and write (submit) for caching, analytics, and rate limiting.
Cons
- Quotes have a TTL (~10 seconds). If the user takes too long,
/submitreturns404and you must re-quote. See Quote freshness. - Two API calls per swap.
One-step (instant swap)
Use this flow when there’s no preview step.Pros
- Single round trip.
- No
quoteIdto track, no expiry to handle.
Cons
- The user (or bot) doesn’t see the price before signing. If you still want to show it, log
exec.routePlan.expectedAmountOutafter the fact. - Less flexibility for caching and analytics, since each call rebuilds the full route plan server-side.
Choosing the right pattern
| Use case | Pattern |
|---|---|
| Standard swap UI with confirm dialog | Two-step |
| One-click “swap now” button | One-step |
| Server-side market-maker / bot | One-step |
| Limit-order style flow with delayed execution | Two-step (re-quote on each tick) |
| Mobile UI with poor connectivity | One-step (fewer round trips) |
Always: handle expired quotes
Whichever pattern you pick, treat404 quote not found or expired from /submit as recoverable: re-fetch /quote with the same parameters and retry. Don’t surface this as a user-facing error unless it happens repeatedly.
See Quote freshness for the full pattern.