Change Log
2023-04-24
- New APIs for P2P
GET /sapi/v1/c2c/orderMatch/listUserOrderHistory
POST /sapi/v1/c2c/orderMatch/listOrders
POST /sapi/v1/c2c/paymentMethod/listAll
- Reason code updates, refer to section: Reason code for canceling orders (P2P order related):
2022-11-07
- New APIs for P2P
GET /sapi/v1/c2c/ad/getAvailableAdClassify
POST /sapi/v1/c2c/ad/getReferencePrice
POST /sapi/v1/c2c/ad/getDetailByNo
POST /sapi/v1/c2c/ad/listWithPagination
POST /sapi/v1/c2c/ad/post
POST /sapi/v1/c2c/ad/update
POST /sapi/v1/c2c/ad/updateStatus
POST /sapi/v1/c2c/ad/search
Introduction
API Key Setup
- Some endpoints will require an API Key. Please refer to this page regarding API key creation.
- Once API key is created, it is recommended to set IP restrictions on the key for security reasons.
- Never share your API key/secret key to ANYONE.
Contact Us
General Info
General API Information
- The API may require the user's API Key. For how to create a API Key, please refer to https://www.pexpay.com/en/my/apiManagement.
- The base endpoint is: https://api.pexpay.com.
- All endpoints return either a JSON object or array.
- All time-related fields and timestamps are recorded to the milliseconds.
HTTP Return Codes
- HTTP
4XX
return codes are used for malformed requests; the issue is on the sender's side. - HTTP
403
return code is used when the WAF Limit (Web Application Firewall) has been violated. - 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 receiving429
codes. - HTTP
5XX
return codes are used for internal errors; the issue is on Pexpay's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.
Error Codes and Messages
If there is an error, the API will return an error with a message describing the reason.
Specific error codes and messages defined in Error Codes.
General Information on Endpoints
- For
GET
endpoints, parameters must be sent as aquery string
. - For
POST
,PUT
, andDELETE
endpoints, the parameters may be sent as aquery string
or in therequest body
with content typeapplication/x-www-form-urlencoded
. You may mix parameters between both thequery string
andrequest body
if you wish to do so. - Parameters may be sent in any order.
- If a parameter sent in both the
query string
andrequest body
, thequery string
parameter will be used.
LIMITS
General Info on Limits
- The following
intervalLetter
values for headers:- SECOND => S
- MINUTE => M
- HOUR => H
- DAY => D
intervalNum
describes the amount of the interval. For example,intervalNum
5 withintervalLetter
M means "Every 5 minutes".- A 429 will be returned when either rate limit is violated.
IP Limits
- Every request will contain
X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter)
in the response headers, this describes the current total weight of all requests from that IP address. - Each route has a
weight
which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavierweight
. - When a 429 is received, it's your obligation as an API to back off and not spam the API.
- Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418).
- IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days.
- A
Retry-After
header is sent with a 418 or 429 responses and will give the number of seconds required to wait, in the case of a 429, to prevent a ban, or, in the case of a 418, until the ban is over. - The limits on the API are based on the IPs, not the API keys.
/sapi/ Limit Introduction
The /sapi/*
endpoints adopt either of two access limiting rules, IP limits or UID (account) limits.
- Endpoints are marked according to IP or UID limit and their corresponding weight value.
- Each endpoint with IP limits has an independent 12000 per minute limit.
- Each endpoint with UID limits has an independent 180000 per minute limit.
- Responses from endpoints with IP limits contain the header
X-SAPI-USED-IP-WEIGHT-1M
, defining the weight used by the current IP. - Responses from endpoints with UID limits contain the header
X-SAPI-USED-UID-WEIGHT-1M
, defining the weight used by the current UID.
Endpoint security type
- Each endpoint has a security type that determines how you will
interact with it. This is stated next to the NAME of the endpoint.
- If no security type is stated, assume the security type is NONE.
- API-keys are passed into the Rest API via the
X-MBX-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.
Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
TRADE | Endpoint requires sending a valid API-Key and signature. |
USER_DATA | Endpoint requires sending a valid API-Key and signature. |
TRADE
andUSER_DATA
endpoints areSIGNED
endpoints.
SIGNED (TRADE, USER_DATA, AND MARGIN) Endpoint security
SIGNED
endpoints require an additional parameter,signature
, to be sent in thequery string
orrequest body
.- Endpoints use
HMAC SHA256
signatures. TheHMAC SHA256 signature
is a keyedHMAC SHA256
operation. Use yoursecretKey
as the key andtotalParams
as the value for the HMAC operation. - The
signature
is not case sensitive. totalParams
is defined as thequery string
concatenated with therequest body
.
Timing security
- A
SIGNED
endpoint also requires a parameter,timestamp
, to be sent which should be the millisecond timestamp of when the request was created and sent. - An additional parameter,
recvWindow
, may be sent to specify the number of milliseconds aftertimestamp
the request is valid for. IfrecvWindow
is not sent, it defaults to 5000.
The logic is as follows:
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow)
{
// process request
}
else
{
// reject request
}
Serious trading is about timing. Networks can be unstable and unreliable,
which can lead to requests taking varying amounts of time to reach the
servers. With recvWindow
, you can specify that the request must be
processed within a certain number of milliseconds or be rejected by the
server.
SIGNED Endpoint Examples for POST /sapi/v1/c2c/ads/getDetailByNo
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 | dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83 |
secretKey | 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9 |
Parameter | Value |
---|---|
adsNo | 10191633467710386176 |
timestamp | 1591702613943 |
Example 1: As a request body
Example 1
HMAC SHA256 signature:
$ echo -n "adsNo=10191633467710386176×tamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9"
(stdin)= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9
curl command:
(HMAC SHA256)
$ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://api.pexpay.com/sapi/v1/c2c/ads/getDetailByNo' -d 'sadsNo=10191633467710386176×tamp=1591702613943&signature=3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9'
Example 2: As a query string
Example 2
HMAC SHA256 signature:
$ echo -n "adsNo=10191633467710386176×tamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9"
(stdin)= 3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9
curl command:
(HMAC SHA256)
$ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://api.pexpay.com/sapi/v1/c2c/ads/getDetailByNo?adsNo=10191633467710386176×tamp=1591702613943&signature=3c661234138461fcc7a7d8746c6558c9842d4e10870d2ecbedf7777cad694af9'
Public API Definitions
Terminology
These terms will be used throughout the documentation, so it is recommended especially for new users to read to help their understanding of the API.
Ad
Users can post ads on the P2P platform to trade their crypto with other users. The broadcasted deal is called an ad.Order
An order is a promised trade the buyer and the seller have agreed upon. P2P facilitates the trade by providing an escrow service. The seller’s assets are “in order” and will be locked until both parties confirm the payment.Maker
A user who posts ads on P2P to buy/sell cryptocurrency is a maker.Taker
A user who buys/sells cryptocurrency via listed ads on P2P is a taker.Fixed-price ads
The price of fixed-price ads is fixed and does not move with the market price of the crypto.Floating-price ads
The price of floating-price ads fluctuates with the market and is refreshed every minute.
ENUM definitions
Order status (P2P order related):
Status | Description |
---|---|
1 |
Trade was successfully created, waiting for buyer’s payment. |
2 |
Buyer has made payment, waiting for final payment confirmation from the seller. |
3 |
Seller has received the buyer’s payment, our system is still processing the trade (there must be an issue with our server). |
4 |
Order has been completed. |
5 |
The trade is under dispute. |
6 |
Order has been cancelled by buyer. |
7 |
Order has been created, buyer has not made payment for the order within the expiry time. |
Reason code for canceling orders (P2P order related):
Status | Description |
---|---|
6 |
Seller is not active. |
7 |
This seller's trading condition is not suitable for me. |
8 |
Suspect seller of fraud. |
9 |
Seller refunded and asked me to cancel. |
10 |
Price is too expensive |
11 |
I'm new and don't know how to do p2p trading |
5 |
Other reasons |
Ad status (P2P ad related):
Status | Description |
---|---|
1 |
Active. |
3 |
Inactive (ad isn't live on the site, but can be switched on). |
4 |
Closed (ad has expired; it isn't live on the site and cannot be switched on). |
Ad priceType (P2P ad related):
Status | Description |
---|---|
1 |
The price is fixed and does not move with the market price of the crypto. |
2 |
The price fluctuates with the market price of the crypto. |
P2P Endpoints
- API-keys are passed into the Rest API via the
X-MBX-APIKEY
header. - API-keys and secret-keys are case sensitive.
- all P2P APIs need API-keys.
Get History Order By Page (USER_DATA)
GET /sapi/v1/c2c/orderMatch/listUserOrderHistory?endTimestamp=32432543543543&page=1&rows=10&startTimestamp=12321321213&tradeType=BUY
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
tradeType | String | NO | Possible options: "BUY", "SELL" |
startTimestamp | Long | NO | Earliest timestamp (in miliseconds) for orders to be filtered |
endTimestamp | Long | NO | Latest timestamp (in miliseconds) for orders to be filtered |
page | Integer | NO | Page requested, default and minimum values equal to 1 |
rows | Integer | NO | Maximum number of items per page, default and minimum values equal to 1, maximum value equal to 100 |
order | String | NO | Which field to sort |
sort | String | NO | Possible options: "Asc", "Desc" |
Response:
{
"code": "000000",
"message": "success",
"data": [
{
"orderNumber": "20466367873332568064",
"adNo": "11461232745961476096",
"tradeType": "SELL",
"asset": "USDT",
"fiat": "CNY",
"fiatSymbol": "¥",
"amount": "15.38000000",
"totalPrice": "100.00000000",
"unitPrice": "6.5",
"orderStatus": "COMPLETED",
"createTime": 1678184770000,
"commission": "0",
"counterPartNickName": "nkq***",
"advertisementRole": "MAKER"
}
],
"total": 1,
"success": true
}
Get Order By Page (USER_DATA)
Request:
{
"adNo": "11290172664500584448",
"asset": "USDT",
"tradeType": "BUY",
"page": 1,
"rows": 10
}
POST /sapi/v1/c2c/orderMatch/listOrders
Parameter:
Name | Type | Mandatory | Description |
---|---|---|---|
adNo | String | NO | Unique ID of the ad |
asset | String | NO | Crypto asset e.g. BTC |
orderStatus | Integer | No | Possible options: "1", "2", "3", "4", "5", "6", "7" |
tradeType | String | NO | Possible options: "BUY", "SELL" |
payType | Integer | NO | The payment method supported for the transaction e.g. 'WECHAT' |
orderStatusList | Integer List | NO | Order status list |
startDate | Long | NO | Earliest timestamp (in miliseconds) for orders to be filtered |
endDate | Long | NO | Latest timestamp (in miliseconds) for orders to be filtered |
page | Integer | YES | Page requested, minimum value equal to 1 |
rows | Integer | YES | Maximum number of items per page, minimum value equal to 1 , maximum value equal to 2000 |
order | String | NO | Which field to sort |
sort | String | NO | Possible options: "Asc", "Desc" |
Response:
{
"code": "000000",
"message": "success",
"data": [
{
"orderNumber": "20466277377803218944",
"adNo": "11466072390272757760",
"tradeType": "SELL",
"asset": "USDT",
"fiat": "CNY",
"fiatSymbol": "¥",
"amount": "136.61000000",
"totalPrice": "1000.00000000",
"orderStatus": 0,
"createTime": 1678163194000,
"currencyTicketSize": "0.01",
"assetTicketSize": "0.01",
"priceTicketSize": "0.01",
"sellerNickname": "nkaa",
"buyerNickname": "50qas",
"notifyPayEndTime": 1678164094000,
"chatUnreadCount": 0,
"commissionRate": "0",
"commission": "0",
"tradeMethodCommissionRateVoList": [
{
"tradeMethodIdentifier": "BANK",
"tradeMethodName": "Bank Transfer",
"commissionRate": "0"
}
]
}
],
"total": 1,
"success": true
}
List All Of Valid Payment Methods (NONE)
Response:
{
"code": "000000",
"message": "success",
"data": [
{
"identifier": "BANK",
"name": "Bank Transfer",
"shortName": "Bank Transfer",
"risk": "Please make sure you add your bank card number for instant payments. Do not include details of other banks or payment methods. You must add the payment details of the selected bank.",
"typeName": "银行转账",
"typeCode": "bank",
"riskLevel": 1,
"isVisible": 1,
"multiAllow": 1,
"remark": "(null)",
"sequence": 10
},
{
"identifier": "ALIPAY",
"name": "Alipay",
"shortName": "Alipay",
"typeName": "网络钱包",
"typeCode": "web-wallet",
"riskLevel": 0,
"isVisible": 1,
"multiAllow": 1,
"remark": "(null)",
"sequence": 20
}
],
"success": true
}
POST /sapi/v1/c2c/paymentMethod/listAll(USER_DATA)
Parameter:
- Parameter not needed
Get All Applicable Ads Classify (USER_DATA)
Response:
{
"code": "000000",
"message": "success",
"data": {
"adClassifies": [
"profession"
]
},
"success": true
}
GET /sapi/v1/c2c/ad/getAvailableAdClassify
Parameter:
- Parameter not needed
Get Ads Reference Price (NONE)
Request:
{
"assets": [
"USDT"
],
"fiatCurrency": "TWD",
"payType": "BANK",
"tradeType": "BUY"
}
POST /sapi/v1/c2c/ad/getReferencePrice
Parameter:
Name | Type | Required | Description |
---|---|---|---|
assets | List String | YES | Cryptocurrency e.g. BTC |
fiatCurrency | String | YES | Fiat currency e.g. USD |
payType | String | NO | Payment methods e.g. "BANK", "WECHAT" |
tradeType | String | YES | Possible options: "BUY", "SELL" |
- assets up to 3
Response:
{
"code": "000000",
"message": "success",
"data": [
{
"asset": "USDT",
"currency": "TWD",
"currencyScale": 2,
"currencySymbol": "$",
"referencePrice": "31.06",
"assetScale": 2,
"priceScale": 2
}
],
"success": true
}
Get Ads Detail (USER_DATA)
Request:
{
"adNo": "11218246497340923904"
}
POST /sapi/v1/c2c/ad/getDetailByNo
Parameter:
Name | Type | Required | Description |
---|---|---|---|
adNo | String | YES | Unique ID of the ad |
Response:
{
"code": "000000",
"message": "success",
"data": {
"adNo": "11421763242363183104",
"classify": "profession",
"tradeType": "BUY",
"asset": "USDT",
"fiatUnit": "TWD",
"priceType": 1,
"priceFloatingRatio": "100.00000000",
"rateFloatingRatio": "0.00000000",
"price": "32.00",
"initAmount": "10000.00000000",
"surplusAmount": "10000.00000000",
"maxSingleTransAmount": "100000",
"minSingleTransAmount": "1000",
"buyerKycLimit": 1,
"buyerRegDaysLimit": -1,
"buyerBtcPositionLimit": "-1.00000000",
"payTimeLimit": 15,
"tradeMethods": [
{
"identifier": "BANK",
"iconUrlColor": "https://static.devfdg.net/image/admin_mgs_image_upload/20200612/8b6fcda1-1285-486b-ad79-07156420459d.png",
"tradeMethodName": "Bank Transfer"
}
],
"createTime": 1667550197000,
"tradableQuantity": "10000",
"commissionRate": "0",
"tradeMethodCommissionRateVoList": [
{
"tradeMethodIdentifier": "BANK",
"tradeMethodName": "银行卡",
"commissionRate": "0"
}
],
"assetLogo": "https://res.pxpstatic.com/image/c2c/icons/crypto/usdt.png",
"assetScale": 2,
"fiatScale": 2,
"priceScale": 2,
"fiatSymbol": "$"
},
"success": true
}
Get Ads List (USER_DATA)
Request:
{
"adStatus": 1,
"asset": "USDT",
"page":1,
"rows":10,
"tradeType":"BUY"
}
POST /sapi/v1/c2c/ad/listWithPagination
Parameter:
Name | Type | Required | Description |
---|---|---|---|
advNo | String | YES | Unique ID of the ad |
adStatus | String | NO | Possible options: "1", "3", "4" |
asset | String | NO | Crypto asset e.g. BTC |
tradeType | String | YES | Possible options: "BUY", "SELL" |
startDate | String | YES | Earliest timestamp for ads to be filtered |
endDate | String | YES | Latest timestamp for ads to be filtered |
fiatUnit | String | YES | Fiat currency |
page | String | YES | Page requested |
rows | String | YES | Maximum number of items per page |
Response:
{
"code": "000000",
"message": "success",
"data": [
{
"adNo": "11425741454814470144",
"classify": "profession",
"tradeType": "SELL",
"asset": "USDT",
"fiatUnit": "TWD",
"advStatus": 1,
"priceType": 1,
"price": "31.60",
"initAmount": "3182.58000000",
"surplusAmount": "2549.67000000",
"maxSingleTransAmount": "500000",
"minSingleTransAmount": "5000",
"buyerKycLimit": 1,
"buyerRegDaysLimit": -1,
"buyerBtcPositionLimit": "-1.00000000",
"remarks": "",
"autoReplyMsg": "",
"payTimeLimit": 15,
"tradeMethods": [
{
"payId": 86247,
"identifier": "BANK",
"iconUrlColor": "https://static.devfdg.net/image/admin_mgs_image_upload/20200612/8b6fcda1-1285-486b-ad79-07156420459d.png",
"tradeMethodName": "Bank Transfer"
}
],
"createTime": 1668498676000,
"advUpdateTime": 1668498677000,
"advVisibleRet": {
"userSetVisible": 1,
"orderFlowVisible": 1,
"surplusAmountVisible": 1
},
"assetScale": 2,
"fiatScale": 2,
"priceScale": 2,
"fiatSymbol": "$"
}
],
"total": 1,
"success": true
}
Post An Ad (TRADE)
Request:
{
"asset":"USDT",
"buyerRegDaysLimit":-1,
"classify":"profession",
"fiatUnit":"TWD",
"initAmount":"10000",
"maxSingleTransAmount":"100000.00",
"minSingleTransAmount":"1000.00",
"onlineNow":"true",
"payTimeLimit":15,
"price":"31",
"priceFloatingRatio":100,
"priceType":1,
"tradeMethods":[
{
"payMethodId":"10",
"identifier":"BANK"
}
],
"tradeType":"SELL"
}
POST /sapi/v1/c2c/ad/post
Parameter:
Name | Type | Required | Description |
---|---|---|---|
asset | String | YES | Cryptocurrency e.g. BTC |
classify | String | YES | Possible options: "mass", "profession" |
fiatUnit | String | YES | Fiat currency e.g. USD |
initAmount | String | YES | Desired amount of cryptocurrency to be traded |
maxSingleTransAmount | String | YES | The maximum order size for this fiat currency |
minSingleTransAmount | String | YES | The minimum order size for this fiat currency |
onlineNow | Boolean | YES | Post ad online now (rather than scheduling for a later date) |
payTimeLimit | Integer | YES | Payment time limit (from the beginning of the transaction) |
price | String | YES | Price in fiat currency |
priceType | Integer | YES | Possible options: "1", "2" 1-fixed, 2-floating |
tradeType | String | YES | Possible options: "BUY", "SELL" |
priceFloatingRatio | String | YES | If priceType = floating, it's the range of acceptable prices |
tradeMethods | List | YES | Payment method details |
buyerRegDaysLimit | Integer | NO | Minimum number of days that the taker has been registered. If not filled, no limit. |
buyerBtcPositionLimit | String | NO | The minimum total value of cryptocurrency held by the taker (calculated in BTC). |
remarks | String | NO | Remarks |
autoReplyMsg | String | NO | Auto reply |
- classify:get from /sapi/v1/c2c/ad/getAvailableAdClassify
- tradeMethods:payMethodId for SELL tradeType ,identifier for BUY tradeType
Response:
{
"code": "000000",
"message": "success",
"data": "11425800822686646272",
"success": true
}
Update Ads (TRADE)
Request:
{
"adNo":"11425741454814470144",
"buyerRegDaysLimit":-1,
"initAmount":"10000",
"maxSingleTransAmount":"100000.00",
"minSingleTransAmount":"1000.00",
"payTimeLimit":15,
"price":"31",
"priceFloatingRatio":100,
"tradeMethods":[
{
"payMethodId":"99",
"identifier":"BANK"
}
],
"adStatus":1
}
POST /sapi/v1/c2c/ad/update
Parameter:
Name | Type | Required | Description |
---|---|---|---|
adNo | String | YES | Unique ID of the ad |
adStatus | Integer | NO | Possible options: "1", "3", "4" |
initAmount | String | NO | Desired amount of cryptocurrency to be traded |
maxSingleTransAmount | String | NO | Upper limit of the transaction (calculated in fiat currency). |
minSingleTransAmount | String | NO | Lower limit of the transaction (calculated in fiat currency). |
payTimeLimit | Integer | NO | Payment time limit (from the beginning of the transaction) |
price | String | NO | Price in fiat currency |
priceFloatingRatio | String | NO | If priceType = floating, it's the range of acceptable prices |
tradeMethods | List | NO | Payment method details |
buyerRegDaysLimit | Integer | NO | Minimum number of days that the taker has been registered. If not filled, no limit. |
buyerBtcPositionLimit | String | NO | The minimum total value of cryptocurrency held by the taker (calculated in BTC) |
remarks | String | NO | Remarks |
autoReplyMsg | String | NO | Auto reply |
Response:
{
"code": "000000",
"message": "success",
"data": true,
"success": true
}
Update Ads Status (TRADE)
Request:
{
"adStatus":3,
"adNo":11426819922767450112
}
POST /sapi/v1/c2c/ad/updateStatus
Parameter:
Name | Type | Required | Description |
---|---|---|---|
adStatus | Integer | YES | Possible options: "1", "3", "4" |
adNo | String | YES | Unique ID of the ad |
Response:
{
"code":"000000",
"message":"success",
"success":true
}
Search Ads with Condition (NONE)
Request:
{
"asset": "USDT",
"fiatUnit": "CNY",
"page": 1,
"rows": 10,
"tradeType": "SELL"
}
POST /sapi/v1/c2c/ad/search
Parameter:
Name | Type | Required | Description |
---|---|---|---|
asset | String | YES | Cryptocurrency e.g. BTC |
fiatUnit | String | YES | Fiat currency |
tradeType | String | YES | Possible options: "BUY", "SELL" |
payTypes | List | NO | Payment method |
publisherType | String | NO | Possible options: "merchant", "user" |
transAmount | String | YES | Amount of fiat currency that this trade includes |
Response:
{
"code": "000000",
"message": "success",
"data": [
{
"adv": {
"adNo": "11425762971874607104",
"classify": "profession",
"tradeType": "BUY",
"asset": "USDT",
"fiatUnit": "CNY",
"price": "7.15",
"initAmount": "46665.33000000",
"surplusAmount": "13000.00",
"maxSingleTransAmount": "99000.00",
"minSingleTransAmount": "30000.00",
"tradeMethods": [
{
"identifier": "BANK",
"iconUrlColor": "https://static.devfdg.net/image/admin_mgs_image_upload/20200612/8b6fcda1-1285-486b-ad79-07156420459d.png",
"tradeMethodName": "Bank Transfer"
}
],
"assetScale": 2,
"fiatScale": 2,
"priceScale": 2,
"fiatSymbol": "¥",
"isTradable": true,
"dynamicMaxSingleTransAmount": "92950.00",
"minSingleTransQuantity": "4195.80",
"maxSingleTransQuantity": "13846.15",
"dynamicMaxSingleTransQuantity": "13000.00"
},
"advertiser": {
"userNo": "sc5e25c51d0fc37cbbb074de1fa52aa0b",
"nickName": "xxx",
"userType": "merchant",
"tagIconUrls": []
}
}
],
"total": 1,
"success": true
}
P2P Place An Order (TRADE)
Request:
{
"adNo": "11445651369269137408",
"asset": "USDT",
"buyType": "BY_MONEY",
"fiatUnit": "CNY",
"matchPrice":6.78,
"totalAmount": 10,
"tradeType": "BUY"
}
POST /sapi/v1/c2c/orderMatch/placeOrder
Parameter:
Name | Type | Required | Description |
---|---|---|---|
asset | String | YES | Cryptocurrency e.g. BTC |
fiatUnit | String | YES | Fiat currency |
tradeType | String | YES | Possible options: "BUY", "SELL" |
buyType | String | YES | Possible options: "BY_MONEY", "BY_AMOUNT", "BY_MONEY"-quantity of fiat currency,"BY_AMOUNT"-quantity of cryptocurrency |
totalAmount | BigDecimal | yes | The amount of Fiat currency/Cryptocurrency that this trade includes |
payId | Long | NO | Only required when placing a sell order,it's the ID of the payment method |
payType | String | NO | Only required when placing a buy order,it's the payment method supported for the transaction e.g. 'WECHAT' |
adNo | String | YES | The unique ID of the target ad |
Response:
{
"code": "000000",
"message": "success",
"data": {
"orderNo": "20456853414085775360",
"adNo": "11445651369269137408",
"buyerNickname": "pe*****.com",
"buyerName": "R150Bob",
"sellerNickname": "BobN151",
"sellerName": "est2T",
"tradeType": "BUY",
"payMethods": [
{
"id": 342,
"identifier": "BANK",
"tradeMethodName": "Bank Transfer",
"fields": [
{
"fieldId": "0000000000000000001",
"fieldName": "Name",
"fieldContentType": "payee",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 1,
"fieldValue": "R151Bob"
},
{
"fieldId": "0000000000000000002",
"fieldName": "Bank account number",
"fieldContentType": "pay_account",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 1,
"fieldValue": "1212"
},
{
"fieldId": "0000000000000000006",
"fieldName": "Bank name",
"fieldContentType": "bank",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 1,
"fieldValue": "121"
},
{
"fieldId": "0000000000000000007",
"fieldName": "Account opening branch",
"fieldContentType": "sub_bank",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 0,
"fieldValue": ""
}
],
"iconUrlColor": "/image/admin_mgs_image_upload/20200612/8b6fcda1-1285-486b-ad79-07156420459d.png"
}
],
"selectedPayId": 0,
"asset": "USDT",
"fiatUnit": "CNY",
"amount": "1.47000000",
"price": "6.78000000",
"totalPrice": "10.00000000",
"orderStatus": 1,
"remark": "",
"createTime": 1675916346000,
"notifyPayEndTime": 1675917246000,
"confirmPayTimeout": 0,
"allowComplainEndTime": 1678508346000,
"fiatTicketSize": "0.01",
"assetTicketSize": "0.01",
"priceTicketSize": "0.01",
"notifyPayedExpireMinute": 15,
"confirmPayedExpireMinute": 15,
"currencyRate": "6.78396132",
"canCancelComplaintOrder": false
},
"success": true
}
Mark Order As Paid (TRADE)
Request:
{
"orderNo": "20456854342616600576",
"payId": 342
}
POST /sapi/v1/c2c/orderMatch/markOrderAsPaid
Parameter:
Name | Type | Required | Description |
---|---|---|---|
orderNo | String | YES | Unique ID for the the order |
payId | Long | NO | Only required when placing a buy order,it's the ID of the payment method |
Response:
{
"code": "000000",
"message": "success",
"data": {
"orderNo": "20456854342616600576",
"orderStatus": 2,
"notifyPayTime": 1675916586162,
"confirmPayEndTime": 1675917486162,
"selectedPayId": 342
},
"success": true
}
Release Cryptocurrency (TRADE)
Request:
{
"orderNo": "20456854342616600576"
}
POST /sapi/v1/c2c/orderMatch/releaseCoin
Parameter:
Name | Type | Required | Description |
---|---|---|---|
orderNo | String | YES | Unique ID for the the order |
Response:
{
"code": "000000",
"message": "success",
"success": true
}
Cancel Order (TRADE)
Request:
{
"orderCancelAdditionalInfo": "",
"orderCancelReasonCode": 1,
"orderNo": "20456853414085775360"
}
POST /sapi/v1/c2c/orderMatch/cancelOrder
Parameter:
Name | Type | Required | Description |
---|---|---|---|
orderNo | String | YES | Unique ID for the the order |
orderCancelReasonCode | Integer | NO | Reason codes,possible options: "1", "2", "3", "4", "5" |
orderCancelAdditionalInfo | String | NO | If you selected '5. Other,' you may use this field to submit additional information as to your reason for cancellation. |
Response:
{
"code": "000000",
"message": "success",
"success": true
}
Error Codes
The error JSON payload:
{
"code": ${error code},
"msg": "error message."
}
Errors consist of two parts: an error code and a message. Codes are universal (refer to core issue), but messages can vary (refer to details of core issue).
10xx - General Server or Network Issues
-1000 UNKNOWN
- An unknown error occurred while processing the request.
- An unknown error occurred while processing the request.[%s]
-1001 DISCONNECTED
- Internal error; unable to process your request. Please try again.
-1002 UNAUTHORIZED
- You are not authorized to execute this request.
-1003 TOO_MANY_REQUESTS
- Too many requests queued.
- Too many requests; please use the websocket for live updates to avoid polling the API.
- Too many requests; current limit is %s per minute. Please use the websocket for live updates to avoid polling the API.
- Too many requests; IP banned until %s. Please use the websocket for live updates to further bans.
-1004 SERVER_BUSY
- Server is busy, please wait and try again.
-1006 UNEXPECTED_RESP
- An unexpected response was received from system. Execution status unknown.
-1007 TIMEOUT
- Timeout waiting for response from backend server. Send status unknown; execution status unknown.
-1008 SERVER_BUSY
- Spot server is currently overloaded with other requests. Please try again in a few minutes.
-1014 UNKNOWN_ORDER_COMPOSITION
- Unsupported combination of orders.
-1015 TOO_MANY_ORDERS
- Too many new orders.
- Too many new orders; current limit is %s orders per %s.
-1016 SERVICE_SHUTTING_DOWN
- This service is no longer available.
-1020 UNSUPPORTED_OPERATION
- This operation is not supported.
-1021 INVALID_TIMESTAMP
- Timestamp for this request is outside of the recvWindow.
- Timestamp for this request was 1000ms ahead of the server's time.
-1022 INVALID_SIGNATURE
- Signature for this request is not valid.
-1099 Not found, authenticated, or authorized
- This replaces error code -1999