Trading API
API reference for token trading endpoints
Trading API
Endpoints for swapping tokens on Base via 0x Protocol DEX aggregation.
Execute Trade
Swap tokens on Base mainnet. Requires authenticateSignPayment middleware (API token or OAuth2).
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sellToken | string | Yes | — | Token to sell (symbol like "USDC" or contract address) |
buyToken | string | Yes | — | Token to buy (symbol or address) |
sellAmount | number | Yes | — | Amount to sell in human-readable units (e.g., 10 for 10 USDC) |
slippagePercentage | number | No | 1.0 | Maximum slippage percentage |
network | string | No | "base" | Network (only "base" supported) |
Example Request
Success Response (200)
Error Responses
| Status | Error | Description |
|---|---|---|
| 400 | invalid_request | Missing or invalid parameters |
| 400 | unsupported_token | Token not recognized |
| 400 | unsupported_network | Only "base" is supported |
| 402 | spending_limit_exceeded | Trade exceeds spending limits |
| 402 | insufficient_balance | Not enough sell token balance |
| 500 | trade_failed | Swap execution failed on-chain |
Get Trade Quote
Preview a trade without executing it. Read-only endpoint.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sellToken | string | Yes | Token to sell (symbol or address) |
buyToken | string | Yes | Token to buy (symbol or address) |
sellAmount | number | Yes | Amount to sell |
Example Request
Success Response (200)
List Supported Tokens
Returns all tokens available for trading. No authentication required.
Example Request
Success Response (200)
Rate Limits
| Endpoint | Limit |
|---|---|
POST /api/trade | 30 req/min (shared with send) |
GET /api/trade/quote | 1000 req/min |
GET /api/trade/tokens | 1000 req/min |
Supported Token Symbols
| Symbol | Name | Contract |
|---|---|---|
USDC | USD Coin | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
ETH | Ether | Native (0xEeee...eEEeE) |
WETH | Wrapped Ether | 0x4200000000000000000000000000000000000006 |
cbETH | Coinbase Wrapped Staked ETH | 0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22 |
DAI | Dai Stablecoin | 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb |
AERO | Aerodrome | 0x940181a94A35A4569E4529A3CDfB74e38FD98631 |
You can also pass any valid Base mainnet ERC-20 contract address.