WhiteBIT API is an automation tool that allows developers to create programs and applications to interact with our exchange. It can be used to perform such actions as creating and managing orders to buy and sell cryptocurrencies, getting information about the market, account balance, and much more.
How to use WhiteBIT API?
Before we can start using the API, we need to enable two-factor authentication (2FA) on the account.
After that, you need to generate API keys, which are used to authenticate the user and provide integration with the API.
Follow the simple instructions to activate the keys:
- Go to API settings in your account and select "Edit" in the appropriate section;
- After clicking "Generate API Key", enter your 2FA code;
- In the window that appears, you will see a pair of API keys - make sure to save them, as you will need them for further authentication of operations in the API interface.
Make sure you keep your Secret Key securely stored, as it will not be recoverable once you close this page. At the same time, your Public Key is always available, and it is not a threat when shared with third parties. Unlike the Secret Key, the Public Key itself offers little opportunity for unwanted actions.
- On the same page, you can also select the endpoints you plan to use. For API key testing purposes, it is recommended that you select all available endpoints, as you will be able to edit this selection in the future. More information about endpoints will be provided later in the article;
- Then, confirm your actions by entering the 2FA code;
- And there you go, your API keys are ready to use!
After creating an API key pair, it is also possible to change IP access. Using the IP address access restriction feature, you can include your own IPv4 and IPv6 addresses in the list of trusted IP addresses.
When this function is activated, if a request for API keys is sent from another IP address, the API keys are automatically deactivated. A notification will be sent to your email address with the public key and the IP address from which the request was sent.
If this IP address belongs to you and is trusted, the API can be reactivated by adding it to the list of trusted IP addresses.
You can add up to 20 addresses to the list of trusted IP addresses.
Back to the list of available endpoints to use, it is important to note that each of the categories and subcategories presented is responsible for a different group of operations for managing your exchange account. You can create and use your keys to perform operations in one or more of the following available categories:
- Deposit
- Withdrawal
- Transfer between balances
- Wallet balance and history
- Codes
- Trading Balance and History
- Order Management
More detailed information about the functionality of our exchange's API can be found in the technical manual, which is presented in a simple and accessible format.
Extended documentation is also available in the public software repository on GitHub.
You can also use DEMO tokens to test the functionality of our API.
WhiteBIT Webhook
Webhook is used to receive feedback from the server about the execution of various processes on your account, such as successful withdrawal of funds or activation of a WB code.
To activate Webhook keys, you need to follow similar steps as for API keys in the Webhook settings section of your account. There are several ways of activation:
- Adding the public key to the TXT domain record specified when creating the key;
- Adding the file “whiteBIT-verification.txt” with the contents of your Webhook public key to the root folder of your site;
- Creating a “check-wb-webhooks” endpoint on your server that will return the Webhook public key.
To start activating a Webhook key, you need to create it on the exchange. It should be noted that you can create only one Webhook key. To do this, follow the steps below:
- Go to Webhook settings in your account and select “Edit” in the appropriate section;
- As with creating API keys, be sure to save the Secret Key in a safe place. Once you close the page with the “Confirm” button, the Secret Key will no longer be available;
- Done! Webhook keys will be created.
Note that, as with API keys, creating a Webhook key does not automatically enable it. You must move the slider to the active position to activate Webhook.
More detailed information on setting up and using Webhook can be found in the relevant section of our Webhook documentation.
Real-Time Best Bid/Ask WebSocket
Access to real-time market data is a critical requirement in high-frequency trading and automated execution systems. To meet this demand, we have implemented a dedicated WebSocket stream that delivers live updates of the best bid and ask prices for all supported markets. This stream is optimized for low latency and high reliability, enabling trading systems to decide based on the most up-to-date pricing information.
What the Stream Provides
The Best Bid/Ask WebSocket stream provides a continuous data flow reflecting the top-of-book prices for each symbol. Each update includes the highest available buy price (best bid) and the lowest available sell price (best ask), along with the corresponding quantities and trading pair identifier. The structure is optimized to deliver only the most relevant data, avoiding unnecessary noise while preserving accuracy and speed.
Each message includes two timestamps to ensure complete transparency and support latency-sensitive operations. The first is the Event Time, representing the moment our WebSocket server dispatches the message. The second is the Update Time, which indicates when the pricing data was last modified at the matching engine level. This dual-timestamp approach enables clients to calculate transmission delays and validate data freshness with high precision. This consistency makes integration easier for clients familiar with similar market data protocols.
Operational Advantages
This stream is particularly suited for use cases that require immediate access to accurate pricing, such as automated trading systems and market-making algorithms. It allows clients to maintain a real-time view of market conditions, detect spread changes, and execute trades based on current data.
One of the key benefits of this stream is its ultra-low latency, with updates being broadcast immediately after internal state changes are registered. This ensures that clients are operating with the latest possible information. The stream also simplifies spread calculation and allows for efficient tracking of liquidity levels at the top of the book. By exposing both the data update time and the message dispatch time, the system supports comprehensive monitoring of network delays and market reaction windows.
Integration and Message Structure
Clients can connect to the WebSocket endpoint and subscribe to updates for selected trading pairs. Each message is delivered in JSON format and includes clearly defined fields for the symbol, bid and ask prices, respective volumes, and the two timestamps. The format is intentionally lightweight to support high-throughput environments and to reduce parsing complexity on the client side.
The Best Bid/Ask WebSocket stream is an essential infrastructure component for real-time trading. It offers immediate visibility into the market's most competitive buy and sell prices, complete with precise timing information. This stream is engineered to support fast, informed, and automated trading decisions, providing a reliable foundation for any strategy that depends on top-of-book data.
What are the most common questions that come up?
What happens to API and Webhook keys when two-factor authentication (2FA) is disabled?
- When 2FA is turned off, your API and Webhook keys will be disabled and can only be reactivated when 2FA is turned on.
Is it possible to create and activate API and Webhook keys via the WhiteBIT mobile app?
- Unfortunately, no. The process of creating and activating keys is available only in the web version of our exchange.
Do API keys have an expiry date and how many can be created?
- If an API key remains inactive for 14 days, it will be automatically deactivated for security purposes. The maximum limit of keys available is 50 keys.
Can I use a random domain to test the performance of Webhook keys?
- Our system does not allow such action. To activate Webhook key, you need to confirm ownership of the domain.
Possible errors when using the API
This action is unauthorized. Enable your key in API settings.
If you encounter this error, please check whether you have enabled your API key. To activate it, move the “Endpoint access” slider next to the desired endpoint.
If you have previously set an IP restriction, your API key may be deactivated when used from a new IP address. A corresponding email will be sent to your email address.
Please note: if you are sure that you used the API key from your IP address, you can add it to the list of trusted IP addresses. If you do not know this IP address, you need to recreate a new API key.
You don't have permission to use this endpoint. Please contact support for more details.
The endpoint you used is only available to B2B customers.
Too many requests.
If your request body does not contain the “nonceWindow” parameter, please add it. In case the error persists after adding, you will need to create a new API key.
If the “nonceWindow” parameter is already used in your request body, you need to make sure that the values are specified in milliseconds.
The selected ticker is invalid.
The cryptocurrency ticker you entered is invalid. Please check that you have entered the ticker correctly.
Currency is not depositable/withdrawable.
Deposits/withdrawals of the cryptocurrency you specified are currently closed. News regarding the availability of cryptocurrencies deposits/withdrawals is published in our Telegram channel.
Support
In case of any questions related to the functionality of our exchange, you can:
- Leave a request on our website;
- Write to the support email: support@whitebit.com;
- Write to the chat using the button
in the lower right corner of the screen (in the upper right corner of the WhiteBIT app, click
).