Skip to Content
🚀 Spot APIBase WebSocket

WebSocket API Basics

Connection

Spot WebSocket API

wss://stream.bittap.com/endpoint?format=JSON

Request Format

All requests sent to the WebSocket API must be in JSON format and include the following fields:

  • id: A unique identifier for the request, used to match the response to the request.
  • method: The name of the method to be called.
  • params: (Optional) The parameters for the method, a JSON object.

Request Example

{ "id": "187d3cb2-942d-484c-8271-4e2141bbadb1", "method": "time" }

Response Format

All responses from the WebSocket API are also in JSON format and include the following fields:

  • id: The unique identifier corresponding to the request.
  • status: The response status code, 200 indicates success.
  • result: (Optional) The return result when the request is successful.
  • error: (Optional) The error message when the request fails.
  • rateLimits: (Optional) The current rate limit information.

Response Example

{ "id": "187d3cb2-942d-484c-8271-4e2141bbadb1", "status": 200, "result": { "serverTime": 1656400526260 }, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 6000, "count": 1 } ] }

Request Authentication Types

Each method has an authentication type that indicates the required API key permissions, displayed next to the method name (e.g., New Order (TRADE)). If not specified, the authentication type is NONE.

Except for NONE, all methods with an authentication type are considered SIGNED requests (i.e., they include a signature), with the exception of listenKey management. Methods with an authentication type require a valid API key that has been verified.

API keys can be created on the API Management page of your BitTap account. API keys and key pairs are sensitive information and should never be shared with others. If you notice any unusual activity in your account, please revoke all keys immediately and contact BitTap support.

API keys can be configured to allow access to only certain authentication types. For example, you can have an API key with TRADE permissions for trading, and another API key with USER_DATA permissions to monitor order status. By default, API keys cannot TRADE. You need to enable trading permissions in API Management first.

Common Requests

Test Connectivity
{ "id": "922bcc6e-9de8-440d-9e84-7c80933a8d0d", "method": "ping" }

Tests connectivity to the WebSocket API.

Note: You can also use a regular WebSocket ping frame to test connectivity. The WebSocket API will respond with a pong frame as soon as possible. The ping and time requests are safe methods to test request-response handling in your application.

Parameters: NONE

Data Source: Cache

Response:

{ "id": "922bcc6e-9de8-440d-9e84-7c80933a8d0d", "status": 200, "result": {}, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 6000, "count": 1 } ] }
Check Server Time
{ "id": "187d3cb2-942d-484c-8271-4e2141bbadb1", "method": "time" }

Tests connectivity to the WebSocket API and gets the current server time.

Parameters: NONE

Data Source: Cache

Response:

{ "id": "187d3cb2-942d-484c-8271-4e2141bbadb1", "status": 200, "result": { "serverTime": 1656400526260 }, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 6000, "count": 1 } ] }
Last updated on: