Skip to content

Orders

Pending (resting) orders are limit and stop orders that wait at a trigger price until the market reaches them. This page covers the full lifecycle: list, place, modify, and cancel.

Retrieve all pending orders on the account.

Terminal window
curl -X GET https://interface.xbtfx.com/v1/orders \
-H "Authorization: Bearer your_api_key_here"

Response

{
"count": 1,
"orders": [
{
"ticket": 24458192,
"symbol": "EURUSD",
"type": "buy_limit",
"volume": 0.01,
"price": 1.14400,
"sl": 1.14200,
"tp": 1.14600
}
]
}
FieldTypeDescription
ticketintegerOrder ticket — pass this to modify/cancel
symbolstringTrading symbol
typestringbuy_limit, sell_limit, buy_stop, sell_stop (also buy_stop_limit/sell_stop_limit if such an order exists, e.g. placed from the terminal)
volumenumberVolume in lots
pricenumberTrigger / limit price
slnumberStop loss (0 if unset)
tpnumberTake profit (0 if unset)

Place a new pending order. Unlike /v1/trade (which executes at market), this order rests until its trigger price is reached.

ParameterTypeRequiredDescription
symbolstringYesTrading symbol (e.g. EURUSD)
typestringYesbuy_limit, sell_limit, buy_stop, or sell_stop
volumenumberYesLots. Must respect volume_min/volume_max/volume_step
pricenumberYesTrigger price. Must be a valid price for the symbol’s digits
slnumberNoStop loss price
tpnumberNoTake profit price
expirationintegerNoUnix epoch seconds. Omit or 0 = good-till-cancelled (GTC)
commentstringNoMax 27 chars, ASCII. Prefixed with API in MT5

Example

Terminal window
curl -X POST https://interface.xbtfx.com/v1/orders \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"symbol": "EURUSD",
"type": "buy_limit",
"volume": 0.01,
"price": 1.14400,
"sl": 1.14200,
"tp": 1.14600
}'

Response

{
"status": "placed",
"retcode": 10009,
"type": "buy_limit",
"order": 24458192
}
FieldTypeDescription
statusstringplaced on success, rejected on MT5 rejection
retcodeintegerMT5 return code. 10009 (done) / 10008 (placed) indicate success
typestringEchoed order type
orderintegerNew order ticket

Update a pending order. Only the fields you send change; everything else is left as-is.

ParameterTypeRequiredDescription
pricenumberNoNew trigger price
slnumberNoNew stop loss
tpnumberNoNew take profit
volumenumberNoNew volume in lots
expirationintegerNoNew expiration (epoch seconds)

Example

Terminal window
curl -X PATCH https://interface.xbtfx.com/v1/orders/24458192 \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{ "price": 1.14300, "sl": 1.14100, "tp": 1.14700 }'

Response

{ "status": "modified", "retcode": 10009, "order": 24458192 }

Returns 404 order_not_found if the ticket isn’t a pending order on your account.

Cancel a pending order.

Terminal window
curl -X DELETE https://interface.xbtfx.com/v1/orders/24458192 \
-H "Authorization: Bearer your_api_key_here"

Response

{ "status": "cancelled", "retcode": 10009, "order": 24458192 }

Returns 404 order_not_found if the ticket isn’t a pending order on your account.

  • Place / modify / cancel require an API key with trade permission, are weight-rate-limited, and accept an Idempotency-Key header.
  • GET /v1/orders reflects place/modify/cancel within ~2 seconds.
  • See Error Codes for invalid_request, invalid_volume, order_not_found, and MT5 rejected retcodes.