Skip to main content

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.

The DEX Aggregator API is currently Base mainnet only (chainId: 8453). Multi-chain support is on the roadmap.
The o1.exchange DEX Aggregator API gives you institutional-grade swap pricing on Base in two HTTP calls. The routing engine searches across 20+ on-chain venues, splits trades when it improves output, and returns broadcast-ready calldata for the canonical O1Router contract.

Multi-venue routing

Quotes pulled from Uniswap V2/V3/V4, Aerodrome, PancakeSwap, Curve, DODO, WooFi, Hydrex, and proprietary on-chain PMMs.

Split optimization

A convex solver allocates input across multiple paths when the marginal output beats a single-route quote.

Permit-enabled swaps

Optional EIP-2612 permit payload lets the router pull tokens in the same transaction as the swap, no separate approval needed.

How it works

1

POST /quote

Send chainId, tokenIn, tokenOut, amountIn, and slippageBps. Receive a quoteId, an expectedAmountOut, and a routePlan describing which venues will be used.
2

POST /submit

Echo the quoteId plus the user’s wallet address. Receive { to, data, value }, ready to hand to any EVM signer.
3

Broadcast

The user’s wallet signs and submits the transaction. The router executes all legs atomically and emits the configured slippage check.
If you don’t need a price preview step, POST /execute collapses quote and submit into one call.

What you get

Atomic split routes

Up to 3 hops per route, multiple routes per swap. Slippage is checked per-leg and globally inside the router contract.

Native ETH support

Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (or the zero address) as the tokenIn / tokenOut to swap raw ETH; the router handles the wrap and unwrap automatically.

Integrator fees

Pass feeBps on the quote request to take a cut of the output. The fee is enforced inside the router contract, not the API.

Architecture at a glance

The aggregator has three layers:
  1. Routing enginepackages/sdk/src/router runs beam-search path finding plus split optimization. It calls a pool repository (live Codex queries by default) to fetch reserves and tick state.
  2. HTTP API — exposed by Convex HTTP actions in production and a Fastify service for self-hosting. Handles auth, rate limiting, quote storage, and calldata assembly.
  3. On-chain layerO1Router.swapExactIn(...) dispatches each leg to a venue adapter, enforces slippage, and optionally wraps or unwraps native ETH.
For the algorithmic details (beam search, convex split solver, AMM math per venue), see docs/ALGORITHM.md in the source repo.

Choose your integration pattern

Next steps

Quickstart

Your first quote and swap in 30 lines of TypeScript.

Authentication

How to obtain and use an API key.

Endpoint reference

Request and response schemas for every endpoint.

Supported DEXes

The full list of venues in the routing graph.
Already integrating? Skim Quote freshness and Error handling before you ship — they cover the two failure modes that catch most teams.