ChainBridge

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

FeatureChainBridge0x API1inch API
Aggregators compared711
API key requiredNoYesYes
Cross-chain bridgeYes (7 chains)NoNo
Native BTC/DOGE/LTCYesNoNo
Gasless swapsYesYesYes
Transaction simulationYesNoNo
Embeddable widgetYesNoYes
SSE price streamingYesNoNo
TypeScript SDKYesYesYes

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.

GET/api/sor/quotes

Fetches 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

ParameterTypeRequiredDescription
chainIdnumberYesChain ID (1, 10, 42161, 8453)
sellTokenstringYesToken address to sell
buyTokenstringYesToken address to buy
sellAmountstringYesAmount in wei (BigInt string)
slippagenumberNoSlippage tolerance (default: 0.01)
takerAddressstringNoTrader wallet address
curl "https://www.chainbridge.trading/api/sor/quotes?\
  sellToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\
  buyToken=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&\
  sellAmount=1000000000&\
  chainId=1&\
  takerAddress=0xYourWallet"
POST/api/sor/swap

Generates 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
  }'
GET/api/sor/aggregators

Returns 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.

GET/api/bridge/quote

Fetches cross-chain bridge quotes from all providers. Compares routes by output amount, estimated time, and fees.

Query Parameters

ParameterTypeDescription
fromChainIdnumberSource chain ID
toChainIdnumberDestination chain ID
fromTokenstringSource token address
toTokenstringDestination token address
amountstringAmount in wei
fromAddressstringSender wallet address
curl "https://www.chainbridge.trading/api/bridge/quote?\
  fromChainId=1&\
  toChainId=42161&\
  fromToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&\
  toToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&\
  amount=1000000000&\
  fromAddress=0xYourWallet"
POST/api/bridge/transaction

Generates 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"
  }'
GET/api/bridge/status

Checks 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"
GET/api/bridge/chains

Returns 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.

GET/api/price

Returns current USD prices for specified tokens. Supports multiple addresses in a single request.

Query Parameters

ParameterTypeDescription
tokensstringComma-separated token addresses or CoinGecko IDs
currencystringTarget 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"