curl Examples
Practical examples for interacting with the XBTFX Trading API using curl. Replace your_api_key_here with your actual API key in all examples.
Check Auth Status
Section titled “Check Auth Status”curl -X GET https://interface.xbtfx.com/v1/auth/status \ -H "Authorization: Bearer your_api_key_here"Get Account Info
Section titled “Get Account Info”curl -X GET https://interface.xbtfx.com/v1/account \ -H "Authorization: Bearer your_api_key_here"Get Symbol Specification
Section titled “Get Symbol Specification”curl -X GET https://interface.xbtfx.com/v1/symbols/EURUSD \ -H "Authorization: Bearer your_api_key_here"Open a Trade
Section titled “Open a Trade”Buy 0.1 lots of EURUSD with stop loss and take profit:
curl -X POST https://interface.xbtfx.com/v1/trade \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "symbol": "EURUSD", "side": "buy", "volume": 0.1, "sl": 1.08000, "tp": 1.09500 }'Open a trade with an idempotency key:
curl -X POST https://interface.xbtfx.com/v1/trade \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \ -d '{ "symbol": "BTCUSD", "side": "sell", "volume": 0.01 }'Get Open Positions
Section titled “Get Open Positions”All positions:
curl -X GET https://interface.xbtfx.com/v1/positions \ -H "Authorization: Bearer your_api_key_here"Filtered by symbol:
curl -X GET "https://interface.xbtfx.com/v1/positions?symbol=EURUSD" \ -H "Authorization: Bearer your_api_key_here"Close a Position
Section titled “Close a Position”Close a full position:
curl -X POST https://interface.xbtfx.com/v1/close \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678 }'Partial close (0.05 of 0.1 lots):
curl -X POST https://interface.xbtfx.com/v1/close \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678, "volume": 0.05 }'Modify SL/TP
Section titled “Modify SL/TP”curl -X POST https://interface.xbtfx.com/v1/modify \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678, "sl": 1.08200, "tp": 1.09800 }'Remove stop loss:
curl -X POST https://interface.xbtfx.com/v1/modify \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678, "sl": 0 }'Get Trade History
Section titled “Get Trade History”Using a named period:
curl -X GET "https://interface.xbtfx.com/v1/history?period=last_week" \ -H "Authorization: Bearer your_api_key_here"Using a custom date range:
curl -X GET "https://interface.xbtfx.com/v1/history?from=2026-01-01&to=2026-03-31" \ -H "Authorization: Bearer your_api_key_here"Get Pending Orders
Section titled “Get Pending Orders”curl -X GET https://interface.xbtfx.com/v1/orders \ -H "Authorization: Bearer your_api_key_here"Close All Positions
Section titled “Close All Positions”curl -X POST https://interface.xbtfx.com/v1/close-all \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{}'