XT.COM API Documentation

website·Indexed 36 days ago

https://doc.xt.com

API reference for the XT.COM exchange, featuring endpoints for futures copy trading, earn product positions, loan asset inquiries, broker sub-account management, and spot batch order operations.

Tokens
143.6K
Snippets
834
Records
1.1K
Agent score
63%

What's inside XT.COM

  1. Overview of XT AI TradeKit

    XT AI TradeKit is an AI-agent-native trading suite for XT.COM. It allows developers and traders to use plain language to check markets, perform positioning analysis, research coins, read news, manage assets, and place orders without writing API integration code. It consists of two primary layers: a local MCP server that wraps XT's APIs into 39 structured tools, and a scenario-oriented Skill layer that defines how the AI should use those tools and interact with the user.
  2. Understand the historical copy order response schema

    The response returns an array of order objects in the result field. Each object contains details about the trade, including quantities, prices, profit metrics, and the associated leader's information.
    {
      "rc": 0,
      "mc": "string",
      "ma": [{}],
      "result": [
        {
          "id": "string",
          "orderId": "string",
          "symbol": "string",
          "buySize": 0,
          "buyTime": 0,
          "buyPrice": 0,
          "sellSize": 0,
          "sellTime": 0,
          "sellPrice": 0,
          "profit": 0,
          "profitRate": 0,
          "triggerProfitPrice": 0,
          "triggerStopPrice": 0,
          "leaderOrderId": "string",
          "leaderNickname": "string",
          "leaderAvatar": "string"
        }
      ]
    }
  3. Retrieve user financial assets overview

    Use the /v4/finance/balance endpoint to get a comprehensive overview of a user's financial assets. This includes total assets (valued in USDT and BTC), total and latest interest earnings, demand assets, and loan assets. The endpoint requires authentication via request headers; no query parameters are needed.
    curl -G "https://sapi.xt.com/v4/finance/balance" \
    -H "validate-appkey: $APPKEY" \
    -H "validate-timestamp: $TIMESTAMP" \
    -H "validate-signature: $SIGNATURE" \
    -H "Content-Type: application/json"
  4. Retrieve coin fundamental profiles using market_coin_profile

    Use the market_coin_profile(coin) function (powered by the xt-coin-research skill) to retrieve a comprehensive profile of a cryptocurrency. The coin parameter accepts symbols or names (e.g., btc or bitcoin). The tool returns market cap rank, current market cap, Fully Diluted Valuation (FDV), circulating vs. total supply, all-time high (ATH) with drawdown, and sector classification.

    Note: The FDV/market cap ratio is a critical indicator of unlock pressure; a higher ratio suggests more tokens are yet to circulate, increasing potential future sell pressure.

    You: How do ARB's fundamentals look AI: [ARB / Arbitrum] Market cap rank #42, market cap 1.24B USD FDV 3.87B USD — FDV/market cap ≈ 3.1, a large share of tokens is still locked Circulating 3.2B / total 10B (32%) ATH $2.40 (2023-01), -87% since Sector: Layer 2, Ethereum ecosystem

  5. Understand the historical leader order response schema

    The response returns an array of order objects in the result field. Each object contains details about the trade, including buy/sell prices, quantities, timestamps, profit metrics, and the number of followers.
    {
      "rc": 0,
      "mc": "string",
      "ma": [{}],
      "result": [
        {
          "id": "string",
          "orderId": "string",
          "symbol": "string",
          "buySize": 0,
          "buyTime": 0,
          "buyPrice": 0,
          "sellSize": 0,
          "sellTime": 0,
          "sellPrice": 0,
          "profit": 0,
          "profitRate": 0,
          "triggerProfitPrice": 0,
          "triggerStopPrice": 0,
          "followCount": 0
        }
      ]
    }
  6. Interpret XT.com API Message Codes (mc)

    The XT.com API uses a mc (Message Code) field in its responses to provide specific details about the outcome of a request. These codes are categorized by the type of error or state encountered:

    General Status

    • SUCCESS: Request successful
    • FAILURE: Request failed

    Authentication Errors (AUTH_xxx)

    • AUTH_001 to AUTH_007: Missing or bad request headers (appkey, timestamp, recvwindow, algorithms, signature)
    • AUTH_101: ApiKey does not exist
    • AUTH_102: ApiKey is not activated
    • AUTH_103: Signature error
    • AUTH_104: Unbound IP request
    • AUTH_105: Outdated message
    • AUTH_106: Exceeded apikey permission

    Symbol & Market Errors (SYMBOL_xxx)

    • SYMBOL_001: Symbol not exist
    • SYMBOL_002: Symbol offline
    • SYMBOL_003: Symbol suspend trading
    • SYMBOL_004: Symbol country disallow trading
    • SYMBOL_005: Symbol does not support trading via API
    • SYMBOL_007: Trading pair does not support order modification
    • SYMBOL_010: Market does not support your trading
    • SYMBOL_011: Trading pair temporarily restricted due to high risk

    Order & Trading Errors (ORDER_xxx)

    • ORDER_001: Platform rejection
    • ORDER_002: Insufficient funds
    • ORDER_003: Trading pair suspended
    • ORDER_004: No transaction
    • ORDER_005: Order not exist
    • ORDER_006: Too many open orders
    • ORDER_007: Sub-account has no transaction authority
    • ORDER_008: Order price or quantity precision is abnormal
    • ORDER_F0101 to ORDER_F0704: Trigger filters for Price, Quantity, Quote Quantity, Protection Limits, and Liquidation price limits

    Deposit & Withdrawal Errors

    • DEPOSIT_001 to DEPOSIT_008: Issues including closed deposits, low security (2FA required), incorrect address formats, or generation delays.
    • WITHDRAW_001 to WITHDRAW_017: Issues including closed withdrawals, invalid addresses, 2FA requirements, risk control triggers, T+1 rule restrictions, insufficient balance, or daily limit exceedance.

    Common System Errors

    • COMMON_001: User does not exist
    • COMMON_002: System busy
    • COMMON_003: Operation failed
    • CURRENCY_001: Currency information is abnormal
  7. Retrieve trading symbol information via /v4/public/symbol

    Use the /v4/public/symbol endpoint to get detailed information about trading pairs, including currency precision, fee rates, supported order types, and trading filters.

    Rate Limits:

    • Single symbol requests: 10 requests per second per IP.
    • Multiple symbol requests: 10 requests per second per IP.
    curl --location --request GET 'https://sapi.xt.com/v4/public/symbol?symbol=XT_USDT' \
      --header 'accept: */*' \
      --header 'Content-Type: application/json'
  8. Retrieve the current copy trading following list

    Use the GET /future/copytrade/user/v1/copy-trade/current-following-v2 endpoint to retrieve a list of traders the user is currently following. The response includes detailed information about the follow mode (CUSTOM or AUTO), follow amounts, profit sharing, and a detailed list of open/closed orders including leverage, margin, and PnL.
    GET /future/copytrade/user/v1/copy-trade/current-following-v2
  9. Handle futures notification WebSocket responses

    When a notification event is triggered, the WebSocket returns a JSON object containing the symbol, position details, and the notification type. The notifyType field indicates the severity or nature of the event: WARN (warning, about to be liquidated), PARTIAL (partial liquidation), LIQUIDATION (forced liquidation), or ADL (auto-deleveraging).
    {
      "topic": "notify",
      "event": "notify",
      "data": {
        "symbol": "btc_usdt",
        "positionType": "ISOLATED",
        "positionSide": "LONG",
        "positionSize": "123",
        "notifyType": "WARN"
      }
    }
  10. Use Trading APIs for Independent Broker sub-accounts

    Independent broker sub-accounts possess the same account, asset, spot trading, and futures trading capabilities as standard sub-accounts. The only distinction is the statistics and commission attribution logic. Developers should use the standard sub-account API documentation for spot and futures trading, ensuring they verify the correct Base URL for each product section in the respective 'Basic Information' pages.