Orders
Place orders and read working ones.
POST /v1/accounts/:id/orders
Place an order. Needs a trade key. Send an Idempotency-Key so a retry cannot
open a second position; see Idempotency.
| Field | Type | |
|---|---|---|
symbol | string | Required. Canonical name like XAUUSD, or the broker's exact name. See Symbols. |
side | "buy" | "sell" | Required. |
volume | number | Required. In lots. |
kind | "market" | "limit" | "stop" | Optional, default market. |
price | number | Required for limit and stop. |
stopLoss | number | Optional. |
takeProfit | number | Optional. |
comment | string | Optional, up to 64 characters. Visible in MetaTrader. |
curl -X POST "https://api.orderfill.trade/v1/accounts/$ACCOUNT_ID/orders" \
-H "authorization: Bearer $ORDERFILL_API_KEY" \
-H "content-type: application/json" \
-H "idempotency-key: $(uuidgen)" \
-d '{"symbol":"XAUUSD","side":"buy","volume":0.1,"stopLoss":2395}'
{ "result": { "ok": true, "ticket": "4737871287", "price": 2411.82, "message": "Request executed" } }
ok: false is the broker declining, not an HTTP error: the request reached them and
they said no. message carries their reason, for example "Market closed" or "Position
limit reached".
POST /v1/accounts/:id/orders/check
What the broker would say to an order, without sending it. Same body as placing one.
Needs only a read key.
{ "check": { "ok": true, "margin": 24.1, "marginFree": 7210.7, "message": "Done" } }
PATCH /v1/accounts/:id/orders/:ticket
Move a working order. Send any of price, stopLoss, takeProfit; what you leave out
keeps its current value. Needs trade. Send an Idempotency-Key.
{ "result": { "ok": true, "ticket": "4737990011", "price": 1.075, "message": "Request executed" } }
DELETE /v1/accounts/:id/orders/:ticket
Cancel a working order. Needs trade. Send an Idempotency-Key.
{ "result": { "ok": true, "ticket": "4737990011", "price": null, "message": "Request executed" } }
GET /v1/accounts/:id/orders
Working (pending) orders.
{
"orders": [
{
"ticket": "4737990011", "symbol": "XAUUSD", "brokerSymbol": "XAUUSDm", "side": "buy", "kind": "limit",
"volume": 0.1, "price": 2390, "stopLoss": null, "takeProfit": 2430,
"placedAt": 1759225600000
}
]
}
Times are Unix milliseconds. Every response that names an instrument gives both
symbol (the canonical name when there is one) and brokerSymbol (your broker's).
Either is valid to send back.