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:
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.
Response
{
"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
| Field | Type | Description |
|---|---|---|
symbol | string | Trading pair identifier (e.g., "BTC/USD") |
min_order_size | string | Minimum order quantity in base currency |
max_order_size | string | Maximum order quantity in base currency |
quantity_precision | integer | Number of decimal places for order quantity |
price_precision | integer | Number of decimal places for price |
Retrieve Trading Limits
Get your account's trading limits, including daily volume caps and rate limits.
Response
{
"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.
Request Body
{
"symbol": "BTC/USD",
"side": "buy",
"quantity": "0.5",
"price_expiry": 30
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Trading pair (e.g., "BTC/USD") |
side | string | Yes | Order side: "buy" or "sell" |
quantity | string | Yes | Order quantity in base currency |
price_expiry | integer | No | Seconds the quote remains valid (1–60). Defaults to 30 if omitted. |
Response
{
"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.
Request Body
{
"quote_id": "q_7h3k9m2p4s6w8x"
}
Response
{
"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.
Connection & Subscription
Authenticate after connecting, then subscribe to the prices channel for one or more instruments:
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.
{
"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
| Field | Type | Description |
|---|---|---|
price | string | Indicative price at this level |
quantity | string | Indicative quantity available at this price in base currency |
Unsubscribing
ws.send(JSON.stringify({
action: 'unsubscribe',
channel: 'prices',
symbols: ['BTC/USD']
}));
Error Handling
All API errors follow a consistent format:
{
"success": false,
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance to execute trade",
"details": {
"required": "49121.15",
"available": "25000.00"
}
}
}
Common Error Codes
| Code | Description |
|---|---|
INVALID_API_KEY | API key is invalid or expired |
RATE_LIMIT_EXCEEDED | Too many requests — rate limit exceeded |
INVALID_INSTRUMENT | Requested instrument does not exist |
QUOTE_EXPIRED | Quote has expired and cannot be executed |
PRICE_EXPIRY_INVALID | price_expiry is outside the allowed range (1–60) |
INSUFFICIENT_BALANCE | Account balance insufficient for trade |
ORDER_SIZE_INVALID | Order size outside min/max limits |