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.
List — GET /v1/orders
Section titled “List — GET /v1/orders”Retrieve all pending orders on the account.
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 } ]}| Field | Type | Description |
|---|---|---|
ticket | integer | Order ticket — pass this to modify/cancel |
symbol | string | Trading symbol |
type | string | buy_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) |
volume | number | Volume in lots |
price | number | Trigger / limit price |
sl | number | Stop loss (0 if unset) |
tp | number | Take profit (0 if unset) |
Place — POST /v1/orders
Section titled “Place — POST /v1/orders”Place a new pending order. Unlike /v1/trade (which executes at market), this order rests until its trigger price is reached.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Trading symbol (e.g. EURUSD) |
type | string | Yes | buy_limit, sell_limit, buy_stop, or sell_stop |
volume | number | Yes | Lots. Must respect volume_min/volume_max/volume_step |
price | number | Yes | Trigger price. Must be a valid price for the symbol’s digits |
sl | number | No | Stop loss price |
tp | number | No | Take profit price |
expiration | integer | No | Unix epoch seconds. Omit or 0 = good-till-cancelled (GTC) |
comment | string | No | Max 27 chars, ASCII. Prefixed with API in MT5 |
Example
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}| Field | Type | Description |
|---|---|---|
status | string | placed on success, rejected on MT5 rejection |
retcode | integer | MT5 return code. 10009 (done) / 10008 (placed) indicate success |
type | string | Echoed order type |
order | integer | New order ticket |
Modify — PATCH /v1/orders/{ticket}
Section titled “Modify — PATCH /v1/orders/{ticket}”Update a pending order. Only the fields you send change; everything else is left as-is.
| Parameter | Type | Required | Description |
|---|---|---|---|
price | number | No | New trigger price |
sl | number | No | New stop loss |
tp | number | No | New take profit |
volume | number | No | New volume in lots |
expiration | integer | No | New expiration (epoch seconds) |
Example
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 — DELETE /v1/orders/{ticket}
Section titled “Cancel — DELETE /v1/orders/{ticket}”Cancel a pending order.
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-Keyheader. GET /v1/ordersreflects place/modify/cancel within ~2 seconds.- See Error Codes for
invalid_request,invalid_volume,order_not_found, and MT5rejectedretcodes.