CoinEx P2P API Documentation

To meet the diverse trading needs of users, CoinEx now supports P2P API-related functionalities. The details are as follows:

 

CoinEx P2P API Usage Guide

1. Target Users

Any user who has completed P2P merchant ID verification on CoinEx. If you are not yet a verified merchant, you need to apply for P2P merchant status on the P2P page before using the API services.

 

2. Execution Efficiency and Content

For users operating via API services, the efficiency of information retrieval and request execution is identical to that within the CoinEx interface. However, the returned content may be truncated due to field restrictions.

 

3. Supported Modules

  • P2P Shop Status Management
  • P2P Ad Management
  • P2P User Ad List
  • P2P Market Ad List
  • P2P Order List
  • P2P Ad Price Modification
  • P2P Market Depth Data

 

P2P API Endpoint Documentation

Please visit the CoinEx Public API Documentation for authentication before using the endpoints below.

 

1. P2P Shop Status Management

Endpoint Info

  • URL Path:  /v2/p2p/exchange-status
  • Request Method: POST
  • Description: Set the business status of the P2P shop (Open or Closed)
  • Permission: Authentication required

 

Request Parameters

Request Body

Parameter Required Type Description
status Yes String Shop status, options: OPEN or CLOSED

 

Request Example

POST /v2/p2p/exchange-status HTTP/1.1
Host: api.coinex.com
Content-Type: application/json
{
  "status": "OPEN"
}

 

Response Parameters

Parameter Type Description
status String The set shop status, OPEN or CLOSED

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": {
    "status": "OPEN"
  }
}

 

2. P2P Ad Management

Endpoint Info

  • URL Path: /v2/p2p/manage-ads
  • Request Method: POST
  • Description: Batch manage P2P ads (Online or Offline)
  • Permission: Authentication required

 

Request Parameters

Request Body

Parameter Required Type Description
status Yes String Operation type, options: ONLINE or OFFLINE
ad_ids No Array[String] List of ad IDs; if not provided, all eligible ads will be operated on

 

Request Example

POST /v2/p2p/manage-ads HTTP/1.1
Host: api.coinex.com
Content-Type: application/json
{
  "status": "ONLINE",
  "ad_ids": ["5f7c8b9d1a2b3c4d5e6f7g8h", "5f7c8b9d1a2b3c4d5e6f7g9i"]
}

 

Response Parameters

Parameter Type Description
affected_ad_ids Array[String] List of successfully operated ad IDs

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": {
    "affected_ad_ids": ["5f7c8b9d1a2b3c4d5e6f7g8h", "5f7c8b9d1a2b3c4d5e6f7g9i"]
  }
}

 

3. P2P User Ad List

Endpoint Info

  • URL Path: /v2/p2p/ads
  • Request Method: GET
  • Description: Retrieve all ads of the current user
  • Permission: Authentication required

 

Request Parameters

None

 

Request Example

GET /v2/p2p/ads HTTP/1.1

Host: api.coinex.com

 

Response Parameters

Returns an array of ad objects. Each ad object contains the following fields:

Parameter Type Description
ad_id String Ad ID
created_at Number Creation time (in milliseconds)
updated_at Number Update time (in milliseconds)
ad_number String Ad number
ad_side String Ad direction, BUY or SELL
base_ccy String Base currency
quote_ccy String Quote currency
price String Price
available_amount String Available amount
quote_min_limit String Min. trade limit (quote currency)
quote_max_limit String Max. trade limit (quote currency)
status String Ad status, options: ONLINE or OFFLINE

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": [
    {
      "ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
      "created_at": 1618456789000,
      "updated_at": 1618456789000,
      "ad_number": "AD123456789",
      "ad_side": "BUY",
      "base_ccy": "BTC",
      "quote_ccy": "CNY",
      "price": "200000",
      "available_amount": "0.5",
      "quote_min_limit": "500",
      "quote_max_limit": "50000",
      "status": "ONLINE"
    },
    {
      "ad_id": "5f7c8b9d1a2b3c4d5e6f7g9i",
      "created_at": 1618456790000,
      "updated_at": 1618456790000,
      "ad_number": "AD123456790",
      "ad_side": "SELL",
      "base_ccy": "ETH",
      "quote_ccy": "CNY",
      "price": "10000",
      "available_amount": "5",
      "quote_min_limit": "200",
      "quote_max_limit": "20000",
      "status": "OFFLINE"
    }
  ]
}

 

4. P2P Market Ad List

Endpoint Info

  • URL Path: /v2/p2p/market/ads
  • Request Method: GET
  • Description: Retrieve the P2P market ad list
  • Permission: Authentication not required

 

Request Parameters

Query Parameters

Parameter Required Type Description
base_ccy Yes String Base currency
quote_ccy Yes String Quote currency
order_side Yes String Order side, opposite to the ad direction, options: BUY or SELL
target_quote_amount No Decimal Target transaction amount (quote currency)
sort_by No String Sorting field, default is PRICE, options: COMPLETION_RATE, DEAL_COUNT, ACCEPTANCE_RATE
sort_type No String Sorting type, ASC (ascending) or DESC (descending), default is ASC
page No Integer Page number, default is 1
limit No Integer Number of items displayed per page, default is 10

 

Request Example

GET /v2/p2p/market/ads?base_ccy=BTC&quote_ccy=CNY&order_side=BUY&page=1&limit=10 HTTP/1.1

Host: api.coinex.com

 

Response Parameters

Parameter Type Description
data Array List of ads, each structure is the same as the user ad list
pagination Object Pagination info
pagination.total Integer Total number of records
pagination.has_next Boolean Indicates if there is a next page

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": [
        {
            "ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
            "created_at": 1618456789000,
            "updated_at": 1618456789000,
            "ad_number": "AD123456789",
            "ad_side": "BUY",
            "base_ccy": "BTC",
            "quote_ccy": "CNY",
            "price": "200000",
            "available_amount": "0.5",
            "quote_min_limit": "500",
            "quote_max_limit": "50000",
            "status": "ONLINE"
        },
    ],
    "pagination": {
      "total": 50,
      "has_next": true
    }
}

 

5. P2P Order List

Endpoint Info

  • URL Path: /v2/p2p/order
  • Request Method: GET
  • Description: Retrieve the user's P2P order list
  • Permission: Authentication required

 

Request Parameters

Query Parameters

Parameter Required Type Description
start_time No Number Start time (milliseconds timestamp)
end_time No Number End time (milliseconds timestamp)
ad_side No String Ad side, BUY or SELL
quote_ccy No String Quote currency
status No string Order status
page No Integer Page number, default is 1
limit No Integer Number of items displayed per page, default is 10

 

Request Example

GET /v2/p2p/order?start_time=1618456789000&end_time=1618556789000&status=CREATED&page=1&limit=10 HTTP/1.1

Host: api.coinex.com

 

Response Parameters

Parameter Type Description
data Array List of orders
pagination Object Pagination info
pagination.total Integer Total number of records
pagination.has_next Boolean Indicates if there is a next page

 

Each order object contains the following fields:

Parameter Type Description
order_id Integer Order ID
order_num String Order number
ad_id String Ad ID
status String Order status, options: CREATED, CONFIRMED, PAID, FINISHED, CANCELED
created_at Number Creation time (milliseconds timestamp)
finished_at Number Completion time (milliseconds timestamp)
confirm_due_at Number Confirmation due time (milliseconds timestamp)
payment_due_at Number Payment due time (milliseconds timestamp)
order_side String Order side, BUY or SELL
price String Price
base_ccy String Base currency
base_ccy_amount String Base currency amount
quote_ccy String Quote currency
quote_ccy_amount String Quote currency amount
cancel_type String Cancellation types, options: CONFIRM_TIMEOUT (Merchant failed to confirm within the time limit), MERCHANT_CREATED_CANCEL (Merchant declined the order), CUSTOMER_CREATED_CANCEL (User canceled before accepting the order), PAY_TIMEOUT (Buyer failed to make payment within the time limit), BUYER_CANCEL (Buyer canceled the order), SERVICE_CANCEL (Customer support manually canceled the order), SYSTEM_CANCEL (System automatically canceled the order).

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": [
      {
        "order_id": 12345,
        "order_num": "P2P123456789",
        "ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
        "status": "FINISHED",
        "created_at": 1618456789000,
        "finished_at": 1618466789000,
        "confirm_due_at": 1618476789000,
        "payment_due_at": 1618486789000,
        "order_side": "BUY",
        "price": "200000",
        "base_ccy": "BTC",
        "base_ccy_amount": "0.1",
        "quote_ccy": "CNY",
        "quote_ccy_amount": "20000",
        "cancel_type": ""
      },
    ],
    "pagination": {
      "total": 25,
      "has_next": true
    }
}

 

6. P2P Ad Price Modification

Endpoint Info

  • URL Path: /v2/p2p/modify-ads
  • Request Method: POST
  • Description: Batch modify P2P ad prices
  • Permission: Authentication required

 

Request Parameters

Request Body

Parameter Required Type Description
ads Yes Array Array of ad modification details

 

Each element in the ads array contains the following fields:

Parameter Required Type Description
ad_id Yes String Ad ID
price Yes Decimal New price

 

Request Example

POST /v2/p2p/modify-ads HTTP/1.1
Host: api.coinex.com
Content-Type: application/json
{
  "ads": [
    {
      "ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
      "price": "210000"
    },
    {
      "ad_id": "5f7c8b9d1a2b3c4d5e6f7g9i",
      "price": "11000"
    }
  ]
}

 

Response Parameters

The response returns an array of results for each modified ad. Each element contains the following fields:

Parameter Type Description
code Integer Result code, 0 indicates success
message String Result message
data Object Updated ad information on success, null on failure

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": [
    {
      "code": 0,
      "message": "OK",
      "data": {
        "ad_id": "5f7c8b9d1a2b3c4d5e6f7g8h",
        "created_at": 1618456789000,
        "updated_at": 1618556789000,
        "ad_number": "AD123456789",
        "ad_side": "BUY",
        "base_ccy": "BTC",
        "quote_ccy": "CNY",
        "price": "210000",
        "available_amount": "0.5",
        "quote_min_limit": "500",
        "quote_max_limit": "50000",
        "status": "ONLINE"
      }
    },
    {
      "code": 11002,
      "message": "adv not exists",
      "data": null
    }
  ]
}

 

7. P2P Market Depth Data

Endpoint Info

  • URL Path: /v2/p2p/market/depth
  • Request Method: GET
  • Description: Retrieve P2P market depth data
  • Permission: Authentication not required

 

Request parameters

Query Parameters

Parameter Required Type Description
base_ccy Yes String Base currency
quote_ccy Yes String Quote currency

 

Request Example

GET /v2/p2p/market/depth?base_ccy=BTC&quote_ccy=CNY HTTP/1.1

Host: api.coinex.com

 

Response Parameters

Parameter Type Description
base_ccy String Base currency
quote_ccy String Quote currency
index_price String Index price
depth Object Depth data
depth.bids Array Depth data
depth.asks Array Sell order depth

 

Each element in the depth arrays contains the following fields:

Parameter Type Description
price String Price
amount String Amount

 

Response Example

{
  "code": 0,
  "message": "OK",
  "data": {
    "base_ccy": "BTC",
    "quote_ccy": "CNY",
    "index_price": "200000",
    "depth": {
      "bids": [
        {
          "price": "199000",
          "amount": "1.5",
        },
        {
          "price": "198000",
          "amount": "2.0",
        }
      ],
      "asks": [
        {
          "price": "201000",
          "amount": "1.0",
        },
        {
          "price": "202000",
          "amount": "1.8",
        },
      ]
    }
  }
}
Disclaimer: The content provided on this website is for informational purposes only and does not constitute investment advice. The information provided is not intended to be a substitute for professional financial advice, consultation, or recommendations. Users are encouraged to consult with a qualified financial advisor before making any investment decisions. The website owners and authors do not assume any liability for any loss or damage that may result from reliance on the information provided. All investments carry risk, and past performance is not indicative of future results.