Follow our Status Page for real-time updates on system performance and maintenance schedules.
You can also subscribe to receive notifications about any incidents or scheduled maintenance that may affect the API's availability.
For support with the Foxbit API, please visit our Help Center.
Welcome to Foxbit's official trader and developer documentation! Here, you'll find everything you need to know to integrate and utilize our services effectively. Whether you're a seasoned trader or just starting out, our comprehensive documentation provides clear guidance on how to make the most out of our API.
We also have a full API usage examples repository demonstrating how to integrate and utilize our API, and in JavaScript for the WebSocket example: Example Repository
This API provides both public and private channels, each accessible through specific URLs:
You can view the full list of available channels for both public and private subscriptions in the navigation menu.
Ready to get started? Dive into our documentation and unleash the full potential of our Exchange API. Whether you're building trading automation, conducting research, or developing innovative solutions, our API provides the tools you need to succeed.
Happy coding! 🚀
If you don't find something here, you can check our other APIs' documentation:
A changelog is a record of all notable changes made to this API, including new features, bug fixes and updates. It helps users and developers stay informed about the evolution of the project. For more details, visit our changelog page.
The Rate Limit is divided into five topics, these being connection, concurrent connection, subscriptions by message, subscriptions by connection and messages by period.
Note: Rate limits for public connections are controlled by IP Address.
If a channel does not have rate limit information in its documentation, it will use our global rate limit values:
| # | Public | Private |
|---|---|---|
| Connections per period | 10 connections per 2 seconds | 10 connections per 2 seconds |
| Messages per period | 10 messages per 2 seconds | 10 messages per 2 seconds |
| Concurrent connections | 30 concurrent connections | 30 concurrent connections |
| Subscriptions per message | 25 subscriptions per message | 25 subscriptions per message |
| Subscriptions per connection | 50 subscriptions per connection | - |
Secure access to private WebSocket functionality requires authentication. This section explains the end-to-end flow, signature generation, recommended client practices, and common troubleshooting hints to help you get connected quickly and reliably.
Authentication is performed on the private WebSocket by sending a login message that includes a timestamp and an HMAC-SHA256 signature. The signature is generated with your private API key by concatenating the timestamp with the literal string login and hashing the result. If the signature is valid and within the allowed time window, the server responds with a success event and the connection becomes authorized to subscribe to private channels.
The server validates that the provided timestamp is recent. For stable connectivity, keep your client clock synchronized (e.g., via NTP) and generate the timestamp as close as possible to the moment you send the message. Large clock skews can cause the request to be rejected.
To create the signature, you can use the following code:
import CryptoJS from 'crypto-js';
const timestamp = Date.now();
const signature = CryptoJS.HmacSHA256(`${timestamp}login`, privateKey).toString();
Example in Python:
import hmac, hashlib, time
timestamp = str(int(time.time() * 1000))
payload = f"{timestamp}login".encode()
signature = hmac.new(private_key.encode(), payload, hashlib.sha256).hexdigest()
timestamp and corresponding signature.${timestamp}login (no spaces, encoding issues, or extra characters).timestamp and signature in a secure, redacted way during development.The Ping channel enables users to verify their connection to the server. When a ping is sent, the server will respond with a "success" event message if the connection is active.
Additionally, the Ping channel can be used to keep the connection alive. If the connection remains idle for too long, the server will close it. Regularly sending pings prevents this from happening. This functionality is available for both public and private connections. Recommendation: It is recommended to send a ping message every 20 seconds for each open connection to maintain optimal connection health and prevent automatic disconnection due to inactivity.
To send a ping, use the following message format:
| type | string Value: "message" The desired event to be executed |
Array of objects An array of channels intended for action execution |
{- "type": "message",
- "params": [
- {
- "channel": "ping"
}
]
}This message will be sent when the user was successfully pinged
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object The data returned by the server |
{- "type": "message",
- "event": "success",
- "params": {
- "channel": "ping"
}, - "data": {
- "message": "pong"
}
}Provides summary data for a market, including the latest traded price, volume, and price changes over 24hr. Users will receive updates every 1000ms until they send an unsubscribe call.
To subscribe or unsubscribe from WebSocket channels, use the following message format: The type field determines the action ("subscribe" or "unsubscribe"), while params specifies the target channels and markets.
| type | string The desired event to be executed Value: "subscribe" |
Array of objects An array of channels intended for action execution |
{- "type": "subscribe",
- "params": [
- {
- "channel": "ticker",
- "market_symbol": "btcbrl"
}
]
}This message will be sent when the user was successfully subscribed to the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "subscribe",
- "event": "success",
- "params": {
- "channel": "ticker",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user was successfully unsubscribed from the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "unsubscribe",
- "event": "success",
- "params": {
- "channel": "ticker",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user sends an invalid payload; the connection will be closed automatically when an error occurs
| type | string The executed event |
| event | string The event emitted by the server |
| message | string Subscription error |
{- "type": "subscribe",
- "event": "error",
- "message": "Invalid market 'invalid-market' for channel 'channel'"
}This message will be sent at every market change if the user has successfully subscribed
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "ticker",
- "market_symbol": "btcbrl"
}, - "data": {
- "best": {
- "bid": "6423.57",
- "ask": "6436.53"
}, - "last_traded": {
- "price": "6423.57",
- "quantity": "0.96183964"
}, - "rolling_24h": {
- "price_change": "-0.4165607307408487",
- "price_change_percent": 10,
- "volume": "4319.63870783",
- "trades_count": 10585,
- "low": "4433",
- "high": "11111",
- "open": "6249.64"
}, - "ts": 1717788720000
}
}Streams the current bid and ask orders in the market, showing price levels and available quantities. Users will receive updates every 1000ms by default, unless a different interval is specified, until they send an unsubscribe call.
Available intervals:
To subscribe or unsubscribe from WebSocket channels, use the following message format: The type field determines the action ("subscribe" or "unsubscribe"), while params specifies the target channels and markets.
| type | string The desired event to be executed Value: "subscribe" |
Array of objects An array of channels intended for action execution |
{- "type": "subscribe",
- "params": [
- {
- "channel": "orderbook-1000",
- "market_symbol": "btcbrl",
- "snapshot": true
}
]
}This message will be sent when the user was successfully subscribed to the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "subscribe",
- "event": "success",
- "params": {
- "channel": "orderbook-1000",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user was successfully unsubscribed from the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "unsubscribe",
- "event": "success",
- "params": {
- "channel": "orderbook-100",
- "market_symbol": "btcbrl"
}
}This message provides a snapshot of the current orderbook state when you first subscribe to the orderbook channel. The snapshot is essential for initializing your local orderbook copy and serves as the foundation for maintaining an accurate, real-time orderbook in memory.
Depth: The orderbook snapshot returns the top 300 levels for both buy and sell sides.
Purpose and Usage:
sequence_id which is crucial for maintaining data consistency Sequential Processing:
After receiving the snapshot, all subsequent orderbook update events will be sequential and incremental. Each update event includes first_sequence_id and last_sequence_id to ensure you don't miss any orderbook changes and can maintain a perfectly synchronized local copy.
Implementation Strategy:
sequence_id from the snapshotfirst_sequence_id and last_sequence_id to maintain your local orderbookExample Implementation: For a complete example of how to manage the orderbook in memory using JavaScript, check out our sample implementation: JavaScript Orderbook Management Example
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object Update data emitted by the channel |
{- "type": "subscribe",
- "event": "snapshot",
- "params": {
- "channel": "orderbook",
- "market_symbol": "btcbrl"
}, - "data": {
- "sequence_id": 123321,
- "asks": [
- [
- "1000000.00",
- "0.0001"
]
], - "bids": [
- [
- "1000000.00",
- "0.0001"
]
]
}
}This message will be sent when the user sends an invalid payload; the connection will be closed automatically when an error occurs
| type | string The executed event |
| event | string The event emitted by the server |
| message | string Subscription error |
{- "type": "subscribe",
- "event": "error",
- "message": "Invalid market 'invalid-market' for channel 'channel'"
}This message will be sent at every market change if the user has successfully subscribed
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "orderbook-100",
- "market_symbol": "btcbrl"
}, - "data": {
- "ts": 1661538954309,
- "first_sequence_id": 1,
- "last_sequence_id": 10,
- "asks": [
- [
- "1000000.00",
- "0.0001"
]
], - "bids": [
- [
- "1000000.00",
- "0.0001"
]
]
}
}Streams aggregated market data over fixed time intervals (e.g., 1m, 5m, 1h), including open, high, low, close prices, and traded volume. Users will receive updates at the end of each interval until they send an unsubscribe call.
Available intervals:
| time | 1m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 12h | 1d | 1w | 2w |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| seconds | 60 | 300 | 900 | 1800 | 3600 | 7200 | 14400 | 21600 | 43200 | 86400 | 604800 | 1209600 |
To subscribe or unsubscribe from WebSocket channels, use the following message format: The type field determines the action ("subscribe" or "unsubscribe"), while params specifies the target channels and markets.
| type | string The desired event to be executed Value: "subscribe" |
Array of objects An array of channels intended for action execution |
{- "type": "subscribe",
- "params": [
- {
- "channel": "candle-60",
- "market_symbol": "btcbrl"
}
]
}This message will be sent when the user was successfully subscribed to the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "subscribe",
- "event": "success",
- "params": {
- "channel": "candle-60",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user was successfully unsubscribed from the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "unsubscribe",
- "event": "success",
- "params": {
- "channel": "candle-60",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user sends an invalid payload; the connection will be closed automatically when an error occurs
| type | string The executed event |
| event | string The event emitted by the server |
| message | string Subscription error |
{- "type": "subscribe",
- "event": "error",
- "message": "Invalid market 'invalid-market' for channel 'channel'"
}This message will be sent at every market change if the user has successfully subscribed
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
Array of objects[ items ] Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "candle-60",
- "market_symbol": "btcbrl"
}, - "data": [
- 1685019840000,
- "133294.4051",
- "131389.5942",
- "133294.405",
- "131389.5942",
- "0.0172"
]
}Provides a real-time feed of executed trades, showing each transaction’s price, quantity, timestamp and taker side. Users will receive updates as trades occur until they send an unsubscribe call.
To subscribe or unsubscribe from WebSocket channels, use the following message format: The type field determines the action ("subscribe" or "unsubscribe"), while params specifies the target channels and markets.
| type | string The desired event to be executed Value: "subscribe" |
Array of objects An array of channels intended for action execution |
{- "type": "subscribe",
- "params": [
- {
- "channel": "trades",
- "market_symbol": "btcbrl"
}
]
}This message will be sent when the user was successfully subscribed to the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "subscribe",
- "event": "success",
- "params": {
- "channel": "trades",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user was successfully unsubscribed from the channel with specified market data
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "unsubscribe",
- "event": "success",
- "params": {
- "channel": "trades",
- "market_symbol": "btcbrl"
}
}This message will be sent when the user sends an invalid payload; the connection will be closed automatically when an error occurs
| type | string The executed event |
| event | string The event emitted by the server |
| message | string Subscription error |
{- "type": "subscribe",
- "event": "error",
- "message": "Invalid market 'invalid-market' for channel 'channel'"
}This message will be sent at every market change if the user has successfully subscribed
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
Array of objects Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "trade",
- "market_symbol": "btcbrl"
}, - "data": [
- {
- "id": 123456789,
- "quantity": "0.0001",
- "price": "100000",
- "taker_side": "BUY",
- "ts": 1629820800000
}
]
}The Login channel is used to authenticate and authorize a user on the Private WebSocket connection. By sending a login message with a valid timestamp and signature, users can gain access to private channels that provide real-time updates about their account activities, such as orders, trades, and balances.
For more information about the signature generation, please refer to the Authentication section.
To authenticate, send a login message with the following format:
| type | string Value: "login" The desired event to be executed |
object An object with authentication data |
{- "type": "login",
- "params": {
- "timestamp": 1717788720000,
- "api_key": "your-api-key",
- "signature": "generated-signature"
}
}This message will be sent when the user was successfully authenticated. After receiving it, you can safely subscribe to private channels.
| type | string The executed event |
| event | string The event emitted by the server |
object An object with authentication data | |
object The data returned by the server |
{- "type": "login",
- "event": "success",
- "params": {
- "timestamp": 1717788720000,
- "api_key": "your-api-key",
- "signature": "generated-signature"
}, - "data": {
- "authenticated": true
}
}If the signature is invalid, the timestamp is too old, or the key has been revoked, the server will respond with an error. Typical causes include:
timestamp when retrying.The following failure schema describes the error response:
| type | string The executed event |
| event | string The event emitted by the server |
object An object with authentication data | |
object The data returned by the server |
{- "type": "message",
- "event": "error",
- "params": {
- "timestamp": 1717788720000,
- "api_key": "your-api-key",
- "signature": "generated-signature"
}, - "data": {
- "authenticated": true,
- "message": "Invalid signature"
}
}The Account Events channel provides real-time notifications about all activities in your trading account. This channel is essential for monitoring your portfolio, tracking order execution, and building automated trading strategies. Users will receive updates continuously until they send an unsubscribe call.
Note: This channel requires authentication on the Private WebSocket connection. Ensure you have successfully authenticated before attempting to subscribe.
Available event types:
Common use cases:
To subscribe to account events, send a subscription message through your authenticated WebSocket connection. Unlike public channels, account events don't require market symbols as they cover all activity across your account.
| type | string Enum: "subscribe" "unsubscribe" The desired event to be executed |
Array of objects An array of channels intended for action execution |
{- "type": "subscribe",
- "params": [
- {
- "channel": "accounts",
- "type": "BALANCE"
}
]
}This message will be sent when you have successfully subscribed to the Account Events channel. From this point, you will receive real-time updates for all balance, order, and trade events as they occur in your account.
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted |
{- "type": "subscribe",
- "event": "success",
- "params": {
- "channel": "accounts",
- "type": "BALANCE"
}
}This message will be sent whenever your account balance changes, including when funds are locked for orders, unlocked from cancellations, or updated due to deposits, withdrawals, or trade executions. Each event includes both available and locked amounts for the affected currency.
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "accounts",
- "type": "BALANCE"
}, - "data": {
- "currency_symbol": "btc",
- "available": "12.345",
- "hold": "0.000",
- "ts": 1717788720000
}
}This message will be sent at every stage of your order lifecycle, including when orders are created, partially filled, fully filled, cancelled, or rejected. The event provides complete order details including status, filled quantity, remaining quantity, and timestamps.
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "accounts",
- "type": "ORDER"
}, - "data": {
- "id": 123456,
- "client_order_id": 654321,
- "market_symbol": "btcbrl",
- "side": "BUY",
- "instant_amount": "10.000",
- "instant_amount_executed": "5.000",
- "quantity": "0.005",
- "quantity_executed": "0.0025",
- "price": "20000.00",
- "avg_price": "19999.99",
- "state": "FILLED",
- "error_message": "Insufficient funds",
- "cancellation_reason": 100,
- "ts": 1717788720000
}
}This message will be sent each time one of your orders is matched and executed in the market. A single order may generate multiple trade events if it's filled incrementally by matching with different orders in the book. Each event includes execution price, quantity, fees, and whether you were the maker or taker.
| type | string The executed event |
| event | string The event emitted by the server |
object Channel data on which the event was emitted | |
object Update data emitted by the channel |
{- "type": "subscribe",
- "event": "update",
- "params": {
- "channel": "accounts",
- "type": "TRADE"
}, - "data": {
- "id": 123456,
- "order": {
- "id": 123456,
- "client_order_id": 654321,
- "market_symbol": "btcbrl",
- "side": "BUY"
}, - "price": "20000.00",
- "quantity": "0.005",
- "fee": "0.0001",
- "fee_currency_symbol": "btc",
- "role": "MAKER",
- "ts": 1717788720000
}
}