### Get Account Information - Response Example Source: https://www.mexc.com/api-docs/spot-v3/spot-account-trade This JSON object details the current account information, including commission rates, trading permissions, and asset balances. Balances are broken down into free, locked, and available amounts for each asset. ```json { "makerCommission": null, "takerCommission": null, "buyerCommission": null, "sellerCommission": null, "canTrade": true, "canWithdraw": true, "canDeposit": true, "updateTime": null, "accountType": "SPOT", "balances": [{ "asset": "NBNTEST", "free": "1111078", "locked": "33", "available": "1" }, { "asset": "MAIN", "free": "1020000", "locked": "0", "available": "102000" }], "permissions": ["SPOT"] } ``` -------------------------------- ### Deposit Address Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example response for the deposit address endpoint, showing addresses for different networks. ```json [ { "coin": "USDT", "network": "TRC20", "address": "TXobiKkdciupZrhdvZyTSSLjE8CmZAufS", "memo": null }, { "coin": "USDT", "network": "BEP20(BSC)", "address": "0xebe4804f7ecc22d5011c42e6ea1f2e6c891d89b", "memo": null }, { "coin": "USDT", "network": "ERC20", "address": "0x3f4d1f43761b52fd594e5a77cd83cab6955e85b", "memo": null } ] ``` -------------------------------- ### Referral Code Response Example Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Example JSON response when querying a referral code. ```json { "referCode": "in3jd" } ``` -------------------------------- ### Generate Deposit Address Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example response for generating a deposit address, showing different formats for coins with and without tags/memos. ```json [ { "coin": "USDT", "network": "TRC20", "address": "TXobiKkdciupZrhdvZyTSSLjE8CmZAufS", "tag": null }, { "coin": "EOS", "network": "EOS", "address": "zzqqqqqqqqqq", "memo": "MX10068" } ] ``` -------------------------------- ### Batch Orders Request Example Source: https://www.mexc.com/api-docs/spot-v3/spot-account-trade Example of a batchOrders list containing two orders, one BUY and one SELL for BTCUSDT. Note the different parameters required for each order type. ```json [{"type": "LIMIT_ORDER","price": "40000","quantity": "0.0002","symbol": "BTCUSDT","side": "BUY","newClientOrderId": 9588234},{"type": "LIMIT_ORDER","price": "4005","quantity": "0.0003","symbol": "BTCUSDT","side": "SELL"}] ``` -------------------------------- ### Affiliate Commission Record Response Example Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Example JSON response for affiliate commission records, including pagination and detailed results. ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 2, "totalPage": 1, "currentPage": 1, "usdtAmount": null, "totalCommissionUsdtAmount": null, "totalTradeUsdtAmount": null, "finished": null, "resultList": [ { "uid": "27121050", "account": "", "inviteCode": "mexc-12345", "inviteTime": 1637145911, "spot": "0.00000000", "etf": "0.21131086", "futures": "0.74546367", "total": "0.95677453", "deposit": null, "firstDepositTime": null }, { "uid": "52813530", "account": "", "inviteCode": "mexc-12345", "inviteTime": 1637145478, "spot": "1.25023599", "etf": "0.00000000", "futures": "0.00000000", "total": "1.25023599", "deposit": "26000.00000000", "firstDepositTime": "2021-11-19" } ] } } ``` -------------------------------- ### Diff.Depth Stream Response Example Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams Example response from the Diff.Depth Stream, showing updates to the order book. Price levels with a quantity of 0 should be removed. ```json { "channel": "spot@public.aggre.depth.v3.api.pb@100ms@BTCUSDT", "publicincreasedepths": { "asksList": [], // asks: Sell orders "bidsList": [ { "price": "92877.58", // Price level of change "quantity": "0.00000000" // Quantity } ], "eventtype": "spot@public.aggre.depth.v3.api.pb@100ms", // Event type "fromVersion" : "10589632359", // from version "toVersion" : "10589632359" // to version }, "symbol": "BTCUSDT", // Trading pair "sendtime": 1736411507002 // Event time } ``` -------------------------------- ### Affiliate Withdraw Record Response Example Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Example JSON response for affiliate withdrawal records, including pagination and details of each withdrawal. ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 15, "totalPage": 2, "currentPage": 1, "resultList": [ { "withdrawTime": 1682321417000, "asset": "USDT", "amount": "0.00001000" }, { "withdrawTime": 1682321405000, "asset": "USDC", "amount": "0.00001000" } ] } } ``` -------------------------------- ### Get All Orders - Response Example Source: https://www.mexc.com/api-docs/spot-v3/spot-account-trade This JSON structure represents the response when retrieving all account orders. It includes details for each order such as symbol, IDs, quantities, status, and timestamps. The query is limited to the latest 7 days. ```json [ { "symbol": "LTCBTC", "orderId": 1, "orderListId": -1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "cummulativeQuoteQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559, "updateTime": 1499827319559, "isWorking": true, "stpMode": "", "origQuoteOrderQty": "0.000000" } ] ``` -------------------------------- ### Execute POST /api/v3/order with Signed Payload (Example 2) Source: https://www.mexc.com/api-docs/spot-v3/general-info This curl command shows how to send a signed order request with parameters in the request body, corresponding to the second signature example. Verify the signature matches the parameters. ```bash $ curl -H "X-MEXC-APIKEY: mx0aBYs33eIilxBWC5" -X POST 'https://api.mexc.com/api/v3/order' -d 'symbol=BTCUSDT&side=BUY&type=LIMIT&quantity=1&price=11&recvWindow=5000×tamp=1644489390087&signature=fd3e4e8543c5188531eb7279d68ae7d26a573d0fc5ab0d18eb692451654d837a' ``` -------------------------------- ### Deposit History Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example structure of a successful deposit history response, detailing amount, coin, network, status, and transaction information. ```json [ { "amount": "50000", "coin": "EOS", "network": "EOS", "status": 5, "address": "0x20b7cf77db93d6ef1ab979c49142ec168427fdee", "txId": "01391d1c1397ef0a3cbb3c7f99a90846f7c8c2a8dddcdcf84f46b530dede203e1bc804", "insertTime": 1659513342000, "unlockConfirm": "10", "confirmTimes": "241", "memo": "xxyy1122" } ] ``` -------------------------------- ### K-line Streams Response Example Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams Example response from the K-line Streams, providing candlestick data including interval, prices, volume, and time window. ```json { "channel": "spot@public.kline.v3.api.pb@BTCUSDT@Min15", "publicspotkline": { "interval": "Min15", // K-line interval "windowstart": 1736410500, // Start time of the K-line "openingprice": "92925", // Opening trade price during this K-line "closingprice": "93158.47", // Closing trade price during this K-line "highestprice": "93158.47", // Highest trade price during this K-line "lowestprice": "92800", // Lowest trade price during this K-line "volume": "36.83803224", // Trade volume during this K-line "amount": "3424811.05", // Trade amount during this K-line "windowend": 1736411400 // End time of the K-line }, "symbol": "BTCUSDT", "symbolid": "2fb942154ef44a4ab2ef98c8afb6a4a7", "createtime": 1736410707571 } ``` -------------------------------- ### Get Assets That Can Be Converted Into MX Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Retrieve a list of assets that can be converted into MX. Requires SPOT_ACCOUNT_READ permission. ```http get {{api_url}}/api/v3/capital/convert/list?timestamp={{timestamp}}&signature={{signature}} ``` ```json [ { "convertMx": "0.000009", "convertUsdt": "0.000009", "balance": "0.000441", "asset": "USDT", "code": "30021", "message": "xxxxxxx" }, { "convertMx": "0.000009", "convertUsdt": "0.000009", "balance": "0.000441", "asset": "BTC", "code": "30021", "message": "xxxxxxx" } ] ``` -------------------------------- ### Java Protobuf Data Serialization and Deserialization Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams Example of assembling, serializing, and deserializing data using PushDataV3ApiWrapper in Java. Ensure the protobuf-java dependency is included. ```java //Parsing example: // Assemble the object PushDataV3ApiWrapper pushDataV3ApiWrapper = PushDataV3ApiWrapper.newBuilder() .setChannel("spot@public.aggre.depth.v3.api.pb@10ms") .setSymbol("BTCUSDT") .setSendTime(System.currentTimeMillis()) .build(); // Serialize to a byte array byte[] serializedData = pushDataV3ApiWrapper.toByteArray(); // Deserialize into a PushDataV3ApiWrapper object PushDataV3ApiWrapper resultV3 = PushDataV3ApiWrapper.parseFrom(serializedData); ``` -------------------------------- ### Withdraw Address Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example response for the withdraw address endpoint, including address, tag, and memo. ```json { "data": [ { "coin": "USDT", "network": "TRC20", "address": "TArGWdTApuuZtiWMjupXqbZqQYsBTy126o", "addressTag": "test", "memo": null }, { "coin": "USDT", "network": "BEP20(BSC)", "address": "0xa82898C70BeB5E1b1621fdA62fD17Ba27227BBC5", "addressTag": "usdt", "memo": null } ], "totalRecords": 2, "page": 1, "totalPageNum": 1 } ``` -------------------------------- ### Python Protobuf Data Serialization and Deserialization Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams Example of assembling, serializing, and deserializing data using PushDataV3ApiWrapper in Python. Ensure the generated _pb2 file is imported. ```python #Parsing example: import PushDataV3ApiWrapper_pb2 # Assemble the object pushData = PushDataV3ApiWrapper_pb2.PushDataV3ApiWrapper() pushData.channel = 'spot@public.aggre.depth.v3.api.pb@10ms' pushData.symbol = 'BTCUSDT' # Serialize to a string serializedData = pushData.SerializeToString() # Deserialize into a PushDataV3ApiWrapper object result = PushDataV3ApiWrapper_pb2.PushDataV3ApiWrapper() result.ParseFromString(serializedData) print(result) ``` -------------------------------- ### Dust Log Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example JSON response structure for dust log data, including total converted amounts, fees, and detailed conversion records. ```json { "data": [ { "totalConvert": "0.00885018", "totalFee": "0.000177", "convertTime": 1665360563000, "convertDetails": [ { "id": "3e52a99c5c3447b2af2163cd829dca28", "convert": "0.00885018", "fee": "0.000177", "amount": "0.007130464601986065", "time": 1665360563000, "asset": "ETHF" } ] }, { "totalConvert": "0.026782", "totalFee": "0.00053562", "convertTime": 1663631477000, "convertDetails": [ { "id": "6483bfb1766d41d8a4b6b6315ded6e99", "convert": "0.02098255", "fee": "0.00041965", "amount": "0.00000098", "time": 1663631477000, "asset": "BTC" }, { "id": "f9e886f28c454f5dae45eec6a11f6c6a", "convert": "0.00084019", "fee": "0.0000168", "amount": "2", "time": 1663631477000, "asset": "JAM" } ] } ], "totalRecords": 4, "page": 1, "totalPageNum": 1 } ``` -------------------------------- ### Get Account Trade List - Response Example Source: https://www.mexc.com/api-docs/spot-v3/spot-account-trade This JSON array represents a list of trades executed within the account for a specific symbol. Each trade entry includes details like symbol, trade ID, order ID, price, quantity, commission, and timestamps. Queries are limited to the past 1 month. ```json [ { "symbol": "BNBBTC", "id": "fad2af9e942049b6adbda1a271f990c6", "orderId": "bb41e5663e124046bd9497a3f5692f39", "orderListId": -1, "price": "4.00000100", "qty": "12.00000000", "quoteQty": "48.000012", "commission": "10.10000000", "commissionAsset": "BNB", "time": 1499865549590, "isBuyer": true, "isMaker": false, "isBestMatch": true, "isSelfTrade": true, "clientOrderId": null } ] ``` -------------------------------- ### Withdraw History Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example structure of a successful withdrawal history response, including details like ID, transaction hash, coin, address, amount, and status. ```json [ { "id": "bb17a2d452684f00a523c015d512a341", "txId": null, "coin": "EOS", "network": "EOS", "address": "zzqqqqqqqqqq", "amount": "10", "transferType": 0, "status": 3, "transactionFee": "0", "confirmNo": null, "applyTime": 1665300874000, "remark": "", "memo": "MX10086", "transHash": "0x0ced593b8b5adc9f600334d0d7335456a7ed772ea5547beda7ffc4f33a065c", "updateTime": 1712134082000, "coinId": "128f589271cb495b03e71e6323eb7be", "vcoinId": "af42c6414b9a46c8869ce30fd51660f" } ] ``` -------------------------------- ### Trade Streams Response Example Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams This is an example of the response received from the Trade Streams. It includes details of individual trades such as price, quantity, type, and time. ```json { "channel": "spot@public.aggre.deals.v3.api.pb@100ms@BTCUSDT", "publicdeals": { "dealsList": [ { "price": "93220.00", // Trade price "quantity": "0.04438243", // Trade quantity "tradetype": 2, // Trade type (1: Buy, 2: Sell) "time": 1736409765051 // Trade time } ], "eventtype": "spot@public.aggre.deals.v3.api.pb@100ms" // Event type }, "symbol": "BTCUSDT", // Trading pair "sendtime": 1736409765052 // Event time } ``` -------------------------------- ### Get Deposit Address (Supporting Network) Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Retrieve a deposit address for a specific coin, optionally specifying the network. Requires authentication. ```bash get /api/v3/capital/deposit/address?coin=USDT×tamp={{timestamp}}&signature={{signature}} ``` -------------------------------- ### GET /api/v3/rebate/affiliate/referral Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves affiliate referral data. If startTime and endTime are not provided, data from the last 7 days is returned. ```APIDOC ## GET /api/v3/rebate/affiliate/referral ### Description Retrieves detailed referral data for affiliates, including user statistics and commission information. This endpoint is restricted to affiliate accounts. ### Method GET ### Endpoint /api/v3/rebate/affiliate/referral ### Parameters #### Query Parameters - **startTime** (long) - Optional - The start time for the data retrieval period. - **endTime** (long) - Optional - The end time for the data retrieval period. - **uid** (string) - Optional - The user ID to filter referrals. - **inviteCode** (string) - Optional - The invite code to filter referrals. - **page** (int) - Optional - The page number for pagination. - **pageSize** (int) - Optional - The number of items per page, defaults to 10. - **timestamp** (long) - Required - The timestamp of the request. - **signature** (string) - Required - The signature of the request. ### Request Example ```json { "timestamp": 1678886400000, "signature": "your_signature_here" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **code** (integer) - The status code of the response. - **message** (string) - Any message associated with the response. - **data** (object) - Contains the referral data. - **pageSize** (integer) - The number of items per page. - **totalCount** (integer) - The total number of referrals. - **totalPage** (integer) - The total number of pages. - **currentPage** (integer) - The current page number. - **resultList** (array) - A list of referral objects. - **uid** (integer) - The user ID of the referred affiliate. - **nickName** (string) - The nickname of the referred affiliate (can be null). - **email** (string) - The email of the referred affiliate. - **registerTime** (long) - The registration time of the referred affiliate. - **inviteCode** (string) - The invite code used by the referred affiliate. - **depositAmount** (string) - The total deposit amount in USDT. - **tradingAmount** (string) - The total trading amount in USDT. - **commission** (string) - The total commission earned in USDT. - **firstDepositTime** (long) - The time of the first deposit (can be null). - **firstTradeTime** (long) - The time of the first trade (can be null). - **lastDepositTime** (long) - The time of the last deposit (can be null). - **lastTradeTime** (long) - The time of the last trade (can be null). - **withdrawAmount** (string) - The total withdrawal amount in USDT. - **asset** (string) - The asset category based on the total amount. - **identification** (integer) - The identification level of the user (1: Uncertified, 2: Primary, 3: Advanced, 4: Institutional). #### Response Example ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 15, "totalPage": 2, "currentPage": 1, "resultList": [ { "uid": 42469975, "nickName": null, "email": "", "registerTime": 1640275818000, "inviteCode": "mexc-12201950", "depositAmount": "0.00000000", "tradingAmount": "0.00000000", "commission": "0.00000000", "firstDepositTime": null, "firstTradeTime": null, "lastDepositTime": null, "lastTradeTime": null, "withdrawAmount": "0.00000000", "asset": "0 USDT", "identification": 1 } ] } } ``` ``` -------------------------------- ### Get Subaffiliates Data Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves data for subaffiliates. If startTime and endTime are not provided, data from the past 7 days is returned. Requires SPOT_ACCOUNT_READ permission. ```http get /api/v3/rebate/affiliate/subaffiliates?timestamp={{timestamp}}&signature={{signature}} ``` ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 15, "totalPage": 2, "currentPage": 1, "resultList": [ { "subaffiliateName": "ada176@mailtemp.top ada176", "subaffiliateMail": "ad*****6@mailtemp.top", "campaign": "new1", "inviteCode": "mexc-12181621", "activationTime": 1639834136000, "registered": 0, "deposited": 0, "depositAmount": "0", "commission": "0" }, { "subaffiliateName": "ada165@mailtemp.top ada165", "subaffiliateMail": "ad*****5@mailtemp.top", "campaign": null, "inviteCode": "1KMyk", "activationTime": 1639831541000, "registered": 0, "deposited": 1, "depositAmount": "21.15318", "commission": "0.5161221" } ] } } ``` -------------------------------- ### GET /api/v3/rebate/affiliate/campaign Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves affiliate campaign data. Supports filtering by time range. If no time range is specified, data from the last 7 days is returned. ```APIDOC ## GET /api/v3/rebate/affiliate/campaign ### Description Retrieves affiliate campaign data. Supports filtering by time range. If no time range is specified, data from the last 7 days is returned. ### Method GET ### Endpoint /api/v3/rebate/affiliate/campaign ### Parameters #### Query Parameters - **startTime** (long) - Optional - startTime - **endTime** (long) - Optional - endTime - **page** (int) - Optional - page - **pageSize** (int) - Optional - pageSize, default: 10 - **timestamp** (long) - Yes - timestamp - **signature** (string) - Yes - signature ### Response #### Success Response (200) - **pageSize** (int) - Description - **totalCount** (int) - Description - **totalPage** (int) - Description - **currentPage** (int) - Description - **resultList** (array) - Description - **campaign** (string) - campaign name - **inviteCode** (string) - campaign inviteCode - **createTime** (long) - campaign createTime - **clickTime** (int) - inviteCode clickTime - **signup** (int) - signup number - **traded** (int) - traded number - **deposited** (int) - deposited number - **depositAmount** (string) - depositAmount(usdt) - **tradingAmount** (string) - tradingAmount(usdt) - **commission** (string) - commission #### Response Example ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 15, "totalPage": 2, "currentPage": 1, "resultList": [ { "campaign": "11kd", "inviteCode": "mexc-11Kd", "clickTime": 0, "createTime": 1695125287000, "signup": 0, "traded": 0, "deposited": 0, "depositAmount": "0", "tradingAmount": "0", "commission": "0" }, { "campaign": "New10", "inviteCode": "mexc-newcode", "clickTime": 7, "createTime": 1693152531000, "signup": 0, "traded": 0, "deposited": 0, "depositAmount": "0", "tradingAmount": "0", "commission": "0" } ] } } ``` ``` -------------------------------- ### Get Affiliate Commission Record Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves affiliate commission records. If startTime and endTime are not provided, it defaults to the last six months of data. Requires authentication. ```bash get /api/v3/rebate/affiliate/commission?timestamp={{timestamp}}&signature={{signature}} ``` -------------------------------- ### Get Affiliate Withdraw Record API Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves withdrawal records for affiliate accounts. If start and end times are not provided, it defaults to the last six months of data. ```APIDOC ## GET /api/v3/rebate/affiliate/withdraw ### Description Fetches affiliate withdrawal records. Returns data for the last six months if time parameters are omitted. ### Method GET ### Endpoint /api/v3/rebate/affiliate/withdraw ### Parameters #### Query Parameters - **startTime** (long) - Optional - The start time for the query (Unix timestamp). - **endTime** (long) - Optional - The end time for the query (Unix timestamp). - **page** (int) - Optional - The page number for pagination. - **pageSize** (int) - Optional - The number of records per page (default: 10). - **timestamp** (long) - Required - The timestamp of the request. - **signature** (string) - Required - The signature of the request. ### Response #### Success Response (200) - **pageSize** (int) - The number of records per page. - **totalCount** (int) - The total number of withdrawal records. - **totalPage** (int) - The total number of pages. - **currentPage** (int) - The current page number. - **resultList** (array) - A list of withdrawal records. - **withdrawTime** (long) - Timestamp of the withdrawal. - **asset** (string) - The asset withdrawn (e.g., USDT, USDC). - **amount** (string) - The amount withdrawn. ### Response Example ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 15, "totalPage": 2, "currentPage": 1, "resultList": [ { "withdrawTime": 1682321417000, "asset": "USDT", "amount": "0.00001000" }, { "withdrawTime": 1682321405000, "asset": "USDC", "amount": "0.00001000" } ] } } ``` ``` -------------------------------- ### Get Affiliate Commission Record API Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves commission records for affiliate accounts. If start and end times are not provided, it defaults to the last six months of data. ```APIDOC ## GET /api/v3/rebate/affiliate/commission ### Description Fetches affiliate commission records. Returns data for the last six months if time parameters are omitted. ### Method GET ### Endpoint /api/v3/rebate/affiliate/commission ### Parameters #### Query Parameters - **startTime** (long) - Required - The start time for the query (Unix timestamp). - **endTime** (long) - Required - The end time for the query (Unix timestamp). - **inviteCode** (string) - Optional - Filters commissions by a specific invite code. - **page** (int) - Optional - The page number for pagination. - **pageSize** (int) - Optional - The number of records per page (default: 10). - **timestamp** (long) - Required - The timestamp of the request. - **signature** (string) - Required - The signature of the request. ### Response #### Success Response (200) - **pageSize** (int) - The number of records per page. - **totalCount** (int) - The total number of commission records. - **totalPage** (int) - The total number of pages. - **currentPage** (int) - The current page number. - **usdtAmount** (string) - Total commission in USDT (may be null). - **totalCommissionUsdtAmount** (string) - Total commission amount in USDT (may be null). - **totalTradeUsdtAmount** (string) - Total trading volume in USDT (may be null). - **finished** (boolean) - Indicates if the commission process is finished (may be null). - **resultList** (array) - A list of commission records. - **uid** (string) - User ID. - **account** (string) - User account identifier. - **inviteCode** (string) - The invite code used. - **inviteTime** (long) - Timestamp when the user was invited. - **spot** (string) - Spot trading commission in USDT. - **etf** (string) - ETF trading commission in USDT. - **futures** (string) - Futures trading commission in USDT. - **total** (string) - Total commission in USDT for the record. - **deposit** (string) - Deposit amount in USDT (may be null). - **firstDepositTime** (string) - Timestamp of the first deposit (may be null). ### Response Example ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 2, "totalPage": 1, "currentPage": 1, "usdtAmount": null, "totalCommissionUsdtAmount": null, "totalTradeUsdtAmount": null, "finished": null, "resultList": [ { "uid": "27121050", "account": "", "inviteCode": "mexc-12345", "inviteTime": 1637145911, "spot": "0.00000000", "etf": "0.21131086", "futures": "0.74546367", "total": "0.95677453", "deposit": null, "firstDepositTime": null }, { "uid": "52813530", "account": "", "inviteCode": "mexc-12345", "inviteTime": 1637145478, "spot": "1.25023599", "etf": "0.00000000", "futures": "0.00000000", "total": "1.25023599", "deposit": "26000.00000000", "firstDepositTime": "2021-11-19" } ] } } ``` ``` -------------------------------- ### Query Currency Information - GET /api/v3/capital/config/getall Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Use this endpoint to retrieve details about supported currencies, including deposit and withdrawal enable status, fees, and network information. The response provides a list of coins, each with a networkList detailing specific network configurations. ```json [ { "coin": "BTC", "name": "BTC-BSC", "networkList": [ { "coin": "BTC", "depositDesc": null, "depositEnable": true, "minConfirm": 3, "name": "Bitcoin", "network": "Bitcoin(BTC)", "withdrawEnable": true, "withdrawFee": "0.000014", "withdrawIntegerMultiple": null, "withdrawMax": "50", "withdrawMin": "0.00008", "sameAddress": false, "contract": "", "withdrawTips": "", "depositTips": null, "netWork": "BTC" }, { "coin": "BTC", "depositDesc": null, "depositEnable": true, "minConfirm": 61, "name": "BTC-BSC", "network": "BNB Smart Chain(BEP20)", "withdrawEnable": true, "withdrawFee": "0.00000028", "withdrawIntegerMultiple": null, "withdrawMax": "100", "withdrawMin": "0.00003", "sameAddress": false, "contract": "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", "withdrawTips": null, "depositTips": null, "netWork": "BSC" } ] }, { "coin": "SUT", "name": "SUPERTRUST", "networkList": [ { "coin": "SUT", "depositDesc": null, "depositEnable": true, "minConfirm": 450, "name": "SUPERTRUST", "network": "Polygon(MATIC)", "withdrawEnable": true, "withdrawFee": "0.2", "withdrawIntegerMultiple": null, "withdrawMax": "100000", "withdrawMin": "10", "sameAddress": false, "contract": "0x98965474EcBeC2F532F1f780ee37b0b05F77Ca55", "withdrawTips": null, "depositTips": null, "netWork": "MATIC" } ] } ] ``` -------------------------------- ### Internal Transfer Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example JSON response for an internal transfer, containing the transaction ID. ```json { "tranId": "c45d800a47ba4cbc876a5cd29388319" } ``` -------------------------------- ### Generate Listen Key - POST /api/v3/userDataStream Source: https://www.mexc.com/api-docs/spot-v3/websocket-user-data-streams Initiates a new user data stream. The stream remains active for 60 minutes unless a keepalive signal is sent. Requires 'Account Read' or 'SPOT_ACCOUNT_R' permissions. ```json { "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" } ``` -------------------------------- ### Place New Order Source: https://www.mexc.com/api-docs/spot-v3/spot-account-trade Submits a new order to the exchange. Supports various order types (LIMIT, MARKET) and parameters like symbol, side, quantity, and price. Requires SPOT_DEAL_WRITE permission and rate limits apply. ```bash POST /api/v3/order?symbol=MXUSDT&side=BUY&type=LIMIT&quantity=50&price=0.1×tamp={{timestamp}}&signature={{signature}} ``` ```json { "symbol": "MXUSDT", "orderId": "06a480e69e604477bfb48dddd5f0b750", "orderListId": -1, "price": "0.1", "origQty": "50", "type": "LIMIT", "side": "BUY", "stpMode": "", "transactTime": 1666676533741 } ``` -------------------------------- ### Get Valid Listen Keys - GET /api/v3/userDataStream Source: https://www.mexc.com/api-docs/spot-v3/websocket-user-data-streams Retrieves a list of all currently active listen keys for the user. Indicates the total number of keys and available keys. ```json { "total": 200, "listenKey": [ "342e83dfc434e8a5639a6f405d3cf9dc3caaf11ca6f6b9a475a6f2e9a4e1bf8d", "c716a755cc12fc905159c4f318920ccd25938224230d676431607735609719ed" ], "available": 198 } ``` -------------------------------- ### Get Affiliate Referral Data Source: https://www.mexc.com/api-docs/spot-v3/rebate-endpoints Retrieves referral data for affiliates. If startTime and endTime are not provided, data from the past 7 days is returned. Requires SPOT_ACCOUNT_READ permission. ```http get /api/v3/rebate/affiliate/referral?timestamp={{timestamp}}&signature={{signature}} ``` ```json { "success": true, "code": 0, "message": null, "data": { "pageSize": 10, "totalCount": 15, "totalPage": 2, "currentPage": 1, "resultList": [ { "uid": "42469975", "nickName": null, "email": "", "registerTime": 1640275818000, "inviteCode": "mexc-12201950", "depositAmount": "0.00000000", "tradingAmount": "0.00000000", "commission": "0.00000000", "firstDepositTime": null, "firstTradeTime": null, "lastDepositTime": null, "lastTradeTime": null, "withdrawAmount": "0.00000000", "asset": "0 USDT", "identification": 1 } ] } } ``` -------------------------------- ### Create a Sub-account Source: https://www.mexc.com/api-docs/spot-v3/subaccount-endpoints Use this endpoint to create a new sub-account from a master account. Requires subAccount name and a note. ```json { "subAccount":"mexc1", "note":"1" } ``` -------------------------------- ### Internal Transfer History Response Example Source: https://www.mexc.com/api-docs/spot-v3/wallet-endpoints Example JSON response for internal transfer history, showing transaction details like tranId, asset, amount, accounts, status, and timestamp. ```json { "page": 1, "totalRecords": 1, "totalPageNum": 1, "data": [ { "tranId":"11945860693", "asset":"BTC", "amount":"0.1", "toAccountType":"EMAIL", "toAccount":"156283619@outlook.com", "fromAccount":"156283618@outlook.com", "status":"SUCCESS", "timestamp":1544433325000 }, { "tranId":"", "asset":"BTC", "amount":"0.8", "toAccountType":"UID", "fromAccount":"156283619@outlook.com", "toAccount":"87658765", "status":"SUCCESS", "timestamp":1544433325000 } ] } ``` -------------------------------- ### Spot Account Update - WebSocket Response Source: https://www.mexc.com/api-docs/spot-v3/websocket-user-data-streams Example of a server-pushed response detailing changes in spot account assets, including balance, frozen amounts, and change types. ```json { "channel": "spot@private.account.v3.api.pb", "createTime": 1736417034305, "sendTime": 1736417034307, "privateAccount": { "vcoinName": "USDT", "coinId": "128f589271cb4951b03e71e6323eb7be", "balanceAmount": "21.94210356004384", "balanceAmountChange": "10", "frozenAmount": "0", "frozenAmountChange": "0", "type": "CONTRACT_TRANSFER", "time": 1736416910000 } } ``` -------------------------------- ### Subscribe to Diff.Depth Stream Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams Subscribe to real-time order book updates. The parameter format is spot@public.aggre.depth.v3.api.pb@(100ms|10ms)@. Use this to track changes in price levels. ```json { "method": "SUBSCRIPTION", "params": [ "spot@public.aggre.depth.v3.api.pb@100ms@BTCUSDT" ] } ``` -------------------------------- ### Query Offline Symbols Source: https://www.mexc.com/api-docs/spot-v3/market-data-endpoints Get information on trading pairs that have been suspended or delisted. ```APIDOC ## GET /api/v3/symbol/offline ### Description Get information on trading pairs that have been suspended or delisted. ### Method GET ### Endpoint /api/v3/symbol/offline ### Parameters #### Query Parameters NONE ### Response #### Success Response (200) - **data** (array) - An array of offline symbol objects. - **symbol** (string) - The trading pair symbol. - **state** (int) - Status: 2 - Suspended, 3 - Delisted. - **offlineTime** (long) - Delisting time in milliseconds (optional). #### Response Example ```json { "data": [ { "symbol": "LVNUSDT", "state": 3 }, { "symbol": "LOKAUSDT", "state": 3, "offlineTime": 1724125694000 } ] } ``` ``` -------------------------------- ### Query Current Open Orders Source: https://www.mexc.com/api-docs/spot-v3/spot-account-trade Get all open orders for a given symbol. Be cautious when calling this endpoint without specifying a symbol. Requires SPOT_DEAL_READ permission. The weight for this endpoint is 3. ```json [ { "symbol": "LTCBTC", "orderId": 1, "orderListId": -1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "cummulativeQuoteQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559, "updateTime": 1499827319559, "isWorking": true, "stpMode":"", "cancelReason":"stp_cancel", "origQuoteOrderQty": "0.000000" } ] ``` -------------------------------- ### Generate Java Deserialization Code Source: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams Use protoc to compile .proto files and generate Java deserialization code. Specify the output directory for the generated files. ```bash protoc *.proto --java_out=python custom_path ```