Block Trade Api

General API Information

Endpoint https://api-otc.trubit.com

  • All endpoints return either a JSON object or array.

  • Data is returned in ascending order. Oldest first, newest last.

  • All time and timestamp related fields are in milliseconds.

  • HTTP 4XX return codes are used for for malformed requests; the issue is on the sender's side.

  • HTTP 429 return code is used when breaking a request rate limit.

  • HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes.

  • HTTP 5XX return codes are used for internal errors; the issue is on broker's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.

  • Any endpoint can return an ERROR; the error payload is as follows:

{
  "code": -1121,
  "msg": "Invalid symbol."
}
  • Specific error codes and messages defined in another document.

  • For GET endpoints, parameters must be sent as a query string.

  • For POST, PUT, and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded. You may mix parameters between both the query string and request body if you wish to do so.

  • Parameters may be sent in any order.

  • If a parameter sent in both the query string and request body, the query string parameter will be used.

Endpoint security type

  • Each endpoint has a security type that determines the how you will interact with it.

  • API-keys are passed into the Rest API via the X-BH-APIKEY header.

  • API-keys and secret-keys are case sensitive.

  • API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes.

  • By default, API-keys can access all secure routes.

SIGNED (TRADE and USER_DATA) Endpoint security

  • SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body.

  • Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation.

  • The signature is not case sensitive.

  • totalParams is defined as the query string concatenated with the request body.

SIGNED Endpoint Examples for POST /openapi/v1/order

Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo, openssl, and curl.

Key
Value

apiKey

tAQfOrPIZAhym0qHISRt8EFvxPemdBm5j5WMlkm3Ke9aFp0EGWC2CGM8GHV4kCYW

secretKey

lH3ELTNiFxCQTmi9pPcWWikhsjO04Yoqw3euoHUuOLC3GYBW64ZqzQsiOEHXQS76

Parameter
Value

requestBody

{"id":0}

timestamp

1538323200000

Example 1: As a query string

  • queryString: symbol=ETHBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1538323200000

  • requestBodyString: {"id":0}

  • HMAC SHA256 signature:

  • curl command:

How to obtain apiKey and secretKey

https://www.trubit.com/new/user/interface

After creating the apiKey and secretKey, you need to set the IP whitelist.

图片
图片
图片

Endpoints

1. Base Data

Get Country List with Symbol Rate

  • Endpoint: /openapi/v1/otc/base/symbol_rate/country/list

  • Method: GET

  • Request Query Parameters:

    • hasValid (optional, Integer) - Filters countries by validation status.

  • Response: JSON containing the list of countries with symbol rates.

Example

Get Self Data List

  • Endpoint: /openapi/v1/otc/base/symbol/self/list_data

  • Method: GET

  • Request Query Parameters:

    • country (string: name of the country)

    • hasValid (number: whether to query only valid data [0: no (default), 1: yes])

  • Response: JSON containing self data list for symbols.

2. Rate Management

Get User Quote

  • Endpoint: /openapi/v1/otc/rate/user_quote/find

  • Method: POST

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Body:

  • Response: JSON containing user quote information.

3. Payment Management

Get Payment Config List

  • Endpoint: /openapi/v1/otc/payment/list

  • Method: GET

  • Request Query Parameters:

    • country (string: name of the country)

  • Response: JSON containing the list of payment configurations.

Example Mexico

Add Payment

  • Endpoint: /openapi/v1/otc/payment/add

  • Method: POST

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Body:

  • Response: JSON containing the result of the add payment operation.

Get My Payment Methods

  • Endpoint: /openapi/v1/otc/payment/my/list

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Query Parameters:

    • mcId (number: id of the merchant)

    • country (optional,string: name of the country)

    • fiat (optional,string: name of the fiat currency)

    • status (optional,enum: status of the payment method [0: all(default), 1: valid, 2: authenticating, 3: authentication failed])

    • currentPage (optional,number: current page number)

    • pageSize (optional,number: number of results per page)

  • Response: JSON containing the list of user's payment methods.

4. Merchant Management

Get Merchant List

  • Endpoint: /openapi/v1/otc/mc/list

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Query Parameters:

    • merchantName (optional,string: name of the merchant)

    • email (optional,string: email)

  • Response: JSON containing the list of merchants.

ADD Merchant Info

  • Endpoint: /openapi/v1/otc/mc/add

  • Method: POST

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Parameters:

Add CLABE Merchant Parameters

Add CVU Merchant Parameters

  • Response: JSON containing the result of the add merchant operation.

Get Merchant Transfer List

  • Endpoint: /openapi/v1/otc/mc/tran/list

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Parameters:

    • startTime (number: optional, timestamp of the start time(millisecond))

    • endTime (number: optional, timestamp of the end time(millisecond))

    • mcSettingsId (number, optional, id of the merchant)

    • type (number, optional, enum: type [0: all(default), 1: deposit, 2: withdraw, 3: Online Refund, 5: Offline Refund])

    • status (number, optional, enum: status [0: all(default), 1: init, 2: completed, 3: canceled])

    • currentPage (number,default 1)

    • pageSize (number,default 10, max 1000)

  • Response: JSON containing the list of orders.

5. Order Management

Get Order List

  • Endpoint: /openapi/v1/otc/order/list

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Parameters:

    • currentPage (number,default 1)

    • pageSize (number,default 10)

    • isPending (optional, boolean: whether the order is pending [true: pending, false: not pending])

  • Response: JSON containing the list of orders.

Get Order Detail

  • Endpoint: /openapi/v1/otc/order/detail

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Parameters:

    • orderId (number: id of the order)

    • clientId (string: id of the client)

  • Response: JSON containing the details of the specified order.

Buy Order Example

Sell Order Example

Finish Order

  • Endpoint: /openapi/v1/otc/order/finish

  • Method: POST

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Body:

  • Response: JSON containing the result of the order finish.

Add Order

  • Endpoint: /openapi/v1/otc/order/add

  • Method: POST

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Body:

  • Response: JSON containing the result of the add order operation.

Order Invoice Upload

  • Endpoint: /openapi/v1/otc/pic/upload

  • Method: POST

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Parameters: order status is [31: support documents pending], Use this interface to upload invoices

    • orderId (number: id of the order)

    • files (file: Upload multiple file, This parameter does not participate in signature. numbwr max 5. Maxinum upload file size 5MB. format support [jpg,png,jpeg,pdf])

  • Response: JSON containing the result of the order invoice upload.

6. Deposit Management

Get Deposit Address

  • Endpoint: /openapi/v1/otc/depositAddress

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Request Query Parameters:

    • tokenId (String) - ID of the token

    • chainType (optional, String) - Type of the blockchain (default: "")

  • Response: JSON containing the deposit address.

Example tokenId = USDT ,chainType = ERC20

Token Id
ChainType

USDT

ERC20

USDT

TRC20

7. Account Management

Get Account Info

  • Endpoint: /openapi/v1/otc/account

  • Method: GET

  • Authorization: Requires signature and account verification

  • Headers: Requires signature

    • X-BH-APIKEY (string: API key)

  • Response: JSON containing account information.

Example

8. Webhooks

Order Notice Info

  • Method: POST

  • Authorization: Callback message authentication, The joint commission trubit platform obtains the public key.

  • Headers: Requires signature

    • signature (string: To verify that a webhook request is coming from trubit, you can use the signature header. The value of the header is a RSA-SHA256 signature of the request body, Use hexadecimal encoding.)

  • Request Body:

  • Response:

Last updated