API Documentation

Complete reference for integrating with TOB Liquidity API. Access institutional-grade liquidity programmatically with our RESTful API and WebSocket price feed.

Authentication

All API requests require authentication using API keys. You can generate API keys from your account dashboard.

API Key Authentication

Include your API key in the request headers:

Headers
X-API-Key: your_api_key_here
X-API-Secret: your_api_secret_here
Content-Type: application/json

Generate API Credentials

Navigate to Settings → API Keys → Generate New Key in your dashboard. Store your API secret securely — it will only be shown once.

Retrieve List of Instruments

Get all available trading instruments with their specifications including min/max order sizes and precision requirements.

GET /api/v1/instruments

Response

JSON
{
  "success": true,
  "data": [
    {
      "symbol": "BTC/USD",
      "base_currency": "BTC",
      "quote_currency": "USD",
      "min_order_size": "0.001",
      "max_order_size": "100.0",
      "quantity_precision": 8,
      "price_precision": 2,
      "status": "active"
    },
    {
      "symbol": "ETH/USD",
      "base_currency": "ETH",
      "quote_currency": "USD",
      "min_order_size": "0.01",
      "max_order_size": "1000.0",
      "quantity_precision": 8,
      "price_precision": 2,
      "status": "active"
    }
  ]
}

Response Fields

FieldTypeDescription
symbolstringTrading pair identifier (e.g., "BTC/USD")
min_order_sizestringMinimum order quantity in base currency
max_order_sizestringMaximum order quantity in base currency
quantity_precisionintegerNumber of decimal places for order quantity
price_precisionintegerNumber of decimal places for price

Retrieve Trading Limits

Get your account's trading limits, including daily volume caps and rate limits.

GET /api/v1/account/limits

Response

JSON
{
  "success": true,
  "data": {
    "daily_volume_limit": "10000000.00",
    "daily_volume_used": "1247832.50",
    "daily_volume_remaining": "8752167.50",
    "rate_limit_requests_per_second": 100,
    "rate_limit_requests_per_minute": 5000,
    "account_tier": "institutional",
    "instruments": [
      {
        "symbol": "BTC/USD",
        "max_position_size": "50.0",
        "current_position": "0.0"
      }
    ]
  }
}

Request a Quote

Request a firm quote for a specific instrument and quantity. Use price_expiry to control how long the returned quote remains valid before it must be executed.

POST /api/v1/quotes/request

Request Body

JSON
{
  "symbol": "BTC/USD",
  "side": "buy",
  "quantity": "0.5",
  "price_expiry": 30
}

Parameters

ParameterTypeRequiredDescription
symbolstringYesTrading pair (e.g., "BTC/USD")
sidestringYesOrder side: "buy" or "sell"
quantitystringYesOrder quantity in base currency
price_expiryintegerNoSeconds the quote remains valid (1–60). Defaults to 30 if omitted.

Response

JSON
{
  "success": true,
  "data": {
    "quote_id": "q_7h3k9m2p4s6w8x",
    "symbol": "BTC/USD",
    "side": "buy",
    "quantity": "0.5",
    "price": "98242.30",
    "total": "49121.15",
    "expires_at": "2026-02-14T15:23:45.123Z",
    "valid_for_seconds": 30
  }
}

Execute a Quote

Execute a previously requested quote using its quote ID. The quote must be executed before its expires_at timestamp.

POST /api/v1/quotes/execute

Request Body

JSON
{
  "quote_id": "q_7h3k9m2p4s6w8x"
}

Response

JSON
{
  "success": true,
  "data": {
    "trade_id": "t_8x4y9z2a5b7c3d",
    "quote_id": "q_7h3k9m2p4s6w8x",
    "symbol": "BTC/USD",
    "side": "buy",
    "quantity": "0.5",
    "price": "98242.30",
    "total": "49121.15",
    "fee": "49.12",
    "status": "filled",
    "executed_at": "2026-02-14T15:23:42.789Z"
  }
}

Indicative Price Feed

Subscribe to a real-time indicative price stream via WebSocket. Prices are streamed continuously for each subscribed instrument and reflect current mid-market rates. These prices are indicative only — use the RFQ endpoints to obtain a firm, executable quote.

WS wss://api.tobliquidity.com/v1/ws

Connection & Subscription

Authenticate after connecting, then subscribe to the prices channel for one or more instruments:

JavaScript
const ws = new WebSocket('wss://api.tobliquidity.com/v1/ws');

ws.onopen = () => {
  // Authenticate
  ws.send(JSON.stringify({
    action: 'authenticate',
    api_key: 'your_api_key',
    api_secret: 'your_api_secret'
  }));

  // Subscribe to indicative prices for specific instruments
  ws.send(JSON.stringify({
    action: 'subscribe',
    channel: 'prices',
    symbols: ['BTC/USD', 'ETH/USD', 'SOL/USD']
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  console.log('Price update:', msg);
};

Price Update Message

The server pushes a message each time the order book changes for a subscribed instrument. Each update contains the current bid and ask price levels, with the indicative quantity available at each level. Bids are ordered highest price first; asks are ordered lowest price first.

JSON
{
  "channel": "prices",
  "type": "update",
  "timestamp": "2026-02-14T15:23:45.123Z",
  "data": {
    "symbol": "BTC/USD",
    "bids": [
      { "price": "98234.50", "quantity": "1.500" },
      { "price": "98230.00", "quantity": "3.200" },
      { "price": "98220.00", "quantity": "7.800" }
    ],
    "asks": [
      { "price": "98242.30", "quantity": "0.800" },
      { "price": "98250.00", "quantity": "2.500" },
      { "price": "98260.00", "quantity": "5.100" }
    ]
  }
}

Price Level Fields

FieldTypeDescription
pricestringIndicative price at this level
quantitystringIndicative quantity available at this price in base currency

Unsubscribing

JavaScript
ws.send(JSON.stringify({
  action: 'unsubscribe',
  channel: 'prices',
  symbols: ['BTC/USD']
}));

Error Handling

All API errors follow a consistent format:

JSON
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Insufficient balance to execute trade",
    "details": {
      "required": "49121.15",
      "available": "25000.00"
    }
  }
}

Common Error Codes

CodeDescription
INVALID_API_KEYAPI key is invalid or expired
RATE_LIMIT_EXCEEDEDToo many requests — rate limit exceeded
INVALID_INSTRUMENTRequested instrument does not exist
QUOTE_EXPIREDQuote has expired and cannot be executed
PRICE_EXPIRY_INVALIDprice_expiry is outside the allowed range (1–60)
INSUFFICIENT_BALANCEAccount balance insufficient for trade
ORDER_SIZE_INVALIDOrder size outside min/max limits