Mexc

Mexc

BingX API Information

Mexc Api Link: https://www.mexc.com/api-docs/spot-v3/general-info

Base Endpoint

The base endpoint is:

https://api.mexc.com

HTTP Return Codes

  • HTTP 4XX – Malformed requests; issue is on the sender’s side.
  • HTTP 403 – WAF Limit (Web Application Firewall) violated.
  • HTTP 429 – Request rate limit exceeded.
  • HTTP 5XX – Internal server errors; issue is on MEXC’s side. Execution status is UNKNOWN and may have succeeded.

General Information on Endpoints

  • The API accepts GET, POST, and DELETE requests.
  • For GET endpoints, parameters must be sent as query string.
  • For POST, PUT, and DELETE:
    • Parameters may be sent as:
      • Query string (application/x-www-form-urlencoded)
      • Request body (application/json)
    • You may mix parameters between both.
  • Parameters may be in any order.
  • If a parameter appears in both query string and body, query string wins.

Header

Relevant request headers:

Key Description
X-MEXC-APIKEY Access key
Content-Type application/json

LIMITS

There is a rate limit for API access frequency. If exceeded → 429 Too Many Requests

  • Endpoints with API keys → rate limited by account (UID)
  • Endpoints without API keys → rate limited by IP

Limits Description

  • IP and UID limits are independent.
  • Endpoints indicate whether they use IP or UID limits and show their weight.
  • Each endpoint with IP limits → 500 requests per 10 seconds
  • Each endpoint with UID limits → 500 requests per 10 seconds

Limits Error

  • Upon receiving 429, the client must back off immediately.
  • Repeated violations → automated IP ban
  • Ban durations scale from 2 minutes → 3 days
  • Retry-After header is included with 418 or 429
    • Indicates required wait time.

Error Codes

Code Description
-2011 Unknown order sent
26 operation not allowed
400 api key required
401 No authority
403 Access Denied
429 Too Many Requests
500 Internal error
503 service not available, please try again
504 Gateway Time-out
602 Signature verification failed
10001 user does not exist
10007 bad symbol
10015 user id cannot be null
10072 invalid access key
10073 invalid Request-Time
10095 amount cannot be null
10096 amount decimal places is too long
10097 amount is error
10098 risk control system detected abnormal
10099 user sub account does not open
10100 this currency transfer is not supported
10101 Insufficient balance
10102 amount cannot be zero or negative
10103 this account transfer is not supported
10200 transfer operation processing
10201 transfer in failed
10202 transfer out failed
10206 transfer is disabled
10211 transfer is forbidden
10212 This withdrawal address is not on the commonly used address list or has been invalidated
10216 no address available. Please try again later
10219 asset flow writing failed please try again
10222 currency cannot be null
10232 currency does not exist
10259 Intermediate account does not configured in redisredis
10265 Due to risk control, withdrawal is unavailable, please try again later
10268 remark length is too long
20001 subsystem is not supported
20002 Internal system error please contact support
22222 record does not exist
30000 suspended transaction for the symbol
30001 The current transaction direction is not allowed to place an order
30002 The minimum transaction volume cannot be less than :
30003 The maximum transaction volume cannot be greater than :
30004 Insufficient position
30005 Oversold
30010 no valid trade price
30014 invalid symbol
30016 trading disabled
30018 market order is disabled
30019 api market order is disabled
30020 no permission for the symbol
30021 invalid symbol
30025 no exist opponent order
30026 invalid order ids
30027 The currency has reached the maximum position limit, the buying is suspended
30028 The currency triggered the platform risk control, the selling is suspended
30029 Cannot exceed the maximum order limit
30032 Cannot exceed the maximum position
30041 current order type can not place order
33333 param is error
44444 param cannot be null
60005 your account is abnormal
70011 Pair user ban trade apikey
700001 API-key format invalid
700002 Signature for this request is not valid
700003 Timestamp for this request is outside of the recvWindow
700004 Param ‘origClientOrderId’ or ‘orderId’ must be sent, but both were empty/null
700005 recvWindow must less than 60000
700006 IP non white list
700007 No permission to access the endpoint
700008 Illegal characters found in parameter
730001 Pair not found
730002 Your input param is invalid
730000 Request failed, please contact the customer service
730001 User information error
730002 Parameter error
730003 Unsupported operation, please contact the customer service
730100 Unusual user status
730600 Sub-account Name cannot be null
730601 Sub-account Name must be a combination of 8-32 letters and numbers
730602 Sub-account remarks cannot be null
730700 API KEY remarks cannot be null
730701 API KEY permission cannot be null
730702 API KEY permission does not exist
730703 The IP information is incorrect, and a maximum of 10 IPs are allowed to be bound only
730704 The bound IP format is incorrect, please refill
730705 At most 30 groups of Api Keys are allowed to be created only
730706 API KEY information does not exist
730707 accessKey cannot be null
730101 The user Name already exists
140001 sub account does not exist
140002 sub account is forbidden

RCXT Mexc API Information

There is 1 Base Endpoint for the Mexc exchange:

  • apiUrl: /api.mexc.com
  • fapiUrl: /contract.mexc.com

Rate Limits

The rate limit set for each endpoint on the Mexc exchange is as follows:

Limit (1 minute) Spot Usd Futures Coin Futures TransferIn TransferOut Ticker
Fetch Balances 10 Request Weight 1 Request Weight 1 Request Weight
Fetch Orders 10 Request Weight 10 Request Weight 10 Request Weight
Fetch Trades 10 Request Weight 1 Request Weight 1 Request Weight
Fetch DepositWithdrawals 1 Request Weight 1 Request Weight
Ticker 1 Request Weight

Fetch Balances

Spot Balance
  • The Base Endpoint is apiUrl (api.mexc.com).
  • The Endpoint used is /api/v3/account.
  • The RCXT Endpoint is api/v1/mexc/balances.

The user sends a GET request to query the Mexc wallet balances. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Spot Balance is 10.
Usd Futures Balance
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/account/assets.
  • The RCXT Endpoint is api/v1/mexc/balances.

The user sends a GET request to query the Mexc wallet balances. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Spot Balance is 1.
Coin Futures Balance
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/account/assets.
  • The RCXT Endpoint is api/v1/mexc/balances.

The user sends a GET request to query the Mexc wallet balances. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Spot Balance is 1.

Response Example:

{
  "spot": [
    {
      "coin": "BTTC", #asset
      "total": "208850.4"
    }
  ],
  "margin": null,
  "isolatedMargin": null,
  "futures": [
    {
      "coin": "USDT", # asset
      "total": "0.03733590"
    },
    {
      "coin": "DOGE", #asset
      "total": "2000.00000000"
    }
  ],
  "earnings": null
}

Fetch Trades

Spot Trades
  • The Base Endpoint is apiUrl (api.mexc.com).
  • The Endpoint used is /api/v3/myTrades.
  • The RCXT Endpoint is api/v1/mexc/trades.

The user sends a GET request to query the Mexc Spot trades. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the trade (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: The type is set to spot for Spot Trades.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Spot Trades is 10.
Usd Futures Trades
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/order/list/order_deals.
  • The RCXT Endpoint is api/v1/mexc/trades.

The user sends a GET request to query the Mexc Usd Futures trades. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the trade (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: The type is set to uFutures for Usd Futures Trades.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Usd Futures Trades is 1.
Coin Futures Trades
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/order/list/order_deals.
  • The RCXT Endpoint is api/v1/mexc/trades.

The user sends a GET request to query the Mexc Coin Futures trades. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the trade (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: The type is set to cFutures for Coin Futures Trades.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Coin Futures Trades is 1.

Response Example:

{
  "orders": [
    {
      "orderId": "1881364520706670592", #orderId
      "symbol": "XRPUSDT", #symbol
      "type": "MARKET", #type
      "price": "3.335", #price
      "side": "SELL", #side
      "time": 1737387230537, #time
      "status": "CLOSED", #status
      "executedQuantity": "2.7", #executedQty
      "quantity": "2.7" #origiQty
    }
  ],
  "cursor": ""
}

Fetch Orders

Spot Orders
  • The Base Endpoint is apiUrl (api.mexc.com).
  • The Endpoint used is /api/v3/allOrders.
  • The RCXT Endpoint is api/v1/mexc/orders.

The user sends a GET request to query Mexc Spot orders. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the order (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: Options include spot, cfutures, ufutures. spot should be selected for Spot Orders.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders; if “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Spot Orders is 10.
Spot Open Orders
  • The Base Endpoint is apiUrl (api.mexc.com).
  • The Endpoint used is /api/v3/openOrders.
  • The RCXT Endpoint is api/v1/mexc/orders.

The user sends a GET request to query Mexc Spot orders. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the order (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: Options include spot, cfutures, ufutures. spot should be selected for Spot Open Orders.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders; if “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Spot Open Orders is 3.
Usd Futures Orders
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/order/list/history_orders.
  • The RCXT Endpoint is api/v1/mexc/orders.

The user sends a GET request to query Mexc Spot orders. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the order (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: Options include spot, cfutures, ufutures. spot should be selected for Usd Futures Orders.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders; if “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Usd Futures Orders is 10.
Usd Futures Open Orders
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/order/list/open_orders.
  • The RCXT Endpoint is api/v1/mexc/orders.

The user sends a GET request to query Mexc Spot orders. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the order (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: Options include spot, cfutures, ufutures. spot should be selected for Usd Futures Open Orders.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders; if “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Usd Futures Open Orders is 10.
Coin Futures Orders
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/order/list/history_orders.
  • The RCXT Endpoint is api/v1/mexc/orders.

The user sends a GET request to query Mexc Spot orders. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the order (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: Options include spot, cfutures, ufutures. spot should be selected for Coin Futures Orders.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders; if “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Coin Futures Orders is 10.
Coin Futures Open Orders
  • The Base Endpoint is apiUrl (contract.mexc.com).
  • The Endpoint used is /api/v1/private/order/list/open_orders.
  • The RCXT Endpoint is api/v1/mexc/orders.

The user sends a GET request to query Mexc Spot orders. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • endTime: The date until which we want to fetch data.
    • symbol: The symbol of the pair used in the order (e.g., BTCUSDT).
    • page: Used for pagination, specifies the page to retrieve.
    • type: Options include spot, cfutures, ufutures. spot should be selected for Coin Futures Open Orders.
    • orderStatus: If orderStatus is “open”, it fetches Open Orders; if “closed”, it fetches Closed Orders.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Coin Futures Open Orders is 10.

Response Example:

{
  "orders": [
    {
      "orderId": "1881364520706670592", #orderId
      "symbol": "XRPUSDT", #symbol
      "type": "MARKET", #type
      "price": "3.335", #price
      "side": "SELL", #side
      "time": 1737387230537, #time
      "status": "CLOSED", #status
      "executedQuantity": "2.7", #executedQty
      "quantity": "2.7" #origiQty
    }
  ],
  "cursor": ""
}

Fetch DepositWithdrawals

Transfer In
  • The Base Endpoint is apiUrl (api.mexc.com).
  • The Endpoint used is /api/v3/capital/deposit/hisrec.
  • The RCXT Endpoint is api/v1/mexc/deposit-withdraw-history.

The user sends a GET request to query Mexc transfer-in data. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • fromId: The transfer ID used to filter the specific transfer.
    • type: Options include transferIn and transferOut. transferIn should be selected for Transfer In.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Transfer In is 1.
Transfer Out
  • The Base Endpoint is apiUrl (api.mexc.com).
  • The Endpoint used is /api/v3/capital/withdraw/history.
  • The RCXT Endpoint is api/v1/mexc/deposit-withdraw-history.

The user sends a GET request to query Mexc transfer-out data. This request must include the required header parameters:

  • The apiKey and secretKey values are taken from the header.

  • The following query parameters are required:

    • startTime: The date from which we want to fetch data.
    • fromId: The transfer ID used to filter the specific transfer.
    • type: Options include transferIn and transferOut. transferOut should be selected for Transfer Out.
  • Limiter:

    • Each API endpoint is assigned a specific Request Weight value. The Request Weight value for Transfer Out is 1.

Response Example:

{
  "depositWithdrawals": [
    {
      "fiatCurrency": "",
      "cryptoCurrency": "USDT", #coin
      "fiatAmount": "",
      "cryptoAmount": "10", #amount
      "price": "",
      "address": "TNZcfzLhPXVUVe1NLyjdGrjKkPLbHbncJk", #address
      "orderId": "",
      "transactionId": "e4e406a067ff5ce1c05abc6056e6041478153fc03ba996b565f4727b01a708d8", #txId
      "fee": "",
      "network": "TRC20", #network
      "status": "1", #status
      "time": 1726576711847 #insertTime
    }
  ],
  "cursor": ""
}

Fetch Ticker

Ticker
  • The Base Endpoint is apiUrl (api.mexc.com).

  • The Endpoint used is /api/v3/ticker/price.

  • The RCXT Endpoint is api/v1/mexc/ticker.

  • https://api.mexc.com/api/v3/ticker/24hr: Provides the symbol and current price for cryptocurrency pairs traded only with USDT.

  • The only query parameter required is symbol (e.g. BTCUSDT):

    • symbol: Specifies the symbol of the cryptocurrency pair.

Response Example:

{
  "symbol": "BTCUSDT", #symbol
  "price": "104562.53000000" #price
}