MetaKit
beta
API Reference

Base URL: https://api.metakit.cloud

Trading

Place and manage orders on a connected account.

  • Every write needs both a full-scope API key (403 insufficient_scope otherwise) and an account on a full slot (403 account_readonly otherwise). The account must be connected (409 account_not_connected).
  • Volume and stops are validated against the symbol spec before anything is sent: off-step volumes return 422 invalid_volume (never rounded), stops on the wrong side or inside stops_level return 422 invalid_stops, and a symbol whose trade_mode forbids the side returns 422 symbol_not_tradeable.
  • Broker refusals return 422 with status "rejected" and the raw MT5 retcode — never a 5xx.
POST

/v1/accounts/{id}/orders

Place order

Open a market position, or place a limit/stop order. price is required for limit and stop, ignored for market. A limit buys below / sells above the market and a stop buys above / sells below; the price must be at least stops_level points away. expiration (ISO 8601) applies to pending orders only; omitted means good-till-cancelled. Response status is filled (market) or placed (pending). position_ticket equals the order ticket on hedging accounts.

Parameters
NameTypeRequiredDescription
Idempotency-KeyheaderNoYour own id for this order, e.g. the idea/signal id. Strongly recommended.
Request body
{
  "symbol": "XAUUSD.m",
  "side": "buy",
  "type": "market",
  "volume": 0.12,
  "price": null,
  "sl": 2310.50,
  "tp": 2362.00,
  "deviation": 20,
  "comment": "TickerAI idea 7f3a",
  "expiration": null
}
Example request
curl https://api.metakit.cloud/v1/accounts/123/orders \
  -H "Authorization: Bearer stk_live_..." \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{...'
Example response
{
  "status": "filled",
  "order_ticket": 48812231,
  "position_ticket": 48812231,
  "deal_ticket": 91002817,
  "fill_price": 2331.42,
  "volume": 0.12,
  "sl": 2310.50,
  "tp": 2362.00,
  "retcode": 10009,
  "retcode_message": "Request completed",
  "time": "2026-09-22T14:03:11.000Z"
}

// Broker refusal — 422:
{
  "error": { "code": "order_rejected", "message": "There is not enough money to complete the request" },
  "status": "rejected",
  "retcode": 10019,
  "retcode_message": "There is not enough money to complete the request"
}
PATCH

/v1/accounts/{id}/positions/{ticket}

Modify position

Move the stop loss and/or take profit of an open position. A field you omit keeps its value; 0 or null clears it. Stops are checked against the current close price and stops_level before sending.

Request body
{ "sl": 2320.0, "tp": 2362.0 }
Example request
curl https://api.metakit.cloud/v1/accounts/123/positions/123 \
  -H "Authorization: Bearer stk_live_..." \
  -H "Content-Type: application/json" \
  -X PATCH \
  -d '{ "sl": 2320.0, "tp": 2362.0 }...'
Example response
{
  "status": "modified",
  "order_ticket": null,
  "position_ticket": 48812231,
  "deal_ticket": null,
  "fill_price": null,
  "volume": 0.12,
  "sl": 2320.0,
  "tp": 2362.0,
  "retcode": 10009,
  "retcode_message": "Request completed",
  "time": "2026-09-22T14:20:05.000Z"
}
DELETE

/v1/accounts/{id}/positions/{ticket}

Close position

Close a position fully (no body, or no volume) or partially. A partial volume must be a multiple of volume_step and at most the open volume. Status is closed or partially_closed (with remaining_volume).

Request body
{ "volume": 0.06, "deviation": 20 }
Example request
curl https://api.metakit.cloud/v1/accounts/123/positions/123 \
  -H "Authorization: Bearer stk_live_..." \
  -H "Content-Type: application/json" \
  -X DELETE \
  -d '{ "volume": 0.06, "deviation": 20 }...'
Example response
{
  "status": "partially_closed",
  "order_ticket": 48812902,
  "position_ticket": 48812231,
  "deal_ticket": 91003377,
  "fill_price": 2340.10,
  "volume": 0.06,
  "remaining_volume": 0.06,
  "sl": 2320.0,
  "tp": 2362.0,
  "retcode": 10009,
  "retcode_message": "Request completed",
  "time": "2026-09-22T14:41:30.000Z"
}
DELETE

/v1/accounts/{id}/orders/{ticket}

Cancel order

Cancel a pending (limit/stop) order that has not filled.

Example request
curl https://api.metakit.cloud/v1/accounts/123/orders/123 \
  -H "Authorization: Bearer stk_live_..." \
  -X DELETE
Example response
{
  "status": "cancelled",
  "order_ticket": 48813001,
  "position_ticket": null,
  "deal_ticket": null,
  "fill_price": null,
  "volume": 0.10,
  "sl": 2340.0,
  "tp": 2400.0,
  "retcode": 10009,
  "retcode_message": "Request completed",
  "time": "2026-09-22T14:50:12.000Z"
}