Developer Tools

Integrate ChainBridge into your application. Access 0x, KyberSwap and ParaSwap quotes on 8 EVM networks, cross-chain swap quotes (Relay, LI.FI, THORChain), bridge quotes, and real-time pricing through a unified API, or connect an AI agent through the MCP server.

Base URL: https://www.chainbridge.trading/apiRate Limit: 60 req/min (quotes)Format: JSON

AI agents (MCP)

ChainBridge runs a Model Context Protocol server, so Claude, Cursor and any other MCP client can quote and prepare swaps without glue code. Streamable HTTP transport, JSON responses, no API key. Live sources: 0x, KyberSwap and ParaSwap on Ethereum, Arbitrum, Base, Optimism, Polygon, BNB Chain, Avalanche and Linea (Linea: 0x and KyberSwap).

Non-custodial by design. Every tool is read-only: build_swap_transaction returns an unsigned transaction that the wallet owner reviews, signs and sends. Quotes include the platform fee, reported per source as feeBps; see the fee schedule.

Client config

Endpoint: https://www.chainbridge.trading/api/mcp. Add it to your client's MCP configuration (Claude Desktop, Cursor, VS Code and others):

json
{
  "mcpServers": {
    "chainbridge": {
      "type": "http",
      "url": "https:">//www.chainbridge.trading/api/mcp"
    }
  }
}

Claude Code:

bash
claude mcp add --transport http chainbridge https://www.chainbridge.trading/api/mcp

Or call a tool directly (JSON-RPC 2.0 over POST):

bash
curl -s https://www.chainbridge.trading/api/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_quote","arguments":{"chainId":1,"sellToken":"USDC","buyToken":"WETH","amount":"1000"}}}'

Tools

  • get_quote

    Arguments: chainId, sellToken, buyToken, sellAmount (base units) or amount (e.g. "1.5"), slippageBps?

    Returns: Quotes ranked by amount received after gas, the fee each source applies (feeBps) and the best source.

  • build_swap_transaction

    Arguments: chainId, sellToken, buyToken, sellAmount or amount, taker, slippageBps?, aggregator?

    Returns: Unsigned transaction {to, data, value}, the ERC-20 approval it needs (if any) and, for 0x Permit2 routes, the EIP-712 payload to sign. Never signs or broadcasts.

  • list_tokens

    Arguments: chainId, query?

    Returns: Curated tokens for the chain: address, symbol, name, decimals.

  • get_token_price

    Arguments: chainId, address

    Returns: USD price from CoinGecko, or null when unknown.

Tokens accept an address or a symbol from list_tokens. Tool calls share the per-IP rate limits of the REST API.

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 multiple aggregators (0x including 0x Gasless, KyberSwap and ParaSwap). Returns the best quote and all individual aggregator quotes for comparison. Quotes include the platform fee (feeBps); fee schedule at /about#fees.

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, 42161, 8453, 10, 137, 56, 43114, 59144)
slippageBpsnumberNoSlippage tolerance in basis points (default: 100 = 1%)
takerAddressstringNoAddress of the taker (for gasless quotes)

Example Request

bash
curl -X GET "https://www.chainbridge.trading/api/sor/quotes?sellToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&buyToken=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&sellAmount=1000000000&chainId=1&slippageBps=100" \
  -H "Content-Type: application/json"

Example Response

json
{
  "success": true,
  "data": {
    "request": {
      "chainId": 1,
      "sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      "sellAmount": "1000000000",
      "slippageBps": 100
    },
    "quotes": [
      {
        "aggregator": "0x",
        "buyAmount": "432156789012345678",
        "buyAmountMin": "427835221111111111",
        "price": "0.000432",
        "priceImpact": 0.12,
        "gas": "145000",
        "sources": [{ "name": "Uniswap_V3", "proportion": 1 }]
      },
      {
        "aggregator": "kyber",
        "buyAmount": "431987654321098765",
        "buyAmountMin": "427667777777777777",
        "price": "0.000431",
        "gas": "152000"
      }
    ],
    "bestQuote": {
      "aggregator": "0x",
      "sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      "sellAmount": "1000000000",
      "buyAmount": "432156789012345678",
      "buyAmountMin": "427835221111111111",
      "price": "0.000432",
      "priceImpact": 0.12,
      "gas": "145000",
      "gasCostUSD": "3.25",
      "sources": [{ "name": "Uniswap_V3", "proportion": 1 }]
    },
    "stats": {
      "totalAggregators": 7,
      "successfulQuotes": 5,
      "timestamp": 1742900000000
    }
  }
}
POST/api/sor/swap

Build a swap transaction. Returns the same envelope as /sor/quotes, with executable calldata in bestQuote.to / bestQuote.data / bestQuote.value / bestQuote.gas, ready to sign and broadcast from the user's wallet. POST requests need an x-csrf-token header obtained from GET /api/csrf-token.

Parameters

ParameterTypeRequiredDescription
preferredAggregatorstringNoAggregator to try first (0x, paraswap, kyber)
sellTokenstringYesToken to sell address
buyTokenstringYesToken to buy address
sellAmountstringYesAmount in base units
chainIdnumberYesChain ID
takerAddressstringYesUser wallet address
slippageBpsnumberNoSlippage in basis points

Example Request

bash
curl -X POST "https://www.chainbridge.trading/api/sor/swap" \
  -H "Content-Type: application/json" \
  -d '{
    "preferredAggregator": "0x",
    "sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "sellAmount": "1000000000",
    "chainId": 1,
    "takerAddress": "0xYourWalletAddress",
    "slippageBps": 100
  }'

Example Response

json
{
  "success": true,
  "data": {
    "request": {
      "chainId": 1,
      "sellToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "buyToken": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
      "sellAmount": "1000000000",
      "takerAddress": "0xYourWalletAddress",
      "slippageBps": 100
    },
    "quotes": [
      {
        "aggregator": "0x",
        "buyAmount": "432156789012345678",
        "buyAmountMin": "427835221111111111",
        "price": "0.000432",
        "gas": "250000"
      }
    ],
    "bestQuote": {
      "aggregator": "0x",
      "buyAmount": "432156789012345678",
      "buyAmountMin": "427835221111111111",
      "price": "0.000432",
      "gas": "250000",
      "to": "0xDef1C0ded9bec7F1a1670819833240f027b25EfF",
      "data": "0xd9627aa4000000000000000...",
      "value": "0",
      "allowanceTarget": "0xDef1C0ded9bec7F1a1670819833240f027b25EfF"
    },
    "stats": {
      "totalAggregators": 1,
      "successfulQuotes": 1,
      "timestamp": 1742900000000
    }
  }
}
GET/api/crosschain/quote

Cross-chain swap quotes, ranked by net amount received: EVM to EVM via Relay and LI.FI, EVM (Ethereum, Base, BNB Chain, Avalanche) to native BTC, LTC, DOGE or BCH via THORChain. Native BTC, LTC, DOGE or BCH to EVM is quote only (executable: false). Each quote lists the steps to sign (exact-amount approval when needed) and any ChainBridge fee as platformFeeBps. Track delivery with GET /api/crosschain/status.

Parameters

ParameterTypeRequiredDescription
fromChainIdnumberYesEVM source chain (1, 42161, 8453, 10, 137, 56, 43114, 59144, 324), or pass fromChain=BTC|LTC|DOGE|BCH instead
toChainIdnumberYesEVM destination chain, or pass toChain=BTC|LTC|DOGE|BCH instead
fromTokenstringYesSource token address
toTokenstringNoDestination token address (EVM destinations)
fromTokenDecimalsnumberYesSource token decimals
toTokenDecimalsnumberYesDestination token decimals
amountstringYesAmount in base units
fromAddressstringNoSender wallet (required for EVM sources)
toAddressstringNoRecipient; a BTC/LTC/DOGE/BCH address for native destinations
slippageBpsnumberNoSlippage in basis points (default: 100)

Example Request

bash
curl -X GET "https://www.chainbridge.trading/api/crosschain/quote?fromChainId=1&toChain=BTC&fromToken=0x0000000000000000000000000000000000000000&fromTokenDecimals=18&toTokenDecimals=8&amount=100000000000000000&fromAddress=0xYourWallet&toAddress=bc1qYourBitcoinAddress"

Example Response

json
{
  "success": true,
  "data": {
    "quotes": [
      {
        "provider": "thorchain",
        "providerLabel": "THORChain",
        "toAmount": "312450",
        "toAmountMin": "309325",
        "platformFeeBps": 0,
        "estimatedSeconds": 900,
        "executable": true,
        "steps": [{ "kind": "transaction", "chainId": 1, "to": "0xD37BbE5744D730a1d98d8DC97c42F0Ca46aD7146", "data": "0x44bc937b...", "value": "100000000000000000" }]
      }
    ],
    "best": { "provider": "thorchain" },
    "errors": []
  }
}
GET/api/bridge/quote

Get cross-chain bridge quotes from LI.FI and Socket (API only, no bridge UI). Compares routes across Ethereum, Arbitrum, Optimism, Base, Polygon, BNB Chain and zkSync Era.

Parameters

ParameterTypeRequiredDescription
fromChainIdnumberYesSource chain ID
toChainIdnumberYesDestination chain ID
fromTokenstringYesSource token address
toTokenstringYesDestination token address
fromAmountstringYesAmount in base units
fromAddressstringYesSender wallet address

Example Request

bash
curl -X GET "https://www.chainbridge.trading/api/bridge/quote?fromChainId=1&toChainId=42161&fromToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&toToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&fromAmount=1000000000&fromAddress=0xYourWallet" \
  -H "Content-Type: application/json"

Example Response

json
{
  "success": true,
  "data": {
    "request": {
      "fromChainId": 1,
      "toChainId": 42161,
      "fromToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "toToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      "fromAmount": "1000000000",
      "fromAddress": "0xYourWallet",
      "slippageBps": 100
    },
    "routes": [
      {
        "id": "lifi-route-1",
        "provider": "lifi",
        "bridgeUsed": "stargate",
        "fromChainId": 1,
        "toChainId": 42161,
        "fromAmount": "1000000000",
        "toAmount": "998500000",
        "toAmountMin": "988515000",
        "estimatedTime": 120,
        "gasCostUSD": "3.20",
        "totalFeeUSD": "0.50",
        "steps": [],
        "tags": ["FASTEST", "CHEAPEST"]
      }
    ],
    "bestRoute": {
      "id": "lifi-route-1",
      "provider": "lifi",
      "bridgeUsed": "stargate",
      "toAmount": "998500000",
      "toAmountMin": "988515000",
      "estimatedTime": 120,
      "gasCostUSD": "3.20",
      "totalFeeUSD": "0.50"
    },
    "routesByProvider": {
      "lifi": [{ "id": "lifi-route-1", "provider": "lifi", "toAmount": "998500000" }]
    },
    "stats": {
      "totalRoutes": 1,
      "timestamp": 1742900000000
    }
  }
}
POST/api/bridge/transaction

Build a bridge transaction for a route returned by GET /bridge/quote. Pass the full route object from the quote response. Returns calldata for the user to sign.

Parameters

ParameterTypeRequiredDescription
routeobjectYesRoute object returned by GET /bridge/quote (routes[] or bestRoute)
fromAddressstringYesSender wallet address
toAddressstringNoReceiver address (defaults to fromAddress)
slippageBpsnumberNoSlippage in basis points (default: 100)

Example Request

bash
curl -X POST "https://www.chainbridge.trading/api/bridge/transaction" \
  -H "Content-Type: application/json" \
  -d '{
    "route": {
      "id": "lifi-route-1",
      "provider": "lifi",
      "bridgeUsed": "stargate",
      "fromChainId": 1,
      "toChainId": 42161
    },
    "fromAddress": "0xYourWalletAddress",
    "slippageBps": 100
  }'

Example Response

json
{
  "success": true,
  "data": {
    "transaction": {
      "to": "0x1231DEB6f5749ef6cE6943a275A1D3E7486F4EaE",
      "data": "0x4630a0d8000000...",
      "value": "0",
      "gasLimit": "350000",
      "chainId": 1
    },
    "route": {
      "id": "lifi-route-1",
      "provider": "lifi",
      "bridgeUsed": "stargate",
      "fromChainId": 1,
      "toChainId": 42161
    }
  }
}
GET/api/price

Get real-time USD token prices from CoinGecko. Pass token contract addresses; prices are keyed by lowercased address and are null when unknown.

Parameters

ParameterTypeRequiredDescription
tokensstringYesComma-separated token contract addresses (max 100)
chainIdnumberNoChain ID (default: 1)

Example Request

bash
curl -X GET "https://www.chainbridge.trading/api/price?chainId=1&tokens=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" \
  -H "Content-Type: application/json"

Example Response

json
{
  "success": true,
  "data": {
    "chainId": 1,
    "prices": {
      "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": 3456.78,
      "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": 1.0001
    },
    "timestamp": 1742900000000
  }
}
GET/api/health

Health check endpoint. Returns service status and version information.

Example Request

bash
curl -X GET "https://www.chainbridge.trading/api/health"

Example Response

json
{
  "status": "healthy",
  "timestamp": "2026-03-25T12:00:00.000Z",
  "version": "0.1.0",
  "uptime": 86400,
  "checks": {
    "zerox": true,
    "coingecko": true
  }
}

Widget Integration

Embed the ChainBridge swap widget directly into your website. The widget provides a fully functional token swap interface with access to multiple 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
<style="color:#e06c75">iframe
  src=style="color:#98c379">"https:style="color:#5c6370style="color:#98c379">">//www.chainbridge.trading/embed?chainId=style="color:#d19a66">1&sellToken=USDC&buyToken=ETH"
  width=style="color:#98c379">"style="color:#d19a66">420"
  height=style="color:#98c379">"style="color:#d19a66">540"
  frameborder=style="color:#98c379">"style="color:#d19a66">0"
  style=style="color:#98c379">"border-radius: 16px; border: 1px solid #e5e7eb;"
  allow=style="color:#98c379">"clipboard-write"
  title=style="color:#98c379">"ChainBridge Swap Widget"
></style="color:#e06c75">iframe>
Query parameters:
  • chainId -- Default chain (1, 42161, 8453, 10, 137, 56, 43114, 59144)
  • sellToken -- Default sell token symbol
  • buyToken -- Default buy token symbol
  • theme -- Widget theme (light, dark, auto)

SDKComing Soon

The @jaleltounsi/chainbridge-sdk package will provide a typed TypeScript client for all ChainBridge APIs. Install via npm and start building in minutes.

bash
npm install @jaleltounsi/chainbridge-sdk

Planned API

typescript
import { ChainBridge } from '@jaleltounsi/chainbridge-sdk'

const cb = new ChainBridge() "color:#5c6370">// no API key required

"color:#5c6370">// Get best quote across multiple aggregators
const { bestQuote } = await cb.getQuote({
  sellToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', "color:#5c6370">// USDC
  buyToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',  "color:#5c6370">// WETH
  sellAmount: '1000000000',
  chainId: 1,
})

"color:#5c6370">// Build swap transaction(to, data, value, gas)
const tx = await cb.getSwapTransaction({
  sellToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  buyToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
  sellAmount: '1000000000',
  chainId: 1,
  takerAddress: '0xYourWallet',
  slippageBps: 100,
})

"color:#5c6370">// Bridge tokens cross-chain
const { bestRoute } = await cb.getBridgeQuote({
  fromChainId: 1,
  toChainId: 42161,
  fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  toToken: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
  fromAmount: '1000000000',
  fromAddress: '0xYourWallet',
})

"color:#5c6370">// Get real-time USD prices(keyed by lowercased address)
const { prices } = await cb.getPrice({
  chainId: 1,
  tokens: ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'],
})

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