C2C v1
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
General Info
General API Information
- The base endpoint is: https://api.commex.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 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 Server's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.
Response fields description
Name | Type | Mandatory | Description |
---|---|---|---|
code | Number | Yes | Error Code,0 is success,else is fail |
msg | String | Yes | error message |
timestamp | Number | Yes | server timestamp |
data | Object | No | response data |
General Information on Endpoints
- For
GET
endpoints, parameters must be sent as aquery string
. - For
POST
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
, thebody 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 which has the current used weight for the IP for all request rate limiters defined. - 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 418, to prevent a ban, or, in the case of a 429, until the ban is over. - The limits on the API are based on the IPs, not the API keys.
We recommend using the websocket for getting data as much as possible, as this will not count to the request rate limit.
Order Rate Limits
- Every successful order response will contain a
X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter)
header which has the current order count for the account for all order rate limiters defined. - Rejected/unsuccessful orders are not guaranteed to have
X-MBX-ORDER-COUNT-**
headers in the response. - The order rate limit is counted against each account.
Endpoint security type
- Each endpoint has a security type that determines the 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 SIGNED only, while another API-key can access everything except for SIGNED routes.
- By default, API-keys can access all secure routes.
Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
USER_STREAM | Endpoint requires sending a valid API-Key. |
SIGNED | Endpoint requires sending a valid API-Key and signature. |
SIGNED 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:
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.
It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000!
SIGNED Endpoint Examples for POST /api/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 | vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A |
secretKey | NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j |
Parameter | Value |
---|---|
symbol | LTCBTC |
side | BUY |
type | LIMIT |
timeInForce | GTC |
quantity | 1 |
price | 0.1 |
recvWindow | 5000 |
timestamp | 1499827319559 |
Example 1: As a request body
- requestBody:
symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
×tamp=1499827319559
Example 1: HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
Example 1: curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.commex.com/api/v1/order' -d 'symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'
Example 2: As a query string
- queryString:
symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
×tamp=1499827319559
Example 2: HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
Example 2: curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.commex.com/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'
Example 3: Mixed query string and request body
- queryString:
symbol=LTCBTC
&side=BUY
&type=LIMIT
&timeInForce=GTC
- requestBody:
quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
Example 3: HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= 0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77
curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.commex.com/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77'
Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1".
Public API Definitions
Terminology
base asset
refers to the asset that is thequantity
of a symbol.quote asset
refers to the asset that is theprice
of a symbol.
ENUM definitions
Order status (status):
Status | Description |
---|---|
NEW | The order has been accepted by the engine. |
PARTIALLY_FILLED | A part of the order has been filled. |
FILLED | The order has been completed. |
CANCELED | The order has been canceled by the user. |
REJECTED | The order was not accepted by the engine and not processed. |
EXPIRED | The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance) |
Order types (orderTypes, type):
- LIMIT
- MARKET
- STOP_LOSS(*)
- STOP_LOSS_LIMIT
- TAKE_PROFIT(*)
- TAKE_PROFIT_LIMIT
Order Response Type (newOrderRespType):
- ACK
- RESULT
- FULL
Order side (side):
- BUY
- SELL
Time in force (timeInForce):
Status | Description |
---|---|
GTC | Good Til Canceled. An order will be on the book unless the order is canceled. |
IOC | Immediate Or Cancel. An order will try to fill the order as much as it can before the order expires. |
FOK | Fill or Kill. An order will expire if the full order cannot be filled upon execution. |
GTX | Good Till Crossing. When you place a timeInForce=GTX order, it will be added to the order book, but won’t be executed immediately. The order will exist as a maker order to add liquidity to the order book. |
Kline/Candlestick chart intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
- 1m
- 3m
- 5m
- 15m
- 30m
- 1h
- 2h
- 4h
- 6h
- 8h
- 12h
- 1d
- 3d
- 1w
- 1M
Rate limiters (rateLimitType)
REQUEST_WEIGHT
ORDERS
RAW_REQUESTS
Rate limit intervals (interval)
- SECOND
- MINUTE
- DAY
Filters
Filters define trading rules on a symbol or an exchange.
Filters come in two forms: symbol filters
and exchange filters
.
Symbol Filters
PRICE_FILTER
The PRICE_FILTER
defines the price
rules for a symbol. There are 3 parts:
minPrice
defines the minimumprice
/stopPrice
allowed; disabled onminPrice
== 0.maxPrice
defines the maximumprice
/stopPrice
allowed; disabled onmaxPrice
== 0.tickSize
defines the intervals that aprice
/stopPrice
can be increased/decreased by; disabled ontickSize
== 0.
Any of the above variables can be set to 0, which disables that rule in the price filter
. In order to pass the price filter
, the following must be true for price
/stopPrice
of the enabled rules:
price
>=minPrice
price
<=maxPrice
- (
price
-minPrice
) %tickSize
== 0
/exchangeInfo format:
{
"filterType": "PRICE_FILTER",
"minPrice": "0.00000100",
"maxPrice": "100000.00000000",
"tickSize": "0.00000100"
}
PERCENT_PRICE
The PERCENT_PRICE
filter defines valid range for a price based on the average of the previous trades.
avgPriceMins
is the number of minutes the average price is calculated over. 0 means the last price is used.
In order to pass the percent price
, the following must be true for price
:
price
<=weightedAveragePrice
*multiplierUp
price
>=weightedAveragePrice
*multiplierDown
/exchangeInfo format:
{
"filterType": "PERCENT_PRICE",
"multiplierUp": "1.3000",
"multiplierDown": "0.7000",
"avgPriceMins": 5
}
LOT_SIZE
The LOT_SIZE
filter defines the quantity
(aka "lots" in auction terms) rules for a symbol. There are 3 parts:
minQty
defines the minimumquantity
allowed.maxQty
defines the maximumquantity
allowed.stepSize
defines the intervals that aquantity
can be increased/decreased by.
In order to pass the lot size
, the following must be true for quantity
:
quantity
>=minQty
quantity
<=maxQty
- (
quantity
-minQty
) %stepSize
== 0
/exchangeInfo format:
{
"filterType": "LOT_SIZE",
"minQty": "0.00100000",
"maxQty": "100000.00000000",
"stepSize": "0.00100000"
}
MIN_NOTIONAL
The MIN_NOTIONAL
filter defines the minimum notional value allowed for an order on a symbol.
An order's notional value is the price
* quantity
.
applyToMarket
determines whether or not the MIN_NOTIONAL
filter will also be applied to MARKET
orders.
Since MARKET
orders have no price, the average price is used over the last avgPriceMins
minutes.
avgPriceMins
is the number of minutes the average price is calculated over. 0 means the last price is used.
/exchangeInfo format:
{
"filterType": "MIN_NOTIONAL",
"minNotional": "0.00100000",
"applyToMarket": true,
"avgPriceMins": 5
}
MARKET_LOT_SIZE
The MARKET_LOT_SIZE
filter defines the quantity
(aka "lots" in auction terms) rules for MARKET
orders on a symbol. There are 3 parts:
minQty
defines the minimumquantity
allowed.maxQty
defines the maximumquantity
allowed.stepSize
defines the intervals that aquantity
can be increased/decreased by.
In order to pass the market lot size
, the following must be true for quantity
:
quantity
>=minQty
quantity
<=maxQty
- (
quantity
-minQty
) %stepSize
== 0
/exchangeInfo format:
{
"filterType": "MARKET_LOT_SIZE",
"minQty": "0.00100000",
"maxQty": "100000.00000000",
"stepSize": "0.00100000"
}
MAX_NUM_ORDERS
The MAX_NUM_ORDERS
filter defines the maximum number of orders an account is allowed to have open on a symbol.
Note that both "algo" orders and normal orders are counted for this filter.
/exchangeInfo format:
{
"filterType": "MAX_NUM_ORDERS",
"limit": 25
}
MAX_NUM_ALGO_ORDERS(*)
The MAX_NUM_ALGO_ORDERS
filter defines the maximum number of "algo" orders an account is allowed to have open on a symbol.
"Algo" orders are STOP_LOSS
, STOP_LOSS_LIMIT
, TAKE_PROFIT
, and TAKE_PROFIT_LIMIT
orders.
/exchangeInfo format:
{
"filterType": "MAX_NUM_ALGO_ORDERS",
"maxNumAlgoOrders": 5
}
Exchange Filters
EXCHANGE_MAX_NUM_ORDERS
The MAX_NUM_ORDERS
filter defines the maximum number of orders an account is allowed to have open on the exchange.
Note that both "algo" orders and normal orders are counted for this filter.
EXCHANGE_MAX_NUM_ALGO_ORDERS(*)
The MAX_ALGO_ORDERS
filter defines the maximum number of "algo" orders an account is allowed to have open on the exchange.
"Algo" orders are STOP_LOSS
, STOP_LOSS_LIMIT
, TAKE_PROFIT
, and TAKE_PROFIT_LIMIT
orders.
Tips
The above are marked with "(*)" may NOT be supported by SITE
symbols.
C2C Endpoints
Search Ads with Condition (NONE)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/ad/search-ad?fiatUnit=string&asset=string&tradeType=string&offset=0&limit=0 \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/ad/search-ad?fiatUnit=string&asset=string&tradeType=string&offset=0&limit=0 HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/ad/search-ad?fiatUnit=string&asset=string&tradeType=string&offset=0&limit=0",
{
method: "GET",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/ad/search-ad',
params: {
'fiatUnit' => 'string',
'asset' => 'string',
'tradeType' => 'string',
'offset' => 'integer',
'limit' => 'integer',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/ad/search-ad', params={
'fiatUnit': 'string', 'asset': 'string', 'tradeType': 'string', 'offset': '0', 'limit': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/ad/search-ad', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/search-ad?fiatUnit=string&asset=string&tradeType=string&offset=0&limit=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/ad/search-ad", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/ad/search-ad
Search ads.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
fiatUnit | query | string | true | Fiat currency |
asset | query | string | true | Crypto asset e.g. BTC |
tradeType | query | string | true | Possible options: "BUY", "SELL" |
payTypes | query | string | false | Payment method list, separated by comma. e.g. WECHAT,ALIPAY |
transAmount | query | string | false | Amount of fiat currency that this trade includes |
offset | query | integer | true | Default:0 |
limit | query | integer | true | Default 10; max 20. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"total": 2,
"data": [
{
"adv": {
"adNo": "11543610177535475712",
"classify": "profession",
"tradeType": "SELL",
"asset": "USDT",
"fiatUnit": "CNY",
"price": 7.3,
"initAmount": 10000.0,
"surplusAmount": 9895.0,
"maxSingleTransAmount": 1000.0,
"minSingleTransAmount": 100.0,
"tradeMethods": [
{
"payId": null,
"identifier": "WECHAT",
"tradeMethodName": "WeChat"
},
{
"payId": null,
"identifier": "ALIPAY",
"tradeMethodName": "Alipay"
},
{
"payId": null,
"identifier": "BANK",
"tradeMethodName": "Bank Transfer"
}
],
"assetScale": 2,
"fiatScale": 2,
"priceScale": 2,
"fiatSymbol": "¥",
"isTradable": true,
"dynamicMaxSingleTransAmount": 1000.0,
"minSingleTransQuantity": 13.69,
"maxSingleTransQuantity": 136.98,
"dynamicMaxSingleTransQuantity": 136.98
},
"advertiser": {
"userNo": "sadcda85766ad3603a08a91ef9a0ff68c",
"nickName": "j2*****.com",
"userType": "merchant"
}
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Mark Order As Paid (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/order-match/notify-order-paid?orderNo=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/order-match/notify-order-paid?orderNo=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/order-match/notify-order-paid?orderNo=string",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/order-match/notify-order-paid',
params: {
'orderNo' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/order-match/notify-order-paid', params={
'orderNo': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/order-match/notify-order-paid', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/order-match/notify-order-paid?orderNo=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/order-match/notify-order-paid", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/order-match/notify-order-paid
To mark an order as paid.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
orderNo | query | string | true | Unique ID for the the order |
payId | query | long | false | Only required when placing a buy order,it's the ID of the payment method |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"orderNo": "20548227806238965760",
"orderStatus": 2,
"notifyPayTime": 1697702043695,
"confirmPayEndTime": 1697702943695,
"selectedPayId": 507
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Get Order By Page (USER_DATA)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/order-match/list-orders?offset=0&limit=0 \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/order-match/list-orders?offset=0&limit=0 HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/order-match/list-orders?offset=0&limit=0",
{
method: "GET",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/order-match/list-orders',
params: {
'offset' => 'integer',
'limit' => 'integer',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/order-match/list-orders', params={
'offset': '0', 'limit': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/order-match/list-orders', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/order-match/list-orders?offset=0&limit=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/order-match/list-orders", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/order-match/list-orders
Get user's orders by page.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
adNo | query | string | false | Unique ID of the ad |
asset | query | string | false | Crypto asset e.g. BTC |
orderStatus | query | integer | false | Possible options: 1:trading, 2:buyer_paid, 3:distributing, 4:completed, 5:in appeal, 6:cancelled, 7:cancelled by system |
tradeType | query | string | false | Possible options: "BUY", "SELL" |
orderStatusList | query | string | false | Order status list, separated by comma. e.g. 1,2,3 |
startTime | query | long | false | Default: 90 days from current timestamp |
endTime | query | long | false | Default: present timestamp |
offset | query | integer | true | Default:0 |
limit | query | integer | true | Default 100; max 200. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"total": 10,
"data": [
{
"orderNumber": "20548317271208067072",
"adNo": "11547969511800537088",
"tradeType": "BUY",
"asset": "USDT",
"fiat": "CNY",
"fiatSymbol": "¥",
"amount": "20.54",
"totalPrice": "150.0",
"orderStatus": 6,
"createTime": 1697723029000,
"currencyTicketSize": "0.01",
"assetTicketSize": "0.01",
"priceTicketSize": "0.01",
"sellerNickname": "je*****.com",
"buyerNickname": "je*****.com",
"confirmPayEndTime": null,
"notifyPayEndTime": 1697723929000,
"chatUnreadCount": 1,
"commissionRate": 0,
"commission": 0,
"tradeMethodCommissionRateVoList": [
{
"tradeMethodIdentifier": "BANK",
"tradeMethodName": "Bank Transfer",
"commissionRate": 0.1
}
]
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Update Ads Status (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/ad/update-ad-status?adNo=string&adStatus=0 \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/ad/update-ad-status?adNo=string&adStatus=0 HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/ad/update-ad-status?adNo=string&adStatus=0",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/ad/update-ad-status',
params: {
'adNo' => 'string',
'adStatus' => 'integer',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/ad/update-ad-status', params={
'adNo': 'string', 'adStatus': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/ad/update-ad-status', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/update-ad-status?adNo=string&adStatus=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/ad/update-ad-status", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/ad/update-ad-status
Update ads status.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
adNo | query | string | true | Unique ID of the ad |
adStatus | query | integer | true | Possible options: 1:online,3:offline,4:closed |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "result": true }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Release Cryptocurrency (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/order-match/release-order-coin?orderNo=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/order-match/release-order-coin?orderNo=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/order-match/release-order-coin?orderNo=string",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/order-match/release-order-coin',
params: {
'orderNo' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/order-match/release-order-coin', params={
'orderNo': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/order-match/release-order-coin', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/order-match/release-order-coin?orderNo=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/order-match/release-order-coin", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/order-match/release-order-coin
To release a P2P order.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
orderNo | query | string | true | Unique ID for the the order |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "result": true }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Get Ads Reference Price (NONE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price?assets=string&tradeType=string&fiatCurrency=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price?assets=string&tradeType=string&fiatCurrency=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price?assets=string&tradeType=string&fiatCurrency=string",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price',
params: {
'assets' => 'string',
'tradeType' => 'string',
'fiatCurrency' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price', params={
'assets': 'string', 'tradeType': 'string', 'fiatCurrency': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price?assets=string&tradeType=string&fiatCurrency=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/ad/get-ad-reference-price", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/ad/get-ad-reference-price
Get ads reference price.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
assets | query | string | true | Crypto asset list,separated by comma. e.g. BTC,USDT |
tradeType | query | string | true | Possible options: "BUY", "SELL" |
fiatCurrency | query | string | true | Fiat currency e.g. USD |
payType | query | string | false | Payment methods e.g. "BANK", "WECHAT" |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
[
{
"asset": "USDT",
"currency": "CNY",
"currencyScale": 2,
"currencySymbol": "¥",
"referencePrice": 7.3,
"assetScale": 2,
"priceScale": 2
},
{
"asset": "BTC",
"currency": "CNY",
"currencyScale": 2,
"currencySymbol": "¥",
"referencePrice": 696904.0,
"assetScale": 8,
"priceScale": 2
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Update Ads (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/ad/update-ad?adNo=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/ad/update-ad?adNo=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.commex.com/api/v1/c2c/ad/update-ad?adNo=string", {
method: "POST",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/ad/update-ad',
params: {
'adNo' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/ad/update-ad', params={
'adNo': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/ad/update-ad', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/update-ad?adNo=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/ad/update-ad", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/ad/update-ad
Update ads.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
adNo | query | string | true | Unique ID of the ad |
adStatus | query | integer | false | Possible options: 1:online,3:offline,4:closed |
initAmount | query | string | false | Desired amount of cryptocurrency to be traded |
maxSingleTransAmount | query | string | false | The maximum order size for this fiat currency |
minSingleTransAmount | query | string | false | The minimum order size for this fiat currency |
payTimeLimit | query | integer | false | Payment time limit in minutes (from the beginning of the transaction). Possible options: "15", "30", "45", "60", "120", "180", "240", "300", "360" |
price | query | string | false | Price in fiat currency |
priceFloatingRatio | query | string | false | If priceType = floating, it's the range of acceptable prices |
tradeMethods | query | list | false | Payment method details, payId(from List User Payment Methods Api) for SELL tradeType ,identifier for BUY tradeType. e.g. [{%22payId%22:%22507%22,%22identifier%22:%22BANK%22}] |
buyerKycLimit | query | integer | false | If buyer has finished kyc, 0:no, 1:yes |
buyerRegDaysLimit | query | integer | false | Minimum number of days that the taker has been registered. If not filled, no limit |
buyerBtcPositionLimit | query | string | false | The minimum total value of cryptocurrency held by the taker (calculated in BTC) |
remarks | query | string | false | Remarks |
autoReplyMsg | query | string | false | autoReplyMsg |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "result": true }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Get Ads List (USER_DATA)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/ad/list-ad \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/ad/list-ad HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.commex.com/api/v1/c2c/ad/list-ad", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/ad/list-ad',
params: {
'startTime' => 'long',
'endTime' => 'long',
'offset' => 'integer',
'limit' => 'integer',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/ad/list-ad', params={
'startTime': null, 'endTime': null, 'offset': '0', 'limit': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/ad/list-ad', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/list-ad");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/ad/list-ad", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/ad/list-ad
Get user's ads list by page.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
adNo | query | string | false | Unique ID of the ad |
adStatus | query | integer | false | Possible options: 1:online,3:offline,4:closed |
asset | query | string | false | Crypto asset e.g. BTC |
tradeType | query | string | false | Possible options: "BUY", "SELL" |
startTime | query | long | true | Default: 90 days from current timestamp |
endTime | query | long | true | Default: present timestamp |
offset | query | integer | true | Default:0 |
limit | query | integer | true | Default 100; max 200. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"total": 3,
"data": [
{
"adNo": "11547969511800537088",
"classify": "profession",
"tradeType": "SELL",
"asset": "USDT",
"fiatUnit": "CNY",
"adStatus": 1,
"priceType": 1,
"priceFloatingRatio": 100.0,
"price": 7.3,
"initAmount": 10000.0,
"surplusAmount": 9969.88,
"maxSingleTransAmount": 1000,
"minSingleTransAmount": 100,
"buyerKycLimit": 1,
"buyerRegDaysLimit": -1,
"buyerBtcPositionLimit": -1.0,
"remarks": "remarks1",
"autoReplyMsg": "autoReplyMsg1",
"payTimeLimit": 15,
"tradeMethods": [
{
"payId": 507,
"identifier": "BANK",
"tradeMethodName": "Bank Transfer"
}
],
"createTime": 1697640116000,
"advUpdateTime": 1697640116000,
"advVisibleRet": {
"userSetVisible": 1,
"orderFlowVisible": 1,
"surplusAmountVisible": 1
},
"assetScale": 2,
"fiatScale": 2,
"priceScale": 2,
"fiatSymbol": "¥"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Post An Ad (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/ad/post-ad?asset=string&classify=string&fiatUnit=string&initAmount=string&maxSingleTransAmount=string&minSingleTransAmount=string&onlineNow=true&payTimeLimit=0&priceType=0&tradeType=string&priceFloatingRatio=string&buyerKycLimit=0 \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/ad/post-ad?asset=string&classify=string&fiatUnit=string&initAmount=string&maxSingleTransAmount=string&minSingleTransAmount=string&onlineNow=true&payTimeLimit=0&priceType=0&tradeType=string&priceFloatingRatio=string&buyerKycLimit=0 HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/ad/post-ad?asset=string&classify=string&fiatUnit=string&initAmount=string&maxSingleTransAmount=string&minSingleTransAmount=string&onlineNow=true&payTimeLimit=0&priceType=0&tradeType=string&priceFloatingRatio=string&buyerKycLimit=0",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/ad/post-ad',
params: {
'asset' => 'string',
'classify' => 'string',
'fiatUnit' => 'string',
'initAmount' => 'string',
'maxSingleTransAmount' => 'string',
'minSingleTransAmount' => 'string',
'onlineNow' => 'boolean',
'payTimeLimit' => 'integer',
'priceType' => 'integer',
'tradeType' => 'string',
'priceFloatingRatio' => 'string',
'tradeMethods' => 'list',
'buyerKycLimit' => 'integer',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/ad/post-ad', params={
'asset': 'string', 'classify': 'string', 'fiatUnit': 'string', 'initAmount': 'string', 'maxSingleTransAmount': 'string', 'minSingleTransAmount': 'string', 'onlineNow': 'true', 'payTimeLimit': '0', 'priceType': '0', 'tradeType': 'string', 'priceFloatingRatio': 'string', 'tradeMethods': null, 'buyerKycLimit': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/ad/post-ad', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/post-ad?asset=string&classify=string&fiatUnit=string&initAmount=string&maxSingleTransAmount=string&minSingleTransAmount=string&onlineNow=true&payTimeLimit=0&priceType=0&tradeType=string&priceFloatingRatio=string&buyerKycLimit=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/ad/post-ad", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/ad/post-ad
Post an ad.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
asset | query | string | true | Crypto asset e.g. BTC |
classify | query | string | true | Possible options: "mass", "profession" |
fiatUnit | query | string | true | Fiat currency e.g. USD |
initAmount | query | string | true | Desired amount of cryptocurrency to be traded |
maxSingleTransAmount | query | string | true | The maximum order size for this fiat currency |
minSingleTransAmount | query | string | true | The minimum order size for this fiat currency |
onlineNow | query | boolean | true | Post ad online now (rather than scheduling for a later date) |
payTimeLimit | query | integer | true | Payment time limit in minutes (from the beginning of the transaction). Possible options: "15", "30", "45", "60", "120", "180", "240", "300", "360" |
price | query | string | false | Price in fiat currency. required if priceType = 1 |
priceType | query | integer | true | Possible options: "1", "2" 1-fixed, 2-floating |
tradeType | query | string | true | Possible options: "BUY", "SELL" |
priceFloatingRatio | query | string | true | If priceType = floating, it's the range of acceptable prices |
tradeMethods | query | list | true | Payment method details, payId(from List User Payment Methods Api) for SELL tradeType ,identifier for BUY tradeType. e.g. [{%22payId%22:%22507%22,%22identifier%22:%22BANK%22}] |
buyerKycLimit | query | integer | true | If buyer has finished kyc, 0:no, 1:yes |
buyerRegDaysLimit | query | integer | false | Minimum number of days that the taker has been registered. If not filled, no limit |
buyerBtcPositionLimit | query | string | false | The minimum total value of cryptocurrency held by the taker (calculated in BTC) |
remarks | query | string | false | Remarks |
autoReplyMsg | query | string | false | autoReplyMsg |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "adNo": "11548003795848495104" }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Cancel Order (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/order-match/cancel-order?orderNo=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/order-match/cancel-order?orderNo=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/order-match/cancel-order?orderNo=string",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/order-match/cancel-order',
params: {
'orderNo' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/order-match/cancel-order', params={
'orderNo': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/order-match/cancel-order', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/order-match/cancel-order?orderNo=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/order-match/cancel-order", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/order-match/cancel-order
To cancel a P2P order.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
orderNo | query | string | true | Unique ID for the the order |
orderCancelReasonCode | query | integer | false | Reason codes,possible options: 1:don't want, 2: don't meet requirements, 3:seller fee issue, 4:seller payment method problem, 5:others |
orderCancelAdditionalInfo | query | string | false | If you selected '5. Other,' you may use this field to submit additional information as to your reason for cancellation. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{ "result": true }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Get Ads Detail (USER_DATA)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/ad/get-ad-details?adNo=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/ad/get-ad-details?adNo=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.commex.com/api/v1/c2c/ad/get-ad-details?adNo=string", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/ad/get-ad-details',
params: {
'adNo' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/ad/get-ad-details', params={
'adNo': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/ad/get-ad-details', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/ad/get-ad-details?adNo=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/ad/get-ad-details", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/ad/get-ad-details
Get ads details.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
adNo | query | string | true | Unique ID of the ad |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"adNo": "11547648097904844800",
"classify": "profession",
"tradeType": "BUY",
"asset": "USDT",
"fiatUnit": "CNY",
"priceType": 1,
"price": 7.31,
"initAmount": 10000.0,
"surplusAmount": 10000.0,
"maxSingleTransAmount": 10000,
"minSingleTransAmount": 100,
"buyerKycLimit": 1,
"buyerRegDaysLimit": -1,
"buyerBtcPositionLimit": -1.0,
"remarks": "sth Remarks ",
"autoReplyMsg": "sth Auto Reply",
"payTimeLimit": 15,
"tradeMethods": [
{
"identifier": "ALIPAY",
"iconUrlColor": "/static/cloud/shared/static/images/admin_mgs_image_upload/20200612/b9b5c4ad-b0ff-4c74-ab38-56cc8217db4d.png",
"tradeMethodName": "Alipay",
"tradeMethodShortName": "Alipay",
"tradeMethodBgColor": "#01A9F2"
},
{
"identifier": "WECHAT",
"iconUrlColor": "/static/cloud/shared/static/images/admin_mgs_image_upload/20200612/33754130-42d4-410f-8662-ac74ec229b19.png",
"tradeMethodName": "WeChat",
"tradeMethodShortName": "WeChat",
"tradeMethodBgColor": "#2DC100"
},
{
"identifier": "BANK",
"iconUrlColor": "/static/cloud/shared/static/images/admin_mgs_image_upload/20200612/8b6fcda1-1285-486b-ad79-07156420459d.png",
"tradeMethodName": "Bank Transfer",
"tradeMethodShortName": "Bank Transfer",
"tradeMethodBgColor": "#F0B90B"
}
],
"createTime": 1697563485000,
"tradableQuantity": 10000.0,
"commissionRate": 0.1,
"tradeMethodCommissionRateVoList": [
{
"tradeMethodIdentifier": "ALIPAY",
"tradeMethodName": "Alipay",
"commissionRate": 0.05
},
{
"tradeMethodIdentifier": "BANK",
"tradeMethodName": "Bank Transfer",
"commissionRate": 0.1
},
{
"tradeMethodIdentifier": "WECHAT",
"tradeMethodName": "WeChat",
"commissionRate": 0.1
}
],
"assetLogo": "https://static.commex.com/static/cloud/shared/static/images/c2c/icons/crypto/usdt.png",
"assetScale": 2,
"fiatScale": 2,
"priceScale": 2,
"fiatSymbol": "¥"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
List User Payment Methods (USER_DATA)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method",
{
method: "GET",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/payment-method/list-user-payment-method", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/payment-method/list-user-payment-method
List user payment methods.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"total": 2,
"data": [
{
"payId": 508,
"payStatus": "ACTIVE",
"identifier": "WECHAT",
"tradeMethodName": "WeChat",
"tradeMethodShortName": "WeChat"
},
{
"payId": 507,
"payStatus": "ACTIVE",
"identifier": "BANK",
"tradeMethodName": "Bank Transfer",
"tradeMethodShortName": "Bank Transfer"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
P2P Place An Order (TRADE)
Code samples
# You can also use wget
curl -X POST https://api.commex.com/api/v1/c2c/order-match/place-order?tradeType=string&asset=string&fiatUnit=string&buyType=string&adNo=string \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
POST https://api.commex.com/api/v1/c2c/order-match/place-order?tradeType=string&asset=string&fiatUnit=string&buyType=string&adNo=string HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/order-match/place-order?tradeType=string&asset=string&fiatUnit=string&buyType=string&adNo=string",
{
method: "POST",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.post 'https://api.commex.com/api/v1/c2c/order-match/place-order',
params: {
'tradeType' => 'string',
'asset' => 'string',
'fiatUnit' => 'string',
'buyType' => 'string',
'totalAmount' => 'bigDecimal',
'adNo' => 'string',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.post('https://api.commex.com/api/v1/c2c/order-match/place-order', params={
'tradeType': 'string', 'asset': 'string', 'fiatUnit': 'string', 'buyType': 'string', 'totalAmount': null, 'adNo': 'string', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.commex.com/api/v1/c2c/order-match/place-order', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/order-match/place-order?tradeType=string&asset=string&fiatUnit=string&buyType=string&adNo=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.commex.com/api/v1/c2c/order-match/place-order", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v1/c2c/order-match/place-order
To place a P2P order.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
tradeType | query | string | true | Possible options: "BUY", "SELL" |
payType | query | string | false | Only required when placing a buy order,it's the payment method supported for the transaction e.g. 'WECHAT' |
payId | query | long | false | Only required when placing a sell order,it's the ID of the payment method |
asset | query | string | true | Cryptocurrency e.g. BTC |
fiatUnit | query | string | true | Fiat currency |
buyType | query | string | true | Possible options: "BY_MONEY", "BY_AMOUNT", "BY_MONEY"-quantity of fiat currency,"BY_AMOUNT"-quantity of cryptocurrency |
totalAmount | query | bigDecimal | true | The amount of Fiat currency/Cryptocurrency that this trade includes |
adNo | query | string | true | The unique ID of the target ad |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"orderNo": "20547225488734117888",
"adNo": "11537680611054837760",
"buyerNickname": "je*****.com",
"buyerName": "sww sww sww",
"sellerNickname": "de*****.com",
"sellerName": "john doe",
"tradeType": "BUY",
"payMethods": [
{
"id": 447,
"identifier": "BANK",
"tradeMethodName": "Bank Transfer",
"fields": [
{
"fieldId": "0000000000000000001",
"fieldName": "Name",
"fieldContentType": "payee",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 1,
"fieldValue": "john doe"
},
{
"fieldId": "0000000000000000002",
"fieldName": "Bank account number",
"fieldContentType": "pay_account",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 1,
"fieldValue": "2826382728"
},
{
"fieldId": "0000000000000000006",
"fieldName": "Bank name",
"fieldContentType": "bank",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 1,
"fieldValue": "Test"
},
{
"fieldId": "0000000000000000007",
"fieldName": "Account opening branch",
"fieldContentType": "sub_bank",
"restrictionType": 0,
"lengthLimit": 100,
"isRequired": 0,
"fieldValue": ""
}
],
"iconUrlColor": "/static/cloud/shared/static/images/admin_mgs_image_upload/20200612/8b6fcda1-1285-486b-ad79-07156420459d.png"
}
],
"selectedPayId": 0,
"asset": "USDT",
"fiatUnit": "RUB",
"amount": 10.34,
"price": 96.65,
"totalPrice": 1000.0,
"orderStatus": 1,
"remark": "Test",
"createTime": 1697462727000,
"notifyPayTime": null,
"confirmPayTime": null,
"cancelTime": null,
"notifyPayEndTime": 1697463627000,
"confirmPayEndTime": null,
"confirmPayTimeout": 0,
"allowComplainEndTime": 1700054727000,
"complainFreezeEndTime": null,
"complaintReason": null,
"complaintStatus": null,
"complaintProcessDeadline": null,
"fiatTicketSize": "0.01",
"assetTicketSize": "0.01",
"priceTicketSize": "0.01",
"notifyPayedExpireMinute": 15,
"confirmPayedExpireMinute": 15,
"currencyRate": null,
"canCancelComplaintOrder": false
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
Get History Order By Page (USER_DATA)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/order-match/list-order-history?offset=0&limit=0 \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/order-match/list-order-history?offset=0&limit=0 HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch(
"https://api.commex.com/api/v1/c2c/order-match/list-order-history?offset=0&limit=0",
{
method: "GET",
headers: headers,
},
)
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/order-match/list-order-history',
params: {
'offset' => 'integer',
'limit' => 'integer',
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/order-match/list-order-history', params={
'offset': '0', 'limit': '0', 'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/order-match/list-order-history', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/order-match/list-order-history?offset=0&limit=0");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/order-match/list-order-history", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/order-match/list-order-history
Get user's order history by page.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
tradeType | query | string | false | Possible options: "BUY", "SELL" |
startTime | query | long | false | Default: 90 days from current timestamp |
endTime | query | long | false | Default: present timestamp |
offset | query | integer | true | Default:0 |
limit | query | integer | true | Default 100; max 200. |
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"total": 9,
"data": [
{
"orderNumber": "20548317271208067072",
"adNo": "11547969511800537088",
"tradeType": "BUY",
"asset": "USDT",
"fiat": "CNY",
"fiatSymbol": "¥",
"amount": "20.54",
"totalPrice": "150.0",
"unitPrice": 7.3,
"orderStatus": "CANCELLED",
"createTime": 1697723029000,
"commission": 0,
"counterPartNickName": "je****",
"advertisementRole": "TAKER"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Response Schema
List All Of Valid Payment Methods (NONE)
Code samples
# You can also use wget
curl -X GET https://api.commex.com/api/v1/c2c/payment-method/list-payment-method \
-H 'Accept: application/json' \
-H 'X-MBX-APIKEY: API_KEY'
GET https://api.commex.com/api/v1/c2c/payment-method/list-payment-method HTTP/1.1
Host: api.commex.com
Accept: application/json
const headers = {
Accept: "application/json",
"X-MBX-APIKEY": "API_KEY",
};
fetch("https://api.commex.com/api/v1/c2c/payment-method/list-payment-method", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY'
}
result = RestClient.get 'https://api.commex.com/api/v1/c2c/payment-method/list-payment-method',
params: {
'timestamp' => 'long'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'X-MBX-APIKEY': 'API_KEY'
}
r = requests.get('https://api.commex.com/api/v1/c2c/payment-method/list-payment-method', params={
'timestamp': null
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'X-MBX-APIKEY' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.commex.com/api/v1/c2c/payment-method/list-payment-method', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.commex.com/api/v1/c2c/payment-method/list-payment-method");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"X-MBX-APIKEY": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.commex.com/api/v1/c2c/payment-method/list-payment-method", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /api/v1/c2c/payment-method/list-payment-method
List all payment methods.
Weight(IP): 20
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
recvWindow | query | long | false | The value cannot be greater than 60000 |
timestamp | query | long | true | none |
Example responses
200 Response
{
"total": 1,
"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": "Bank Transfer",
"typeCode": "bank",
"riskLevel": 1,
"isRecommended": null,
"isVisible": 1,
"multiAllow": 1,
"chatNeed": null,
"remark": "(null)",
"sequence": 10
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |