Developer Tools
Integrate ChainBridge into your application. Access 7 DEX aggregators, cross-chain bridges, and real-time pricing through a unified API.
API Reference
All endpoints return JSON. Errors follow the format { "error": "message" } with appropriate HTTP status codes.
/api/sor/quotesQuery the Smart Order Router for quotes across all 7 aggregators (0x, 1inch, ParaSwap, KyberSwap, UniswapX, Balancer V3, Thorchain). Returns the best quote and all individual aggregator quotes for comparison.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sellToken | string | Yes | Address of the token to sell (0x-prefixed) |
buyToken | string | Yes | Address of the token to buy (0x-prefixed) |
sellAmount | string | Yes | Amount to sell in base units (wei) |
chainId | number | Yes | Chain ID (1, 10, 8453, 42161) |
slippageBps | number | No | Slippage tolerance in basis points (default: 100 = 1%) |
takerAddress | string | No | Address of the taker (for gasless quotes) |
Example Request
"color:#c4b5fd">curl "color:#fde68a">-X GET "https://www.chainbridge.trading/api/sor/quotes?sellToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&buyToken=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&sellAmount=1000000000&chainId=1&slippageBps=100" \
"color:#fde68a">-H "Content-Type: application/json"Example Response
{
"bestQuote": {
"aggregatorId": "0x",
"buyAmount": "432156789012345678",
"sellAmount": "1000000000",
"price": "0.000432",
"gas": "145000",
"estimatedGasCostUSD": "3.25"
},
"quotes": [
{
"aggregatorId": "0x",
"buyAmount": "432156789012345678",
"price": "0.000432",
"gas": "145000"
},
{
"aggregatorId": "1inch",
"buyAmount": "431987654321098765",
"price": "0.000431",
"gas": "152000"
}
],
"meta": {
"queryTimeMs": 1240,
"aggregatorsQueried": 7,
"aggregatorsResponded": 5
}
}/api/sor/swapBuild a swap transaction using the selected aggregator quote. Returns calldata ready to sign and broadcast from the user's wallet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
aggregatorId | string | Yes | Aggregator to use (0x, 1inch, paraswap, kyber, uniswapx, balancer, thorchain) |
sellToken | string | Yes | Token to sell address |
buyToken | string | Yes | Token to buy address |
sellAmount | string | Yes | Amount in base units |
chainId | number | Yes | Chain ID |
takerAddress | string | Yes | User wallet address |
slippageBps | number | No | Slippage in basis points |
Example Request
"color:#c4b5fd">curl "color:#fde68a">-X POST "https://www.chainbridge.trading/api/sor/swap" \
"color:#fde68a">-H "Content-Type: application/json" \
"color:#fde68a">-d '{
"aggregatorId": "0x",
"sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"sellAmount": "1000000000",
"chainId": 1,
"takerAddress": "0xYourWalletAddress",
"slippageBps": 100
}'Example Response
{
"to": "0xDef1C0ded9bec7F1a1670819833240f027b25EfF",
"data": "0xd9627aa4000000000000000...",
"value": "0",
"gasLimit": "250000",
"chainId": 1
}/api/bridge/quoteGet cross-chain bridge quotes from multiple providers (LI.FI, Socket, SwapKit). Compares routes across 7 supported chains.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fromChainId | number | Yes | Source chain ID |
toChainId | number | Yes | Destination chain ID |
fromToken | string | Yes | Source token address |
toToken | string | Yes | Destination token address |
amount | string | Yes | Amount in base units |
fromAddress | string | No | Sender wallet address |
Example Request
"color:#c4b5fd">curl "color:#fde68a">-X GET "https://www.chainbridge.trading/api/bridge/quote?fromChainId=1&toChainId=42161&fromToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&toToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&amount=1000000000&fromAddress=0xYourWallet" \
"color:#fde68a">-H "Content-Type: application/json"Example Response
{
"quotes": [
{
"provider": "lifi",
"toAmount": "998500000",
"estimatedTimeSeconds": 120,
"fees": {
"bridgeFee": "500000",
"gasCost": "0.002 ETH"
},
"route": {
"steps": ["USDC on Ethereum", "Bridge via Stargate", "USDC on Arbitrum"]
}
},
{
"provider": "socket",
"toAmount": "997800000",
"estimatedTimeSeconds": 180,
"fees": {
"bridgeFee": "700000",
"gasCost": "0.003 ETH"
}
}
],
"bestQuote": "lifi"
}/api/bridge/transactionBuild a bridge transaction for the selected route. Returns calldata for the user to sign.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
provider | string | Yes | Bridge provider (lifi, socket, swapkit) |
fromChainId | number | Yes | Source chain ID |
toChainId | number | Yes | Destination chain ID |
fromToken | string | Yes | Source token address |
toToken | string | Yes | Destination token address |
amount | string | Yes | Amount in base units |
fromAddress | string | Yes | Sender wallet address |
toAddress | string | No | Receiver address (defaults to fromAddress) |
Example Request
"color:#c4b5fd">curl "color:#fde68a">-X POST "https://www.chainbridge.trading/api/bridge/transaction" \
"color:#fde68a">-H "Content-Type: application/json" \
"color:#fde68a">-d '{
"provider": "lifi",
"fromChainId": 1,
"toChainId": 42161,
"fromToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"toToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"amount": "1000000000",
"fromAddress": "0xYourWalletAddress"
}'Example Response
{
"to": "0x1231DEB6f5749ef6cE6943a275A1D3E7486F4EaE",
"data": "0x4630a0d8000000...",
"value": "0",
"gasLimit": "350000",
"chainId": 1
}/api/priceGet real-time token prices from CoinGecko. Supports multiple currencies (USD, EUR, GBP, JPY, CHF, CAD, AUD).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | string | Yes | Comma-separated CoinGecko token IDs (e.g., ethereum,bitcoin) |
currencies | string | No | Comma-separated currencies (default: usd) |
Example Request
"color:#c4b5fd">curl "color:#fde68a">-X GET "https://www.chainbridge.trading/api/price?ids=ethereum,bitcoin,usd-coin¤cies=usd,eur" \
"color:#fde68a">-H "Content-Type: application/json"Example Response
{
"ethereum": {
"usd": 3456.78,
"eur": 3201.45
},
"bitcoin": {
"usd": 67890.12,
"eur": 62845.67
},
"usd-coin": {
"usd": 1.0001,
"eur": 0.9265
}
}/api/healthHealth check endpoint. Returns service status and version information.
Example Request
"color:#c4b5fd">curl "color:#fde68a">-X GET "https://www.chainbridge.trading/api/health"Example Response
{
"status": "ok",
"timestamp": "2026-03-25T12: 00: 00.000Z",
"version": "1.0.0",
"services": {
"sor": "operational",
"bridge": "operational",
"pricing": "operational"
}
}Widget Integration
Embed the ChainBridge swap widget directly into your website. The widget provides a fully functional token swap interface with access to all 7 aggregators, powered by the same Smart Order Router as the main application.
Embed Code
Add this snippet to your HTML to embed the swap widget. Customize the default chain and tokens via query parameters.
<iframe
src="https://www.chainbridge.trading/embed?chainId=1&sellToken=USDC&buyToken=ETH"
width="420"
height="540"
frameborder="0"
style="border-radius: 16px; border: 1px solid #e5e7eb;"
allow="clipboard-write"
title="ChainBridge Swap Widget"
></iframe>chainId-- Default chain (1, 10, 8453, 42161)sellToken-- Default sell token symbolbuyToken-- Default buy token symboltheme-- Widget theme (light, dark)
SDKComing Soon
The @chainbridge/sdk package will provide a typed TypeScript client for all ChainBridge APIs. Install via npm and start building in minutes.
npm install @chainbridge/sdkPlanned API
"color:#c4b5fd">import { ChainBridge } "color:#c4b5fd">from "color:#86efac">'@chainbridge/sdk'
"color:#c4b5fd">const cb = "color:#c4b5fd">new ChainBridge({ apiKey: "color:#86efac">'your-key' })
// Get best quote across 7 aggregators
"color:#c4b5fd">const quote = "color:#c4b5fd">await cb.getQuote({
sell: "color:#86efac">'USDC',
buy: "color:#86efac">'ETH',
amount: "color:#86efac">'1000',
chainId: 1,
})
// Build swap transaction
"color:#c4b5fd">const tx = "color:#c4b5fd">await cb.buildSwap({
quote,
takerAddress: "color:#86efac">'0xYourWallet',
slippageBps: 100,
})
// Bridge tokens cross-chain
"color:#c4b5fd">const bridgeQuote = "color:#c4b5fd">await cb.getBridgeQuote({
fromChainId: 1,
toChainId: 42161,
token: "color:#86efac">'USDC',
amount: "color:#86efac">'1000',
})
// Get real-time prices
"color:#c4b5fd">const prices = "color:#c4b5fd">await cb.getPrice(["color:#86efac">'ethereum', "color:#86efac">'bitcoin'])