Foxbit WebSocket API (3.0)

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.

Introduction

Welcome to the official Foxbit's 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

Features

  • Robust Functionality: Explore the wide range of functionalities our websocket offers, including fetching real-time market data, receive updates about orders, trades and much more.
  • Detailed Guides: Step-by-step guides and tutorials help you get started quickly and navigate complex features effortlessly.
  • Comprehensive Reference: Dive deep into our API endpoints, parameters, and response structures with our detailed reference documentation.

This API provides public channels, accessible through specific URLs:

  • Public WebSocket: wss://api.foxbit.com.br/ws/v3/public

You can view the full list of available channels for both public subscriptions in the navigation menu.

Start Exploring

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! 🚀

Need More?

If you don't find something here, you can check our others API's documentation:

See all available APIs

Rate Limit

The Rate Limit is divided into five topics, these being connection, concurrent connection, subscriptions by message, subscriptions by connections 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
Connections per period 10 connection per 2 seconds
Messages per period 10 messages per 2 seconds
Concurrent connections 30 concurrent connections
Subscriptions per message 25 subscriptions per message
Subscriptions per connections 50 subscriptions per connection

Ping

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

Message Payload

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

Array
channel
string

The specific channel designated for action execution

{
  • "type": "message",
  • "params": [
    ]
}

Success

This message will be sent when 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

channel
string

The channel that you sent the message

object

The data returned by the server

message
string

The message returned by the server

{
  • "type": "message",
  • "event": "success",
  • "params": {
    },
  • "data": {
    }
}

Ticker

Provides a 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.

Message Payload

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.

One of
type
string

The desired event to be executed

Value: "subscribe"
Array of objects

An array of channels intended for action execution

Array
channel
string

The specific channel designated for action execution

market_symbol
string

The market symbol targeted for action execution

Example
{
  • "type": "subscribe",
  • "params": [
    ]
}

Subscribe success

This message will be sent when 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

channel
string

The subscribed channel

market_symbol
string

The subscribed market

{
  • "type": "subscribe",
  • "event": "success",
  • "params": {
    }
}

Unsubscribe success

This message will be sent when 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

channel
string

The unsubscribed channel

market_symbol
string

The unsubscribed market

{
  • "type": "unsubscribe",
  • "event": "success",
  • "params": {
    }
}

Invalid market response

This message will be sent when user sent invalid payload, the connection will be closed automatically when errors 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'"
}

Ticker update event

This message will be sent at every market change if user have successfully subscribed

type
string

The executed event

event
string

The event emitted by the server

object

Channel data on which the event was emitted

channel
string

The subscribed channel

market_symbol
string

The subscribed market

object

Update data emitted by the channel

object

The best market values

object

Last traded values for the currency

object

Last twenty-four hours data for the market

ts
integer

The time this information was provided, in POSIX format

{
  • "type": "subscribe",
  • "event": "update",
  • "params": {
    },
  • "data": {
    }
}

Orderbook

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:

  • 100ms
  • 250ms
  • 500ms
  • 1000ms (default)

Message Payload

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.

One of
type
string

The desired event to be executed

Value: "subscribe"
Array of objects

An array of channels intended for action execution

Array
channel
string

The specific channel designated for action execution

market_symbol
string

The market symbol targeted for action execution

snapshot
boolean
Default: false

If you want to receive a snapshot of the orderbook when subscribing to the channel, send the flag snapshot as true. For more information, see Orderbook snapshot event.

Example
{
  • "type": "subscribe",
  • "params": [
    ]
}

Subscribe success

This message will be sent when 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

channel
string

The subscribed channel

market_symbol
string

The subscribed market

{
  • "type": "subscribe",
  • "event": "success",
  • "params": {
    }
}

Unsubscribe success

This message will be sent when 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

channel
string

The unsubscribed channel

market_symbol
string

The unsubscribed market

{
  • "type": "unsubscribe",
  • "event": "success",
  • "params": {
    }
}

Orderbook snapshot event

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 100 levels for both buy and sell sides.

Purpose and Usage:

  • Initial State: The snapshot gives you the current state of buy and sell orders at the moment of subscription
  • Memory Management: Use this data to build your initial in-memory orderbook structure before processing incremental updates
  • Synchronization: The snapshot includes a 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:

  1. Subscribe to the orderbook channel with snapshot param as true
  2. Receive and process the complete snapshot to build your initial orderbook state
  3. Store the sequence_id from the snapshot
  4. Process all subsequent update events sequentially using their first_sequence_id and last_sequence_id to maintain your local orderbook

Example 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

channel
string

The subscribed channel

market_symbol
string

The subscribed market

object

Update data emitted by the channel

sequence_id
integer

The sequence id of the orderbook

Array of objects

The asks of the orderbook ordered ascending by price. The first item is the price and the second is the quantity.

Array of objects

The bids of the orderbook ordered descending by price. The first item is the price and the second is the quantity.

{
  • "type": "subscribe",
  • "event": "snapshot",
  • "params": {
    },
  • "data": {
    }
}

Invalid market response

This message will be sent when user sent invalid payload, the connection will be closed automatically when errors 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'"
}

Orderbook update event

This message will be sent at every market change if user have successfully subscribed

type
string

The executed event

event
string

The event emitted by the server

object

Channel data on which the event was emitted

channel
string

The subscribed channel

market_symbol
string

The subscribed market

object

Update data emitted by the channel

ts
integer

The time this information was provided, in POSIX format

first_sequence_id
integer

The first sequence id of the orderbook

last_sequence_id
integer

The last sequence id of the orderbook

Array of objects

The asks of the orderbook. The first item is the price and the second is the quantity.

Array of objects

The bids of the orderbook. The first item is the price and the second is the quantity.

{
  • "type": "subscribe",
  • "event": "update",
  • "params": {
    },
  • "data": {
    }
}

Candle

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

Message Payload

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.

One of
type
string

The desired event to be executed

Value: "subscribe"
Array of objects

An array of channels intended for action execution

Array
channel
string

The specific channel designated for action execution + the interval

market_symbol
string

The market symbol targeted for action execution

Example
{
  • "type": "subscribe",
  • "params": [
    ]
}

Subscribe success

This message will be sent when 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

channel
string

The subscribed channel

market_symbol
string

The subscribed market

{
  • "type": "subscribe",
  • "event": "success",
  • "params": {
    }
}

Unsubscribe success

This message will be sent when 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

channel
string

The unsubscribed channel

market_symbol
string

The unsubscribed market

{
  • "type": "unsubscribe",
  • "event": "success",
  • "params": {
    }
}

Invalid market response

This message will be sent when user sent invalid payload, the connection will be closed automatically when errors 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'"
}

Candle update event

This message will be sent at every market change if user have successfully subscribed

type
string

The executed event

event
string

The event emitted by the server

object

Channel data on which the event was emitted

channel
string

The subscribed channel

market_symbol
string

The subscribed market

Array of objects[ items ]

Update data emitted by the channel

Array
Array
0
number

The timestamp of the candle

1
string

The highest price of the candle

2
string

The lowest price of the candle

3
string

The opening price of the candle

4
string

The closing price of the candle

5
string

The volume of the candle

{
  • "type": "subscribe",
  • "event": "update",
  • "params": {
    },
  • "data": [
    ]
}

Trades

Provides a real-time feed of executed trades, showing each transaction’s price, quantity, timestamp and taker sides. Users will receive updates as trades occur until they send an unsubscribe call.

Message Payload

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.

One of
type
string

The desired event to be executed

Value: "subscribe"
Array of objects

An array of channels intended for action execution

Array
channel
string

The specific channel designated for action execution

market_symbol
string

The market symbol targeted for action execution

Example
{
  • "type": "subscribe",
  • "params": [
    ]
}

Subscribe success

This message will be sent when 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

channel
string

The subscribed channel

market_symbol
string

The subscribed market

{
  • "type": "subscribe",
  • "event": "success",
  • "params": {
    }
}

Unsubscribe success

This message will be sent when 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

channel
string

The unsubscribed channel

market_symbol
string

The unsubscribed market

{
  • "type": "unsubscribe",
  • "event": "success",
  • "params": {
    }
}

Invalid market response

This message will be sent when user sent invalid payload, the connection will be closed automatically when errors 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'"
}

Trade update event

This message will be sent at every market change if user have successfully subscribed

type
string

The executed event

event
string

The event emitted by the server

object

Channel data on which the event was emitted

channel
string

The subscribed channel

market_symbol
string

The subscribed market

Array of objects

Update data emitted by the channel

Array
id
number

The trade id

quantity
string

The amount of the trade

price
string

The price at which the trade occurred

taker_side
enum
Enum: "BUY" "SELL"

The taker side of the trade

ts
number

The timestamp indicating the time of the trade

{
  • "type": "subscribe",
  • "event": "update",
  • "params": {
    },
  • "data": [
    ]
}