API Documentation
Complete technical reference for the ChainBridge Trading API. Integrate our Smart Order Router, cross-chain bridge, fiat on-ramp, pool management, and staking services.
Why ChainBridge API?
No API Key Required
Start making requests immediately. No signup, no key management.
7 DEX Aggregators
Compare 0x, 1inch, ParaSwap, KyberSwap, UniswapX, Balancer, and Thorchain in one call.
Cross-Chain Bridge
Bridge tokens across 7 chains via LI.FI and Socket.
Native BTC/DOGE/LTC
Swap native Bitcoin, Dogecoin, Litecoin via Thorchain — no wrapped tokens.
Gasless Swaps
Zero gas fees for users via 0x Gasless and UniswapX intent-based orders.
Transaction Simulation
Simulate swaps via Tenderly before execution to prevent failures.
ChainBridge vs Alternatives
| Feature | ChainBridge | 0x API | 1inch API |
|---|---|---|---|
| Aggregators compared | 7 | 1 | 1 |
| API key required | No | Yes | Yes |
| Cross-chain bridge | Yes (7 chains) | No | No |
| Native BTC/DOGE/LTC | Yes | No | No |
| Gasless swaps | Yes | Yes | Yes |
| Transaction simulation | Yes | No | No |
| Embeddable widget | Yes | No | Yes |
| SSE price streaming | Yes | No | No |
| TypeScript SDK | Yes | Yes | Yes |
Getting Started
Base URL
https:"color:#5c6370">//www.chainbridge.trading/api
Authentication
Public endpoints (quotes, prices, market data) do not require authentication. Transaction endpoints require a connected wallet and CSRF token. API keys for third-party aggregators (0x, 1inch, LI.FI, etc.) are managed server-side and never exposed to clients.
Rate Limiting
All endpoints are rate-limited per IP address. Standard limits: 100 req/min for quote endpoints and 20 req/min for transaction endpoints. Exceeding limits returns a 429 response with a Retry-After header.
Response Format
All responses are JSON. Error responses follow a consistent format:
{
"error": "Description of what went wrong",
"code": "ERROR_CODE",
"status": 400
}Smart Order Router (SOR)
Compare and execute swaps across 7 DEX aggregators on supported chains.
/api/sor/quotesFetches quotes from all available DEX aggregators for a given token pair and amount. Returns quotes sorted by best output, including gas estimates and price impact.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Chain ID (1, 10, 42161, 8453) |
sellToken | string | Yes | Token address to sell |
buyToken | string | Yes | Token address to buy |
sellAmount | string | Yes | Amount in wei (BigInt string) |
slippage | number | No | Slippage tolerance (default: 0.01) |
takerAddress | string | No | Trader wallet address |
curl "https://www.chainbridge.trading/api/sor/quotes?\ sellToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\ buyToken=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&\ sellAmount=1000000000&\ chainId=1&\ takerAddress=0xYourWallet"
/api/sor/swapGenerates transaction data to execute a swap through the selected aggregator. Returns the transaction object ready to send from the wallet.
Request Body
{
"chainId": 1,
"aggregatorId": "0x",
"sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"sellAmount": "1000000000",
"takerAddress": "0x...",
"slippage": 0.01
}curl -X POST "https://www.chainbridge.trading/api/sor/swap" \ -H "Content-Type: application/json" \ -d '{ "chainId": 1, "aggregatorId": "0x", "sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "sellAmount": "1000000000", "takerAddress": "0xYourWallet", "slippage": 0.01 }'
/api/sor/aggregatorsReturns available DEX aggregators, their status, supported chains, and features (gasless swaps, intent-based routing, etc.).
Bridge API
Cross-chain asset transfers using LI.FI, Socket, and SwapKit/Thorchain.
/api/bridge/quoteFetches cross-chain bridge quotes from all providers. Compares routes by output amount, estimated time, and fees.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
fromChainId | number | Source chain ID |
toChainId | number | Destination chain ID |
fromToken | string | Source token address |
toToken | string | Destination token address |
amount | string | Amount in wei |
fromAddress | string | Sender wallet address |
curl "https://www.chainbridge.trading/api/bridge/quote?\ fromChainId=1&\ toChainId=42161&\ fromToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\ toToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&\ amount=1000000000&\ fromAddress=0xYourWallet"
/api/bridge/transactionGenerates transaction data for executing a cross-chain bridge transfer through the selected provider.
curl -X POST "https://www.chainbridge.trading/api/bridge/transaction" \ -H "Content-Type: application/json" \ -d '{ "provider": "lifi", "fromChainId": 1, "toChainId": 42161, "fromToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "toToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "1000000000", "fromAddress": "0xYourWallet", "toAddress": "0xYourWallet" }'
/api/bridge/statusChecks bridge transaction status. Returns state (pending, in transit, completed, failed), estimated time, and tx hashes on both chains.
curl "https://www.chainbridge.trading/api/bridge/status?\ txHash=0xabc123...def456&\ fromChainId=1&\ toChainId=42161"
/api/bridge/chainsReturns supported chains for bridging with metadata (name, chain ID, native token, explorer URL) and available providers per route.
Price API
Real-time token prices powered by CoinGecko.
/api/priceReturns current USD prices for specified tokens. Supports multiple addresses in a single request.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
tokens | string | Comma-separated token addresses or CoinGecko IDs |
currency | string | Target currency (default: usd). Supports usd, eur, gbp |
curl "https://www.chainbridge.trading/api/price?\ tokens=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\ currency=usd"
Integration Guide
Prerequisites
- Node.js 18+ and npm or yarn
- A WalletConnect Project ID (for wallet connections)
- API keys for 0x and 1inch (required for full SOR)
- Optional: LI.FI, Socket, CoinGecko, Transak, Coinbase keys
Quick Start
"color:#5c6370"># Get a swap quote(no setup needed) curl "https://www.chainbridge.trading/api/sor/quotes?sellToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&buyToken=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&sellAmount=1000000000&chainId=1" "color:#5c6370"># Get bridge quote curl "https://www.chainbridge.trading/api/bridge/quote?fromChain=1&toChain=42161&fromToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&toToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&amount=1000000000" "color:#5c6370"># Get token price curl "https://www.chainbridge.trading/api/price?ids=ethereum,bitcoin&vs=usd"