ChainBridge

Developer Tools

Integrate ChainBridge into your application. Access 7 DEX aggregators, cross-chain bridges, and real-time pricing through a unified API.

Base URL: https://www.chainbridge.trading/apiRate Limit: 30 req/minFormat: JSON

API Reference

All endpoints return JSON. Errors follow the format { "error": "message" } with appropriate HTTP status codes.

GET/api/sor/quotes

Query 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

ParameterTypeRequiredDescription
sellTokenstringYesAddress of the token to sell (0x-prefixed)
buyTokenstringYesAddress of the token to buy (0x-prefixed)
sellAmountstringYesAmount to sell in base units (wei)
chainIdnumberYesChain ID (1, 10, 8453, 42161)
slippageBpsnumberNoSlippage tolerance in basis points (default: 100 = 1%)
takerAddressstringNoAddress of the taker (for gasless quotes)

Example Request

bash
"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

json
{
  "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
  }
}
POST/api/sor/swap

Build a swap transaction using the selected aggregator quote. Returns calldata ready to sign and broadcast from the user's wallet.

Parameters

ParameterTypeRequiredDescription
aggregatorIdstringYesAggregator to use (0x, 1inch, paraswap, kyber, uniswapx, balancer, thorchain)
sellTokenstringYesToken to sell address
buyTokenstringYesToken to buy address
sellAmountstringYesAmount in base units
chainIdnumberYesChain ID
takerAddressstringYesUser wallet address
slippageBpsnumberNoSlippage in basis points

Example Request

bash
"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

json
{
  "to": "0xDef1C0ded9bec7F1a1670819833240f027b25EfF",
  "data": "0xd9627aa4000000000000000...",
  "value": "0",
  "gasLimit": "250000",
  "chainId": 1
}
GET/api/bridge/quote

Get cross-chain bridge quotes from multiple providers (LI.FI, Socket, SwapKit). Compares routes across 7 supported chains.

Parameters

ParameterTypeRequiredDescription
fromChainIdnumberYesSource chain ID
toChainIdnumberYesDestination chain ID
fromTokenstringYesSource token address
toTokenstringYesDestination token address
amountstringYesAmount in base units
fromAddressstringNoSender wallet address

Example Request

bash
"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

json
{
  "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"
}
POST/api/bridge/transaction

Build a bridge transaction for the selected route. Returns calldata for the user to sign.

Parameters

ParameterTypeRequiredDescription
providerstringYesBridge provider (lifi, socket, swapkit)
fromChainIdnumberYesSource chain ID
toChainIdnumberYesDestination chain ID
fromTokenstringYesSource token address
toTokenstringYesDestination token address
amountstringYesAmount in base units
fromAddressstringYesSender wallet address
toAddressstringNoReceiver address (defaults to fromAddress)

Example Request

bash
"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

json
{
  "to": "0x1231DEB6f5749ef6cE6943a275A1D3E7486F4EaE",
  "data": "0x4630a0d8000000...",
  "value": "0",
  "gasLimit": "350000",
  "chainId": 1
}
GET/api/price

Get real-time token prices from CoinGecko. Supports multiple currencies (USD, EUR, GBP, JPY, CHF, CAD, AUD).

Parameters

ParameterTypeRequiredDescription
idsstringYesComma-separated CoinGecko token IDs (e.g., ethereum,bitcoin)
currenciesstringNoComma-separated currencies (default: usd)

Example Request

bash
"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

json
{
  "ethereum": {
    "usd": 3456.78,
    "eur": 3201.45
  },
  "bitcoin": {
    "usd": 67890.12,
    "eur": 62845.67
  },
  "usd-coin": {
    "usd": 1.0001,
    "eur": 0.9265
  }
}
GET/api/health

Health check endpoint. Returns service status and version information.

Example Request

bash
"color:#c4b5fd">curl "color:#fde68a">-X GET "https://www.chainbridge.trading/api/health"

Example Response

json
{
  "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.

html
<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>
Query parameters:
  • chainId -- Default chain (1, 10, 8453, 42161)
  • sellToken -- Default sell token symbol
  • buyToken -- Default buy token symbol
  • theme -- 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.

bash
npm install @chainbridge/sdk

Planned API

typescript
"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'])

Want early access? Join the waitlist by reaching out on Discord or Telegram.