Skip to content

Trading API Overview

The XBTFX Trading API provides programmatic access to your trading account through a modern REST and WebSocket interface. Execute trades, manage positions, retrieve account data, and stream real-time market quotes — all over HTTPS with JSON payloads.

https://interface.xbtfx.com

All REST endpoints are prefixed with /v1/. WebSocket connections use wss://ws.xbtfx.com/v1/ws.

  • Transport: HTTPS (TLS 1.2+)
  • Format: JSON request and response bodies
  • Authentication: Bearer token via Authorization header
  • Rate Limiting: 600 weight per minute per API key
  • Query account balance, equity, margin, and leverage
  • Look up symbol specifications (contract size, volume limits, spreads)
  • Open, close, modify, and reverse positions
  • Retrieve open positions and pending orders
  • Pull trade history with flexible date ranges
  • Stream real-time bid/ask quotes over WebSocket
  • Access order book depth (up to 5 levels)
  1. Sign up at my.xbtfx.com and open a trading account
  2. Create an API key at console.xbtfx.com (same login as my.xbtfx.com)
  3. Authenticate requests using your Bearer token
  4. Query your account info to verify connectivity
  5. Start trading
EndpointMethodDescription
/v1/auth/statusGETCheck API key status and permissions
/v1/accountGETRetrieve account balance, equity, and margin
EndpointMethodDescription
/v1/symbolsGETList all available trading symbols
/v1/symbols/:symbolGETGet specification for a single symbol
EndpointMethodDescription
/v1/tradePOSTOpen a market position
/v1/closePOSTClose a specific position
/v1/close-allPOSTClose all open positions
/v1/close-symbolPOSTClose all positions for a symbol
/v1/modifyPOSTModify SL/TP on a position or order
/v1/close-byPOSTClose position by opposite (hedging only)
/v1/reversePOSTReverse a position atomically
EndpointMethodDescription
/v1/positionsGETList open positions
/v1/ordersGETList pending orders
/v1/historyGETRetrieve trade history

For streaming price quotes, connect via WebSocket at wss://ws.xbtfx.com/v1/ws. The WebSocket supports real-time bid/ask quotes and market depth data.

Ready-to-use examples are available for: