API Interface (API version 2)

Interface URI Prefix: /api/v2
Return Result Format: JSON

Public/Private API

There are two kinds of API interfaces for developers:

PUBLIC APIPRIVATE API
VerificationNo VerificationRequire Verification
Application FrequencyNo Limitation600 requests / 5 mins
PreparationsNo Preparation RequiredUse your API Token page to get access/secretkey

How to signature(Verification)

Before applying for Private API signature, you should prepare your access/secret_key. These materails could be found in the API Token page after registration.

All Private API users need the following 3 parameters when doing identity verification:

access_key
access_key can be found in API Token page.
tonce
tonce is the time stamp using positive integer, it repesents the number of millisecond from Unix epoch The time error between tonce and Peatio's server could be limited to plus-minus 30 seconds. And, every value of tonce can only be used once.
signature
signatureis generated after secret_key on API Token page.

Verification Steps

The generation process of signature is simple. First, the application should be transfer into a character string. Then use this character string to do HMAC-SHA256 calculation:

hash = HMAC-SHA256(payload, secret_key).to_hex

payload is representing the applied character string, it could be fomulate by using HTTP method. The application address and parameter is listed below.

Assume the secret key is yyy, then using HMAC-SHA256 algorithm to calculate the payload mentioned above, the result is(use hex to illustrate).

Now, we could make application by using this signature(use curl for example):

Return result

If API call failed, the return will use HTTP status code. Also, the return include detail error information showing JSON data. For example:

{"error": {"code": CODE, "message": MESSAGE}}

All the errors have the same format according to the above sentence, the only differences are code and message. Code is the custom error defined by Peatio, it illustrates the category of the error. Message is detail error information.

For complete API application, Peatio will return 200 for JSON data.

Data Type

Market
Market Market include all the market information, for example: BTC/USD.

Member
Member include the information of a user:

Account
Account includes all the assets user has:

Order
Order includes the information of every single order.

Trade
Trade Trade includes every transaction made by order.

OrderBook
OrderBook includes the orders on the market.

Dos and don'ts

Cancel order

Cancel order and cancel all the orders are asynchronous operations, API return complete only means cancel application has been submitted, it doesn't mean your order has been canceled. If you have orders which haven't been processed or the cancel queue is busy, your cancel application will delay. API returns the canceled order, the return order may not be conceled. Your code should not rely on API retrun result. It should get the latest status by using "order inquiry interface".

Libraries/Tools List