Preparation for Integration
A trading pair consists of a base currency and a quote currency. For example, in the trading pair btc_usdt, btc is the base currency, and usdt is the quote currency.
Applying for an API Key
To apply for an API Key, visit the Hibt official website via mobile. Navigate to the personal settings page, locate API management, and submit your application. Upon successful creation, ensure you securely save the following information:
Access Key: The access key for API requests.
Secret Key: The secret key used for signature authentication and encryption (visible only during the application process).
Password: Required for managing APIs.
API Authentication
Public endpoints provide access to basic information and market data. These endpoints can be accessed without authentication.
Private endpoints are used for trading and account management. Each private request must be signed using your API Secret Key for verification.
https://fapi.hibt0.com/open-api
Signature Authentication
Private endpoints (used for trading and account management) require encryption with your API Key to validate that parameters or values have not been altered during transmission. Each API Key must have the appropriate permissions to access corresponding endpoints. When creating a new API Key, assign the required permissions. Before using an endpoint, ensure your API Key has the necessary permissions.
A valid request must include the following components:
Request URL: Example https://api.hibt0.com/open-api/v2/order/open.
Header - Access Key (X-ACCESS-KEY): Your API Key's Access Key, as obtained during API Key creation.
Header - Body Signature (X-SIGNATURE): Encrypted data generated by signing the request body with your Secret Key.
Timestamp (timestamp): A field in the POST request body or GET request URL parameters representing the current millisecond timestamp. This is required for signing.
Required and Optional Parameters: Each method specifies the required and optional parameters for the API call. Check the method documentation for details.
Signature: An encrypted value ensuring the integrity and authenticity of the request. **For your API Key's security, signatures expire after 5 minutes.
Mandatory Signature Parameter: Any authenticated request must include the timestamp parameter for signature generation (use the latest server time from the v2/server/time endpoint).
Encryption Method
Body Content of the Open Position POST Request
Sort the parameters in ASCII order.
amount=0.01&customID=11111&isSetSl=true&isSetSp=true&leverage=10&price=2660&side=1&slPrice=2450&spPrice=2770&symbol=btc_usdt×tamp=1724916869475&triggerType=2&type=1
Encrypt the sorted request parameters using HMAC SHA256 with the secretKey to obtain the result.
9543936a83c8b4fd0aae02a6e6fa272dc8ebc95b871f620eb23ae1a6dadffee7
Note: If a parameter field contains an array, convert it to a JSON string separately and then append it to the signature string.
Constructing HTTP Requests
Use X-ACCESS-KEY to store the access key information and pass it as a parameter in the header.
Use X-SIGNATURE to store the generated signature information and pass it as a parameter in the header.
Use X-TIMESTAMP to store the request timestamp and pass it as a parameter in the header.
Request Methods
Currently, there are only two methods: GET and POST.
GET Requests: All parameters are included in the URL path.
POST Requests: All parameters are sent in JSON format within the request body.
Response Format
Common Error Codes
21XXXX (Parameter Errors)
22XXXX (Business Errors)
Incorrect take-profit price
Incorrect stop-loss price
Only data from the past 3 months is allowed
Only data within a 7-day range is allowed
Only data within a 3-month range is allowed
endTime exceeds the current time
X-ACCESS-KEY not provided
API key authentication failed
Signature verification failed
IP address not in whitelist
WebSocket: Invalid event type
No trading or query permissions
Server Time Retrieval
HTTP Request
GET /v2/server/time
Authentication: No
Request Parameters
None
Response Example
Retrieve All Trading Pairs
HTTP Request
GET /v2/market/symbols
Request Parameters: None
Response Example
Retrieve Ticker Data for Trading Pairs
HTTP Request
GET /v2/market/tickers
Request Parameters
Parameter
Description
Required
Type
No (returns all if not provided)
Response Example
Retrieve K-Line Data for a Specific Trading Pair
HTTP Request
GET /v2/market/candle
Request Parameters
Parameter
Description
Required
Type
Data time granularity (interval for each candle): M1, M5, M15, M30, H1, H4, H6, D1
Start timestamp for query, in milliseconds
End timestamp for query, in milliseconds
Number of K-Line data points to return [1, 500]. Default is 200, max is 500. If start and end are provided, the actual returned count depends on the time range.
Response Example
Retrieve Ticker Prices for Trading Pairs
HTTP Request
GET /v2/market/ticker/price
Request Parameters
Parameter
Description
Required
Type
No (returns all pairs if omitted)
Response Example
Retrieve Market Depth for a Trading Pair
HTTP Request
GET /v2/market/depth
Request Parameters
Parameter
Description
Required
Type
Depth levels (5, 10, 20, 50, 100, 200)
Response Example
Retrieve Latest Trades for a Trading Pair
HTTP Request
GET /v2/market/deals
Request Parameters
Parameter
Description
Required
Type
Response Example
Query Trading Pair Mark Price
HTTP Request
GET /v2/market/index
Request Parameters
Parameter
Description
Required
Type
No (returns all pairs if not provided)
Response Example
Query Funding Rate
HTTP Request
GET /v2/market/fundingRate
Request Parameters
Parameter
Description
Required
Type
Start timestamp in ms (only supports a 3-month range)
Number of records (default 100, max 1000)
Response Example
Query Risk Limit
HTTP Request
GET /v2/market/riskLimit
Request Parameters
Parameter
Description
Required
Type
Response Example
Query Latest Contract Market Data
HTTP Request
GET /v2/market/contracts
Request Parameters
Parameter
Description
Required
Type
No (returns all if omitted)
Response Example
Query Contract Trading Specifications
HTTP Request
GET /v2/market/contractSpecifications
Request Parameters None
Response Example
Query Contract Order Book
HTTP Request
GET /v2/market/orderBook
Request Parameters
Parameter
Description
Required
Type
Response Example
HTTP Request
POST /v2/order/open
Authentication Required Yes
Request Parameters
Response Example
Batch Opening Positions
HTTP Request
POST /v2/order/batchOpen
Authentication Required Yes
Request Parameters
Response Example
HTTP Request
POST /v2/order/cancel
Authentication Required Yes
Request Parameters
Response Example
Batch Cancel Orders
HTTP Request
POST /v2/order/batchCancel
Authentication Required Yes
Request Parameters
Response Example
HTTP Request
POST /v2/order/close
Authentication Required Yes
Request Parameters
Response Example
Close All Positions
HTTP Request
POST /v2/order/closeAll
Authentication Required Yes
Request Parameters
Response Example
Query Unfinished Orders
HTTP Request
GET /v2/order/unFinish
Authentication Required Yes
Request Parameters
Parameter
Description
Required
Data Type
Order ID // Either orderID, customID, or positionID must be provided, or none at all
Current timestamp in milliseconds
Response Example
Query Details of Completed Orders
HTTP Request
GET /v2/order/finishedInfo
Authentication Required Yes
Request Parameters
Parameter
Description
Data Type
Order ID // Either orderID, customID, or positionID must be provided
Current timestamp in milliseconds
Response Example
Query History of Completed Orders
HTTP Request
GET /v2/order/finished
Authentication Required Yes
Request Parameters
Parameter
Description
Data Type
Page number for pagination
Number of items per page, max 50
Current timestamp in milliseconds
Response Example
Add Conditional Order
HTTP Request
POST /v2/entrust/add
Authentication Required Yes
Request Parameters
Response Example
Cancel Conditional Order
HTTP Request
POST /v2/entrust/cancel
Authentication Required Yes
Request Parameters
Response Example
Retrieve Unfinished Conditional Orders
HTTP Request
GET /v2/entrust/unFinish
Authentication Required Yes
Request Parameters
Parameter
Description
Data Type
Response Example
Retrieve Completed Conditional Orders List
HTTP Request
GET /v2/entrust/finished
Authentication Required Yes
Request Parameters
Parameter
Description
Data Type
Number of entries (maximum 50)
Response Example
Account Interface
Retrieve Account Balance
HTTP Request
GET /v2/account/balance
Authentication Required Yes
Request Parameters None
Response Example
Adjust Opening Leverage
HTTP Request
POST /v2/account/setLeverage
Authentication Required Yes
Request Parameters
Response Example
Get User Positions
HTTP Request
GET /v2/account/position
Authentication Required Yes
Request Parameters
Parameter
Description
Required
Type
Response Example
Get Account Trade History
HTTP Request
GET /v2/account/order
Authentication Required Yes
Request Parameters
Parameter
Description
Required
Type
Number of entries (default: 500, max: 1000)
Response Example
Get Account Balance Record
HTTP Request
GET /v2/account/balanceRecord
Authentication Required Yes
Request Parameters
Parameter
Description
Required
Type
Start time in ms (interval: 30 days)
End time in ms (interval: 30 days)
Event type: 1: Deposit, 2: Deduction, 3: Transfer In, 4: Transfer Out, 9: Funding Fee, 201: Open Long, 202: Open Short, 204: Close Long, 205: Close Short, 206: Forced Liquidation
Number of entries (default: 500, max: 1000)
Response Example
Get User Forced Liquidation History
HTTP Request
GET /v2/account/orderForced
Authentication Required Yes
Request Parameters
Parameter
Description
Required
Type
Start time in ms (start and end interval must be within 7 days)
Forced liquidation type: 4 - Forced Liquidation, 5 - FOK Liquidation, 6 - ADL (Auto-Deleveraging), 9 - Bankruptcy
Number of entries (default: 500, max: 1000)
Response Example
Contract WebSocket API
Request URL Example: wss://fapi.hibt0.com/v2/ws
API Authentication
For subscriptions that require authentication, send the authentication message first.
ignature: Simply sign the timestamp string.
Subscribe to Topic
{"event":"sub", "topic":"Topic Content"}
Subscribe to Market Depth
Supported market depth topics: 5deep, 10deep, 20deep
Request JSON: {"event":"sub","topic":"btc_usdt.5deep"}
Response Example
Subscribe to Ticker
Request JSON: {"event":"sub","topic":"btc_usdt.ticker"}
Response Example
Subscribe to Index
Request JSON: {"event":"sub","topic":"btc_usdt.index"}
Response Example
Subscribe to Latest Trades
Request JSON: {"event":"sub","topic":"btc_usdt.trade"}
Response Example
Subscribe to K-Line
Request JSON: {"event":"sub","topic":"btc_usdt.candle.M1"}
Supported Time Intervals:
Response Example
Subscribe to Plan Order Trigger Push (Authentication Required)
Request JSON: {"event":"sub","topic":"user.entrust"}
Response Example
Subscribe to Position Change (Authentication Required)
Request JSON: {"event":"sub","topic":"user.position"}
Response Example
Subscribe to Order Execution Notifications (Authentication Required)
Response Example
Subscribe to Account Balance Changes (Authentication Required)
Request JSON: {"event":"sub","topic":"user.balance"}
Response Example