Reference
Objects
Every JSON shape the API sends or takes, with each field explained. Route pages link here; agents can load the OpenAPI document for the same shapes as JSON Schema.
Account
The password is write-only: never returned, stored encrypted with a per-install key.
idstring requiredYour id for the account, used in every URL. a-z, 0-9 and -, up to 48 characters.
labelstring requiredDisplay name.
logininteger requiredMT5 login number.
serverstring requiredTrade server name, for example Pepperstone-Demo.
hoststring requiredWeb terminal host the session connects to.
portinteger requiredPort, usually 443.
symbolsarray of string requiredSymbols kept subscribed for live prices (the watchlist).
enabledboolean requiredWhen false the server keeps the account but does not connect it.
created_atinteger requiredWhen the account was added, unix seconds (UTC).
tls_namestring or null requiredFor an IP access point: the name on the gateway's certificate. null for a named host.
trade_realboolean requiredWhether trading is allowed when the broker reports this account as real money (account type real or preliminary). Off by default: every route that needs the trade scope then answers 403 real_account. Demo and contest accounts trade either way, and reading is never affected.
new_trades_pausedboolean requiredNew trades are paused (0.6.0): an order that would open something answers 403 trading_paused and is not sent; closing, changing stops and cancelling still work.
pinnedboolean requiredThe gateway's certificate key was pinned by an admin (see the server directory).
statusobject requiredAccountStatus fields
connectedboolean requiredWhether the session to the broker is up right now.
sinceinteger or null requiredUnix seconds (UTC) when the current connection came up. null while disconnected.
reconnectsinteger requiredAutomatic reconnects since the server started.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds. null before the first one.
server_buildinteger or null requiredMT5 build the broker's server reported. null before the first login.
last_errorstring or null requiredWhy the last connection attempt failed or the connection dropped. null while connected.
subscribedinteger requiredNumber of symbols with a live price subscription.
login_rejectedboolean requiredTrue after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.
retry_atinteger or null requiredUnix seconds (UTC) of the next connection attempt while disconnected, else null.
clockstring or null requiredHow the trade server's clock relates to UTC, for the *_utc fields (0.7.0): ny7 (New York plus 7 hours on the US calendar: IC Markets, Pepperstone), utc (Exness), or null for none. With a rule, answers and streams carry time_utc beside time, time_utc_msc beside time_msc (and the same for time_setup, time_done, time_update, and expiration_utc beside a pending order's expiration), each worked out by itself from the time-zone database; a time in New York's repeated autumn hour uses the earlier offset and adds <name>_utc_ambiguous: true. Without one, no UTC fields: Termless never guesses a broker's clock.
ny7utcNone
{
"id": "pepperstone-12345678",
"label": "Pepperstone demo",
"login": 12345678,
"server": "Pepperstone-Demo",
"host": "mt5-demo01.pepperstone.com",
"port": 443,
"symbols": [
"XAUUSD",
"EURUSD"
],
"enabled": true,
"created_at": 1790881742,
"tls_name": null,
"trade_real": false,
"new_trades_paused": false,
"clock": null,
"pinned": false,
"status": {
"connected": true,
"since": 1790968298,
"reconnects": 0,
"ping_ms": 14.2,
"server_build": 6090,
"last_error": null,
"subscribed": 2,
"login_rejected": false,
"retry_at": null
}
}AccountStatus
connectedboolean requiredWhether the session to the broker is up right now.
sinceinteger or null requiredUnix seconds (UTC) when the current connection came up. null while disconnected.
reconnectsinteger requiredAutomatic reconnects since the server started.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds. null before the first one.
server_buildinteger or null requiredMT5 build the broker's server reported. null before the first login.
last_errorstring or null requiredWhy the last connection attempt failed or the connection dropped. null while connected.
subscribedinteger requiredNumber of symbols with a live price subscription.
login_rejectedboolean requiredTrue after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.
retry_atinteger or null requiredUnix seconds (UTC) of the next connection attempt while disconnected, else null.
{
"connected": true,
"since": 1790968298,
"reconnects": 0,
"ping_ms": 14.2,
"server_build": 6090,
"last_error": null,
"subscribed": 2,
"login_rejected": false,
"retry_at": null
}AccountCreate
idstringYour id for the account: a-z, 0-9 and -, up to 48 characters. Defaults to the server's first word and the login, for example pepperstone-12345678.
labelstringDisplay name. Defaults to the server and login.
logininteger requiredMT5 login number (a numeric string also works).
passwordstring required write-onlyMT5 password (master or investor). Write-only.
serverstring requiredTrade server name exactly as the broker spells it.
hoststringWeb terminal host. Looked up from server (this install's directory, then the built-in list) when omitted; 400 if it cannot be found.
portintegerPort. Defaults to the directory's port, else 443.
tls_namestringFor an IP access point: the name on its certificate. Defaults to the directory's for that host.
symbolsarray of stringSymbols to keep subscribed (the watchlist).
enabledboolean defaulttruefalse saves the account without connecting it.
trade_realboolean defaultfalseAllow trading when the broker reports the account as real money. Off by default; demo and contest accounts trade either way.
clockstring or nullHow the trade server's clock relates to UTC, for the *_utc fields (0.7.0): ny7 (New York plus 7 hours on the US calendar: IC Markets, Pepperstone), utc (Exness), or null for none. With a rule, answers and streams carry time_utc beside time, time_utc_msc beside time_msc (and the same for time_setup, time_done, time_update, and expiration_utc beside a pending order's expiration), each worked out by itself from the time-zone database; a time in New York's repeated autumn hour uses the earlier offset and adds <name>_utc_ambiguous: true. Without one, no UTC fields: Termless never guesses a broker's clock.
ny7utcNone
{
"label": "Pepperstone demo",
"login": 12345678,
"password": "your MT5 password",
"server": "Pepperstone-Demo",
"symbols": [
"XAUUSD",
"EURUSD"
]
}AccountPatch
Send only the fields you want to change.
labelstringDisplay name.
passwordstring write-onlyNew MT5 password. Write-only. Logs in again.
serverstringTrade server name. Logs in again; the host is looked up when host is not sent.
hoststringWeb terminal host. Logs in again.
portintegerPort. Logs in again.
tls_namestringThe name on the gateway's certificate, for an IP access point; an empty string clears it. Logs in again.
symbolsarray of stringReplaces the whole watchlist and starts streaming new symbols without logging in again.
enabledbooleanfalse logs out and parks the account, true connects it again.
trade_realbooleantrue allows trading when the broker reports the account as real money; false turns it off again. Takes effect at once, without logging in again.
new_trades_pausedbooleantrue refuses orders that would open something (403 trading_paused, not sent) while closing, changing stops and cancelling still work; false lets them through again (0.6.0). At once, no new login.
clockstring or nullHow the trade server's clock relates to UTC, for the *_utc fields (0.7.0): ny7 (New York plus 7 hours on the US calendar: IC Markets, Pepperstone), utc (Exness), or null for none. With a rule, answers and streams carry time_utc beside time, time_utc_msc beside time_msc (and the same for time_setup, time_done, time_update, and expiration_utc beside a pending order's expiration), each worked out by itself from the time-zone database; a time in New York's repeated autumn hour uses the earlier offset and adds <name>_utc_ambiguous: true. Without one, no UTC fields: Termless never guesses a broker's clock. null takes it away; at once, open streams too.
ny7utcNone
{
"symbols": [
"XAUUSD",
"EURUSD",
"GBPUSD"
]
}{
"trade_real": true
}Summary
logininteger requiredMT5 login number.
namestring requiredAccount holder name at the broker.
serverstring requiredTrade server name.
companystring requiredBroker company name.
currencystring requiredDeposit currency.
leverageinteger requiredLeverage, for example 200 for 1:200.
balancenumber requiredBalance without open positions.
creditnumber requiredCredit from the broker.
profitnumber requiredFloating profit of open positions, live.
equitynumber requiredbalance + credit + profit, live.
marginnumber requiredMargin in use, live.
margin_freenumber requiredequity - margin.
margin_levelnumber requiredequity / margin x 100, in percent. 0 with no margin in use.
margin_so_callnumber requiredMargin call level.
margin_so_sonumber requiredStop out level.
trade_allowedboolean requiredWhether the broker allows trading on this account.
demoboolean requiredTrue for a demo account.
hedgingboolean requiredTrue for a hedging account, false for netting.
server_offsetinteger requiredTrade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.
positionsinteger requiredOpen positions.
ordersinteger requiredPending orders.
{
"login": 12345678,
"name": "Demo Trader",
"server": "Pepperstone-Demo",
"company": "Pepperstone Group Limited",
"currency": "USD",
"leverage": 200,
"balance": 10412.58,
"credit": 0.0,
"profit": 238.11,
"equity": 10650.69,
"margin": 878.93,
"margin_free": 9771.76,
"margin_level": 1211.78,
"margin_so_call": 100.0,
"margin_so_so": 50.0,
"trade_allowed": true,
"demo": true,
"hedging": true,
"server_offset": 10800,
"positions": 3,
"orders": 2
}SymbolBrief
namestring requiredSymbol name, for example XAUUSD.
descriptionstring requiredBroker's description.
pathstring requiredFolder in the broker's symbol tree.
digitsinteger requiredPrice decimals.
{
"name": "XAUUSD",
"description": "Gold vs US Dollar",
"path": "Metals\\XAUUSD",
"digits": 2
}SymbolSpec
With the broker's group overrides applied.
namestring requiredSymbol name.
descriptionstring requiredBroker's description.
pathstring requiredFolder in the broker's symbol tree.
digitsinteger requiredPrice decimals.
pointnumber requiredSmallest price step, 10^-digits.
contract_sizenumber requiredUnits per 1.00 lot.
tick_sizenumber requiredSmallest price change. The point when the broker does not send one.
tick_valuenumber or null requiredValue of one tick_size move for 1.00 lot, in the account currency. The broker's own figure, else worked out as the terminal does: tick_size x contract_size, converted from currency_profit to the account currency, for forex, CFD, leveraged CFD and exchange stock symbols. null when the broker sends none and it cannot be worked out (futures and index CFDs, or no conversion symbol). Pepperstone sends neither tick value nor tick size.
currency_basestring requiredBase currency.
currency_profitstring requiredProfit currency.
currency_marginstring requiredMargin currency.
volume_minnumber requiredSmallest order, in lots.
volume_maxnumber requiredLargest order, in lots.
volume_stepnumber requiredLot step.
volume_limitnumber requiredLargest total of open positions and pending orders in one direction, in lots. 0 = no limit.
trade_modestring requiredWhether trading is allowed. unknown only for a value MetaTrader does not define.
fulllong_onlyshort_onlyclose_onlydisabledunknownexecutionstring requiredExecution mode. unknown only for a value MetaTrader does not define.
marketinstantrequestexchangeunknownfillingarray of string requiredFilling modes the symbol allows.
fokiocreturnstops_levelinteger requiredMinimum distance of SL and TP from the price, in points.
freeze_levelinteger requiredDistance in points inside which orders cannot be changed.
swap_longnumber requiredSwap for long positions, in the unit swap_mode names.
swap_shortnumber requiredSwap for short positions, in the unit swap_mode names.
swap_modestring requiredThe unit of swap_long and swap_short. unknown only for a value MetaTrader does not define.
disabledpointssymbol_currencymargin_currencydeposit_currencyinterest_currentinterest_openreopen_currentreopen_bidprofit_currencyunknownswap_3daystring or null requiredThe day the swap is charged three times: sunday, monday, tuesday, wednesday, thursday, friday or saturday. null for none (crypto CFDs send none).
margin_initialnumber requiredInitial margin setting of the symbol, as the broker sends it.
margin_maintenancenumber requiredMaintenance margin setting, as the broker sends it.
margin_hedgednumber requiredMargin for a hedged pair of positions (one lot each way), as the broker sends it.
margin_rate_buynumber requiredInitial margin rate for a buy (the same as margin_rates.buy).
margin_rate_sellnumber requiredInitial margin rate for a sell (the same as margin_rates.sell).
margin_ratesobject requiredEvery order type's initial margin rate, as the broker sends it. A pending type's rate is what the broker holds while such an order waits: the brokers seen send 0 there (nothing is held), and once the order fills the position needs its side's market rate. A market rate of 0 counts as 1.
Fields
buynumber requiredInitial margin rate for a buy.
sellnumber requiredInitial margin rate for a sell.
buy_limitnumber requiredInitial margin rate for a buy limit.
sell_limitnumber requiredInitial margin rate for a sell limit.
buy_stopnumber requiredInitial margin rate for a buy stop.
sell_stopnumber requiredInitial margin rate for a sell stop.
buy_stop_limitnumber requiredInitial margin rate for a buy stop limit.
sell_stop_limitnumber requiredInitial margin rate for a sell stop limit.
expirationarray of string requiredThe expiry modes a pending order on this symbol may use.
gtcdayspecifiedspecified_dayorder_typesarray of string requiredThe order types the symbol takes.
marketlimitstopstop_limitsltpclose_bysessionsobject requiredFields
quotearray of array of array of integer requiredQuote sessions: 7 lists, one per weekday, Sunday first, each a list of [open_min, close_min] in minutes from midnight, trade server time.
tradearray of array of array of integer requiredTrade sessions, same shape as quote.
tradeableboolean or null requiredWhether a trade can be opened now, as on /quotes: the trade_mode is full, long_only or short_only, and one of today's trade sessions is open by the server's clock. null when the broker sent no trade sessions.
book_depthintegerThe levels a side of the symbol's order book may hold (0 when the broker sends none); a book past it is renewed (0.7.0).
{
"name": "XAUUSD",
"description": "Gold vs US Dollar",
"path": "Metals\\XAUUSD",
"digits": 2,
"point": 0.01,
"contract_size": 100,
"tick_size": 0.01,
"tick_value": 1.0,
"currency_base": "XAU",
"currency_profit": "USD",
"currency_margin": "XAU",
"volume_min": 0.01,
"volume_max": 100,
"volume_step": 0.01,
"volume_limit": 0,
"trade_mode": "full",
"execution": "market",
"filling": [
"fok",
"ioc"
],
"stops_level": 0,
"freeze_level": 0,
"swap_long": -6.2,
"swap_short": 1.4,
"swap_mode": "points",
"swap_3day": "wednesday",
"margin_initial": 0.0,
"margin_maintenance": 0.0,
"margin_hedged": 50.0,
"margin_rate_buy": 1.0,
"margin_rate_sell": 1.0,
"margin_rates": {
"buy": 1.0,
"sell": 1.0,
"buy_limit": 0.0,
"sell_limit": 0.0,
"buy_stop": 0.0,
"sell_stop": 0.0,
"buy_stop_limit": 0.0,
"sell_stop_limit": 0.0
},
"expiration": [
"gtc",
"day",
"specified",
"specified_day"
],
"order_types": [
"market",
"limit",
"stop",
"stop_limit",
"sl",
"tp",
"close_by"
],
"sessions": {
"quote": [
[],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[]
],
"trade": [
[],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[
[
0,
1440
]
],
[]
]
},
"tradeable": true
}Quote
symbolstring requiredSymbol name.
bidnumber or null requiredBid price. null when the symbol has no price yet.
asknumber or null requiredAsk price. null when the symbol has no price yet.
lastnumber or null requiredLast deal price. 0 for most forex and CFD symbols; null when the symbol has no price yet.
timeinteger or null requiredUnix seconds, trade server clock.
time_mscinteger or null requiredUnix milliseconds, trade server clock.
tradeableboolean or null requiredWhether a trade can be opened now: the symbol's trade_mode is full, long_only or short_only, and one of today's trade sessions is open by the server's clock. null when the broker sent no trade sessions.
{
"symbol": "XAUUSD",
"bid": 2391.42,
"ask": 2391.6,
"last": 0,
"time": 1790981179,
"time_msc": 1790981179473,
"tradeable": true
}Candles
symbolstring requiredSymbol name, as the broker spells it.
timeframestring requiredTimeframe.
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1candlesarray of Candle requiredBars, oldest first. Each says whether it is complete.
Candle fields
timeinteger requiredBar open time, unix seconds, trade server clock.
opennumber requiredOpen.
highnumber requiredHigh.
lownumber requiredLow.
closenumber requiredClose.
tick_volumeinteger requiredTick count in the bar.
real_volumeinteger requiredExchange volume. 0 for most CFD symbols.
spreadinteger requiredAlways 0: the web protocol's bars carry no spread (MetaTrader builds bars from the bid).
completeboolean requiredThe bar has closed, by the server's clock (a month bar closes at the next month's start). The newest bar is usually still forming, but at a weekend or a daily break it may be closed too: read this rather than dropping the last bar.
time_utcintegerBar open time in UTC, unix seconds; only with the account's clock rule (0.7.0).
time_utc_ambiguousbooleantrue when the time falls in New York's repeated autumn hour (0.7.0).
{
"symbol": "XAUUSD",
"timeframe": "M5",
"candles": [
{
"time": 1790980500,
"open": 2394.31,
"high": 2395.1,
"low": 2390.58,
"close": 2392.41,
"tick_volume": 2330,
"real_volume": 0,
"spread": 0,
"complete": true
},
{
"time": 1790980800,
"open": 2392.41,
"high": 2394.19,
"low": 2392.29,
"close": 2393.97,
"tick_volume": 834,
"real_volume": 0,
"spread": 0,
"complete": false
}
]
}Candle
timeinteger requiredBar open time, unix seconds, trade server clock.
opennumber requiredOpen.
highnumber requiredHigh.
lownumber requiredLow.
closenumber requiredClose.
tick_volumeinteger requiredTick count in the bar.
real_volumeinteger requiredExchange volume. 0 for most CFD symbols.
spreadinteger requiredAlways 0: the web protocol's bars carry no spread (MetaTrader builds bars from the bid).
completeboolean requiredThe bar has closed, by the server's clock (a month bar closes at the next month's start). The newest bar is usually still forming, but at a weekend or a daily break it may be closed too: read this rather than dropping the last bar.
time_utcintegerBar open time in UTC, unix seconds; only with the account's clock rule (0.7.0).
time_utc_ambiguousbooleantrue when the time falls in New York's repeated autumn hour (0.7.0).
Tick
A price change: the data of event: tick on the SSE stream. With the account's clock rule (0.7.0), UTC fields come beside it (see the account's clock). (time_utc_msc)
symbolstring requiredSymbol name.
bidnumber requiredBid price.
asknumber requiredAsk price.
lastnumber requiredLast deal price. 0 for most forex and CFD symbols.
time_mscinteger requiredUnix milliseconds, trade server clock.
{
"symbol": "XAUUSD",
"bid": 2391.42,
"ask": 2391.6,
"last": 0,
"time_msc": 1790981179473
}StreamStatus
The data of event: status on the SSE stream: sent first, then whenever connected changes, and once more (connected false, with a reason) when the stream ends.
connectedboolean requiredWhether the account is connected to the broker.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds.
idstringOnly on the first status, and only when the stream follows trades or orders: where the stream starts in the account's trade event numbering. The client's own cursor when it resumed (after= or Last-Event-ID), else the newest event id (<epoch>:0 before the first event), so a client holds a cursor before any trade happens. On SSE the same value is the event's id: line.
reasonstringOnly on the last status before the stream ends. account changed: the account was deleted or logs in with new details; server stopping: the server is shutting down; key revoked, key changed, signed out (0.6.0): the key that opened it was deleted or may no longer read this account, or the dashboard session ended. Reconnect to follow the account (EventSource does this by itself).
account changedserver stoppingkey revokedkey changedsigned out
{
"connected": true,
"ping_ms": 14.2,
"id": "1790968290117:40"
}{
"connected": false,
"ping_ms": null,
"reason": "account changed"
}TradeEvent
The data of a trade event (events=trades): one per broker trade push, as it is applied, numbered per account. An order push carries order, state and pending; a deal push carries deal, balance, credit and usually position; a position update carries position only; a deal caught up after a gap carries deal and caught_up: true. For a market order show the deal; for a pending order show its order events (pending: true) and, when it fills, the deal; a position update needs no line of its own.
seqinteger required1, 2, 3, ... per account. The newest 1,024 events are kept in the database, so the numbering carries on across a restart or an upgrade; it starts again only when the account is added again or logs in to another broker account (login or server).
idstring required<epoch>:<seq>, epoch being the unix ms when this numbering began. On SSE also the event's id: line, which EventSource sends back as Last-Event-ID; any client can resume with after=<id>, from before a restart too.
whatstring requiredWhat happened. For a pending order (kind order): placed, modified or removed while it is live; filled, cancelled, expired, rejected (or done) when it moves to history. For a deal (kind deal): opened, partial, closed, reversed, or balance for a balance, credit or commission deal. For kind position: updated.
placedmodifiedremovedfilledcancelledexpiredrejecteddoneopenedpartialclosedreversedbalancedealupdatedkindstring requiredorder for an order push, deal for a deal push, position for a position the broker changed without a deal (its SL or TP moved, or the step just before a close; the broker sends it as a deal record with ticket 0 and balance 0, which before 0.2.2 came out as a phantom deal opened).
orderdealpositionpendingbooleanWith kind order: true for a limit, stop or stop-limit order, false for a market buy or sell (or a close-by). A market order is placed, taken off the book and filed as filled (or cancelled) in the same moment, each step an order event with pending false and, once done, volume 0 (volume_initial is what was asked); a UI shows the deal event for it and skips these.
orderobjectOrder fields
ticketinteger requiredOrder ticket.
symbolstring requiredSymbol name.
typestring requiredOrder type.
GET /ordersandordersevents list pending orders only (limit, stop, stop limit); in atradeevent a market order isbuyorsell(withpending: false).buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_bysidestring requiredDirection.
buysellvolumenumber requiredLots still to fill.
volume_initialnumber requiredLots when placed.
pricenumber requiredTrigger price.
stop_limitnumber requiredLimit price for stop limit orders, 0 otherwise.
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
expirationinteger requiredExpiry, unix seconds, trade server clock. 0 = good till cancelled.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntime_setupinteger requiredWhen the order was placed, unix seconds, trade server clock.
time_setup_mscinteger requiredWhen the order was placed, unix milliseconds, trade server clock.
statestringWith kind order: the order's MetaTrader state.
startedplacedcancelledpartialfilledrejectedexpiredrequestunknowndealobjectDeal fields
ticketinteger requiredDeal ticket.
orderinteger requiredOrder that made the deal.
position_idinteger requiredPosition the deal belongs to (its identifier).
symbolstring requiredSymbol name. Empty for balance operations.
typestring requiredThe MetaTrader deal type, lowercase. unknown only for a value MetaTrader does not define.
buysellbalancecreditchargecorrectionbonuscommissioncommission_dailycommission_monthlycommission_agent_dailycommission_agent_monthlyinterestbuy_canceledsell_canceleddividenddividend_frankedtaxunknownentrystring requiredin opens, out closes, inout reverses, out_by closes by an opposite position. unknown only for a value MetaTrader does not define.
inoutinoutout_byunknownvolumenumber requiredLots.
pricenumber requiredDeal price.
profitnumber requiredRealised profit in the deposit currency.
commissionnumber requiredCommission.
swapnumber requiredSwap.
feenumber requiredFee.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). A closing deal (a close at the stop loss or take profit included) gets the magic of the position it closed.
commentstring requiredComment. The opening deal of an order sent through Termless with a comment past 31 characters gets the full text back; a closing deal keeps its own (IC Markets and Pepperstone write [sl 4129.45] or [tp ...] there on a close by stop, but read reason).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntimeinteger requiredUnix seconds, trade server clock.
time_mscinteger requiredUnix milliseconds, trade server clock.
positionobjectWith kind deal: the position the deal touched; with kind position: the position that changed. With an extra
open. A closed one (open false) carries its last known values (open price, SL, TP, time, comment, magic) with volume 0, where the broker sends zeros. Absent for a balance deal.Fields
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
openboolean requiredFalse once the position is closed.
positionsarray of PositionOther positions the same push updated (a netting account).
Position fields
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
balancenumberWith kind deal: the account's balance after the deal. Never on kind position, nor on a caught_up deal.
creditnumberWith kind deal: the account's credit after the deal. Never on kind position, nor on a caught_up deal.
caught_upbooleanPresent and true on a deal the broker made during a gap (the broker link was down, the server was stopped, or the account's session started again) and that was read back from the account's history after it: kind deal with
whatanddealonly (a close is partial while its position is still open), oldest first, before the gap's resync. A deal already sent is never sent again, and nothing older than the oldest event the server keeps for the account (or the start of its numbering) is sent. Up to 7 days back and 500 deals; more than that sends only the resync.
{
"seq": 42,
"id": "1790968290117:42",
"what": "opened",
"kind": "deal",
"deal": {
"ticket": 81200118,
"order": 51830012,
"position_id": 51830012,
"symbol": "XAUUSD",
"type": "buy",
"entry": "in",
"volume": 0.2,
"price": 2385.0,
"profit": 0.0,
"commission": -0.7,
"swap": 0.0,
"fee": 0.0,
"magic": 0,
"comment": "breakout",
"reason": "web",
"time": 1790975498,
"time_msc": 1790975498123
},
"balance": 10412.58,
"credit": 0.0,
"position": {
"ticket": 51830012,
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.2,
"price_open": 2385.0,
"price_current": 2385.0,
"sl": 2380.0,
"tp": 2420.0,
"profit": 0.0,
"swap": 0.0,
"commission": -0.7,
"comment": "breakout",
"magic": 0,
"reason": "web",
"identifier": 51830012,
"time": 1790975498,
"time_msc": 1790975498123,
"time_update": 1790975498,
"open": true
}
}{
"seq": 41,
"id": "1790968290117:41",
"what": "placed",
"kind": "order",
"pending": true,
"order": {
"ticket": 51830020,
"symbol": "XAUUSD",
"type": "buy_limit",
"side": "buy",
"volume": 0.1,
"volume_initial": 0.1,
"price": 2365.0,
"stop_limit": 0,
"sl": 2350.0,
"tp": 2410.0,
"expiration": 0,
"comment": "dip buy",
"magic": 0,
"reason": "web",
"time_setup": 1790977698,
"time_setup_msc": 1790977698412
},
"state": "placed"
}Resync
The data of a resync event (with events=trades; WebSocket: type resync): trade events were or may have been missed and cannot be replayed. Read positions, orders and deals again, then go on from id. After a gap the deals the broker made meanwhile come first as trade events marked caught_up; pending orders placed or removed and stops moved during the gap have no history, so the resync still follows them.
seqinteger requiredIts place in the account's numbering: its own seq for a resync the server recorded (after a gap: the broker link came back, the server restarted, the account's session started again; or when the server fell behind the broker), else the newest seq when it was sent.
idstring required<epoch>:<seq>. Carry on from this id.
reasonstring requiredWhy. Recorded in the numbering (and replayed like trade events): "the broker link came back; ...", "the server restarted; ...", "the account's session started again; ..." (each after the deals made during the gap, sent first as trade events marked caught_up), "the server fell behind the broker's trade pushes". Sent to one client only: "that id is from another numbering (the account now logs in to another broker account, or its kept events were lost)" (an id from another epoch: the account was added again, or logs in to another broker account), "that id is newer than anything this account has sent", "more happened since that id than the server keeps", "this stream fell behind; read the account again".
{
"seq": 49,
"id": "1790968290117:49",
"reason": "the broker link came back; its trade pushes sent while it was down are not replayed (the deals made meanwhile came first, marked caught_up)"
}{
"seq": 49,
"id": "1790968290117:49",
"reason": "the server restarted; trade pushes sent while it was stopped are not replayed (the deals made meanwhile came first, marked caught_up)"
}TradesSince
The answer of GET /trades: the account's numbered trade events for a client that polls instead of streaming.
idstring requiredThe newest event's id (<epoch>:0 before the first). Ask again with after=<this>.
eventsarray of object requiredThe events after
after, oldest first: each a TradeEvent or a Resync witheventbeside its fields. Without after: every event kept (up to 1,024). Empty when resync is set.Fields
eventstring requiredtrade or resync: which of the two the rest of the object is.
traderesync
resyncstring or null requirednull, or why the events since after cannot be given (another epoch: the account was added again or logs in to another broker account; an id newer than anything sent; more happened than the server keeps). Then read positions, orders and deals again and carry on from id. A restart of the server does not change the epoch: an id from before it still resumes.
{
"id": "1790968290117:43",
"events": [
{
"event": "trade",
"seq": 42,
"id": "1790968290117:42",
"what": "opened",
"kind": "deal",
"deal": {
"ticket": 81200118,
"order": 51830012,
"position_id": 51830012,
"symbol": "XAUUSD",
"type": "buy",
"entry": "in",
"volume": 0.2,
"price": 2385.0,
"profit": 0.0,
"commission": -0.7,
"swap": 0.0,
"fee": 0.0,
"magic": 0,
"comment": "breakout",
"reason": "web",
"time": 1790975498,
"time_msc": 1790975498123
},
"balance": 10412.58,
"credit": 0.0,
"position": {
"ticket": 51830012,
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.2,
"price_open": 2385.0,
"price_current": 2385.0,
"sl": 2380.0,
"tp": 2420.0,
"profit": 0.0,
"swap": 0.0,
"commission": -0.7,
"comment": "breakout",
"magic": 0,
"reason": "web",
"identifier": 51830012,
"time": 1790975498,
"time_msc": 1790975498123,
"time_update": 1790975498,
"open": true
}
},
{
"event": "trade",
"seq": 43,
"id": "1790968290117:43",
"what": "updated",
"kind": "position",
"position": {
"ticket": 51830012,
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.2,
"price_open": 2385.0,
"price_current": 2391.42,
"sl": 2386.0,
"tp": 2420.0,
"profit": 128.4,
"swap": -1.12,
"commission": -1.4,
"comment": "breakout",
"magic": 0,
"reason": "web",
"identifier": 51830012,
"time": 1790975498,
"time_msc": 1790975498123,
"time_update": 1790981102,
"open": true
}
}
],
"resync": null
}{
"id": "1791012001502:3",
"events": [],
"resync": "that id is from another numbering (the account now logs in to another broker account, or its kept events were lost)"
}AccountSnapshot
The data of an account event (events=account): the account summary with live profit, equity and margin, right after the stream opens and then whenever a value changed, checked every 500 ms at most.
logininteger requiredMT5 login number.
namestring requiredAccount holder name at the broker.
serverstring requiredTrade server name.
companystring requiredBroker company name.
currencystring requiredDeposit currency.
leverageinteger requiredLeverage, for example 200 for 1:200.
balancenumber requiredBalance without open positions.
creditnumber requiredCredit from the broker.
profitnumber requiredFloating profit of open positions, live.
equitynumber requiredbalance + credit + profit, live.
marginnumber requiredMargin in use, live.
margin_freenumber requiredequity - margin.
margin_levelnumber requiredequity / margin x 100, in percent. 0 with no margin in use.
margin_so_callnumber requiredMargin call level.
margin_so_sonumber requiredStop out level.
trade_allowedboolean requiredWhether the broker allows trading on this account.
demoboolean requiredTrue for a demo account.
hedgingboolean requiredTrue for a hedging account, false for netting.
server_offsetinteger requiredTrade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.
positionsinteger requiredOpen positions.
ordersinteger requiredPending orders.
time_msinteger requiredWhen it was computed, unix milliseconds (UTC).
{
"login": 12345678,
"name": "Demo Trader",
"server": "Pepperstone-Demo",
"company": "Pepperstone Group Limited",
"currency": "USD",
"leverage": 200,
"balance": 10412.58,
"credit": 0.0,
"profit": 238.11,
"equity": 10650.69,
"margin": 878.93,
"margin_free": 9771.76,
"margin_level": 1211.78,
"margin_so_call": 100.0,
"margin_so_so": 50.0,
"trade_allowed": true,
"demo": true,
"hedging": true,
"server_offset": 10800,
"positions": 3,
"orders": 2,
"time_ms": 1790981179473
}PositionsSnapshot
The data of a positions event (events=positions): every open position with live P/L, on the same 500 ms rhythm as account, only when something changed. A UI never computes P/L itself.
positionsarray of Position requiredEvery open position with live profit and price_current.
Position fields
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
time_msinteger requiredWhen it was computed, unix milliseconds (UTC).
{
"positions": [
{
"ticket": 51830012,
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.2,
"price_open": 2385.0,
"price_current": 2391.42,
"sl": 2380.0,
"tp": 2420.0,
"profit": 128.4,
"swap": -1.12,
"commission": -1.4,
"comment": "breakout",
"magic": 0,
"reason": "web",
"identifier": 51830012,
"time": 1790975498,
"time_msc": 1790975498123,
"time_update": 1790975498
}
],
"time_ms": 1790981179473
}WsMessage
What the server sends on the WebSocket, one JSON object per message, told apart by type. First a status, then subscribed, then any trade events replayed for after= (or a resync), then ticks (and the trade, account, positions and orders events asked for with events=; orders right after subscribed and the replay); status again whenever connected changes.
status
typestring requiredConnection state.
connectedboolean requiredWhether the account is connected to the broker.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds.
idstringOnly on the first status, when the socket follows trades or orders: where it starts in the account's trade event numbering (as on SSE).
reasonstringOnly on the last status before the socket closes: account changed (deleted, or logs in with new details), server stopping, or (0.6.0) key revoked, key changed, signed out.
account changedserver stoppingkey revokedkey changedsigned out
subscribed
typestring requiredThe symbols now streaming, after the open or a subscribe/unsubscribe.
symbolsarray of string requiredEvery symbol on this socket.
tick
typestring requiredA price change.
symbolstring requiredSymbol name.
bidnumber requiredBid price.
asknumber requiredAsk price.
lastnumber requiredLast deal price. 0 for most forex and CFD symbols.
time_mscinteger requiredUnix milliseconds, trade server clock.
gap A Gap with type: "gap" (0.7.0).
typestring requiredTicks this socket missed.
reasonstring requiredbehind: this stream fell behind and kept only the newest tick per symbol; reconnect: the broker link was down; fanout: the account's fan-out fell behind the session.
behindreconnectfanoutsymbolsarray of string requiredbehind: the symbols that lost ticks; otherwise every symbol of the stream.
droppedinteger or null requiredbehind: how many ticks this stream lost; null when nobody can count them.
from_mscinteger requiredbehind: the first dropped tick's time; otherwise the last tick this stream got before. Ticks' own clock.
to_mscinteger requiredbehind: the last dropped tick's time; otherwise the first tick after, which follows this event.
from_utc_mscintegerfrom_msc in UTC; only with the account's clock rule (0.7.1).
to_utc_mscintegerto_msc in UTC; only with the account's clock rule (0.7.1).
from_utc_ambiguousbooleantrue when from_msc falls in New York's repeated autumn hour (0.7.1).
to_utc_ambiguousbooleantrue when to_msc falls in New York's repeated autumn hour (0.7.1).
bar A Bar with type: "bar" (0.7.0).
typestring requiredA bar of a series (with events=bars).
symbolstring requiredSymbol name.
timeframestring requiredTimeframe.
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1timeinteger requiredBar open time, unix seconds, trade server clock.
opennumber requiredOpen.
highnumber requiredHigh.
lownumber requiredLow.
closenumber requiredClose.
tick_volumeinteger requiredTick count in the bar.
real_volumeinteger requiredExchange volume.
statestring requiredforming: built from the bids, at most four a second per series; closed: the broker's bar once its period ended (plus 2 s), sent once per period, or later for a period whose tick came late (0.7.1: bars can arrive out of time order, place each by time); corrected: the broker's bar differs from the one sent (read again a minute later, or after the server clock went back).
formingclosedcorrected
bars_gap A BarsGap with type: "bars_gap" (0.7.0).
typestring requiredBars a series cannot send.
symbolstring requiredSymbol name.
timeframestring requiredTimeframe.
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1frominteger requiredThe first missed bar's open time.
tointeger requiredThe last missed bar's open time.
from_utcintegerfrom in UTC; only with the account's clock rule (0.7.1).
to_utcintegerto in UTC; only with the account's clock rule (0.7.1).
from_utc_ambiguousbooleantrue when from falls in New York's repeated autumn hour (0.7.1).
to_utc_ambiguousbooleantrue when to falls in New York's repeated autumn hour (0.7.1).
bars
typestring requiredThe bar series now on the socket, after a bars or unbars message (0.7.0).
seriesarray of string requiredEvery series, SYMBOL:TF.
trade A TradeEvent with type: "trade".
typestring requiredA broker trade push (with events=trades).
seqinteger required1, 2, 3, ... per account. The newest 1,024 events are kept in the database, so the numbering carries on across a restart or an upgrade; it starts again only when the account is added again or logs in to another broker account (login or server).
idstring required<epoch>:<seq>, epoch being the unix ms when this numbering began. On SSE also the event's id: line, which EventSource sends back as Last-Event-ID; any client can resume with after=<id>, from before a restart too.
whatstring requiredWhat happened. For a pending order (kind order): placed, modified or removed while it is live; filled, cancelled, expired, rejected (or done) when it moves to history. For a deal (kind deal): opened, partial, closed, reversed, or balance for a balance, credit or commission deal. For kind position: updated.
placedmodifiedremovedfilledcancelledexpiredrejecteddoneopenedpartialclosedreversedbalancedealupdatedkindstring requiredorder for an order push, deal for a deal push, position for a position the broker changed without a deal (its SL or TP moved, or the step just before a close; the broker sends it as a deal record with ticket 0 and balance 0, which before 0.2.2 came out as a phantom deal opened).
orderdealpositionpendingbooleanWith kind order: true for a limit, stop or stop-limit order, false for a market buy or sell (or a close-by). A market order is placed, taken off the book and filed as filled (or cancelled) in the same moment, each step an order event with pending false and, once done, volume 0 (volume_initial is what was asked); a UI shows the deal event for it and skips these.
orderobjectOrder fields
ticketinteger requiredOrder ticket.
symbolstring requiredSymbol name.
typestring requiredOrder type.
GET /ordersandordersevents list pending orders only (limit, stop, stop limit); in atradeevent a market order isbuyorsell(withpending: false).buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_bysidestring requiredDirection.
buysellvolumenumber requiredLots still to fill.
volume_initialnumber requiredLots when placed.
pricenumber requiredTrigger price.
stop_limitnumber requiredLimit price for stop limit orders, 0 otherwise.
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
expirationinteger requiredExpiry, unix seconds, trade server clock. 0 = good till cancelled.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntime_setupinteger requiredWhen the order was placed, unix seconds, trade server clock.
time_setup_mscinteger requiredWhen the order was placed, unix milliseconds, trade server clock.
statestringWith kind order: the order's MetaTrader state.
startedplacedcancelledpartialfilledrejectedexpiredrequestunknowndealobjectDeal fields
ticketinteger requiredDeal ticket.
orderinteger requiredOrder that made the deal.
position_idinteger requiredPosition the deal belongs to (its identifier).
symbolstring requiredSymbol name. Empty for balance operations.
typestring requiredThe MetaTrader deal type, lowercase. unknown only for a value MetaTrader does not define.
buysellbalancecreditchargecorrectionbonuscommissioncommission_dailycommission_monthlycommission_agent_dailycommission_agent_monthlyinterestbuy_canceledsell_canceleddividenddividend_frankedtaxunknownentrystring requiredin opens, out closes, inout reverses, out_by closes by an opposite position. unknown only for a value MetaTrader does not define.
inoutinoutout_byunknownvolumenumber requiredLots.
pricenumber requiredDeal price.
profitnumber requiredRealised profit in the deposit currency.
commissionnumber requiredCommission.
swapnumber requiredSwap.
feenumber requiredFee.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). A closing deal (a close at the stop loss or take profit included) gets the magic of the position it closed.
commentstring requiredComment. The opening deal of an order sent through Termless with a comment past 31 characters gets the full text back; a closing deal keeps its own (IC Markets and Pepperstone write [sl 4129.45] or [tp ...] there on a close by stop, but read reason).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntimeinteger requiredUnix seconds, trade server clock.
time_mscinteger requiredUnix milliseconds, trade server clock.
positionobjectWith kind deal: the position the deal touched; with kind position: the position that changed. With an extra
open. A closed one (open false) carries its last known values (open price, SL, TP, time, comment, magic) with volume 0, where the broker sends zeros. Absent for a balance deal.Fields
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
openboolean requiredFalse once the position is closed.
positionsarray of PositionOther positions the same push updated (a netting account).
Position fields
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
balancenumberWith kind deal: the account's balance after the deal. Never on kind position, nor on a caught_up deal.
creditnumberWith kind deal: the account's credit after the deal. Never on kind position, nor on a caught_up deal.
caught_upbooleanPresent and true on a deal the broker made during a gap (the broker link was down, the server was stopped, or the account's session started again) and that was read back from the account's history after it: kind deal with
whatanddealonly (a close is partial while its position is still open), oldest first, before the gap's resync. A deal already sent is never sent again, and nothing older than the oldest event the server keeps for the account (or the start of its numbering) is sent. Up to 7 days back and 500 deals; more than that sends only the resync.
resync A Resync with type: "resync": read positions, orders and deals again.
typestring requiredMissed trade events cannot be replayed (with events=trades).
seqinteger requiredIts place in the account's numbering: its own seq for a resync the server recorded (after a gap: the broker link came back, the server restarted, the account's session started again; or when the server fell behind the broker), else the newest seq when it was sent.
idstring required<epoch>:<seq>. Carry on from this id.
reasonstring requiredWhy. Recorded in the numbering (and replayed like trade events): "the broker link came back; ...", "the server restarted; ...", "the account's session started again; ..." (each after the deals made during the gap, sent first as trade events marked caught_up), "the server fell behind the broker's trade pushes". Sent to one client only: "that id is from another numbering (the account now logs in to another broker account, or its kept events were lost)" (an id from another epoch: the account was added again, or logs in to another broker account), "that id is newer than anything this account has sent", "more happened since that id than the server keeps", "this stream fell behind; read the account again".
account An AccountSnapshot with type: "account".
typestring requiredThe account summary, live (with events=account).
logininteger requiredMT5 login number.
namestring requiredAccount holder name at the broker.
serverstring requiredTrade server name.
companystring requiredBroker company name.
currencystring requiredDeposit currency.
leverageinteger requiredLeverage, for example 200 for 1:200.
balancenumber requiredBalance without open positions.
creditnumber requiredCredit from the broker.
profitnumber requiredFloating profit of open positions, live.
equitynumber requiredbalance + credit + profit, live.
marginnumber requiredMargin in use, live.
margin_freenumber requiredequity - margin.
margin_levelnumber requiredequity / margin x 100, in percent. 0 with no margin in use.
margin_so_callnumber requiredMargin call level.
margin_so_sonumber requiredStop out level.
trade_allowedboolean requiredWhether the broker allows trading on this account.
demoboolean requiredTrue for a demo account.
hedgingboolean requiredTrue for a hedging account, false for netting.
server_offsetinteger requiredTrade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.
positionsinteger requiredOpen positions.
ordersinteger requiredPending orders.
time_msinteger requiredWhen it was computed, unix milliseconds (UTC).
positions A PositionsSnapshot with type: "positions".
typestring requiredEvery open position, live (with events=positions).
positionsarray of Position requiredEvery open position with live profit and price_current.
Position fields
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
time_msinteger requiredWhen it was computed, unix milliseconds (UTC).
orders An OrdersSnapshot with type: "orders".
typestring requiredEvery pending order (with events=orders).
ordersarray of Order requiredEvery pending order (limit, stop, stop limit), as
GET /orderslists them.Order fields
ticketinteger requiredOrder ticket.
symbolstring requiredSymbol name.
typestring requiredOrder type.
GET /ordersandordersevents list pending orders only (limit, stop, stop limit); in atradeevent a market order isbuyorsell(withpending: false).buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_bysidestring requiredDirection.
buysellvolumenumber requiredLots still to fill.
volume_initialnumber requiredLots when placed.
pricenumber requiredTrigger price.
stop_limitnumber requiredLimit price for stop limit orders, 0 otherwise.
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
expirationinteger requiredExpiry, unix seconds, trade server clock. 0 = good till cancelled.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntime_setupinteger requiredWhen the order was placed, unix seconds, trade server clock.
time_setup_mscinteger requiredWhen the order was placed, unix milliseconds, trade server clock.
time_msinteger requiredWhen it was read, unix milliseconds (UTC).
error
typestring requiredA message the server could not act on.
messagestring requiredWhat went wrong.
{
"type": "status",
"connected": true,
"ping_ms": 14.2,
"id": "1790968290117:40"
}{
"type": "subscribed",
"symbols": [
"EURUSD",
"XAUUSD"
]
}WsCommand
What a client may send on the WebSocket. The answer is subscribed with the whole list, or an error.
subscribearray of stringSymbols to add (at most 200 on one socket).
unsubscribearray of stringSymbols to drop. Applied before subscribe when both are sent.
barsarray of stringBar series to add, SYMBOL:TF (0.7.0; the socket must be opened with events=bars). At most 100 a socket.
unbarsarray of stringBar series to drop (0.7.0).
{
"subscribe": [
"GBPUSD"
]
}{
"unsubscribe": [
"EURUSD"
]
}Position
ticketinteger requiredPosition ticket.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
price_opennumber requiredOpen price.
price_currentnumber requiredCurrent close price (bid for a buy, ask for a sell).
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
profitnumber requiredFloating profit in the deposit currency, live.
swapnumber requiredSwap so far.
commissionnumber requiredCommission so far.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknownidentifierinteger requiredPosition id; the deals of this position carry it as position_id.
timeinteger requiredOpen time, unix seconds, trade server clock.
time_mscinteger requiredOpen time, unix milliseconds, trade server clock.
time_updateinteger requiredLast change, unix seconds, trade server clock.
{
"ticket": 51830012,
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.2,
"price_open": 2385.0,
"price_current": 2391.42,
"sl": 2380.0,
"tp": 2420.0,
"profit": 128.4,
"swap": -1.12,
"commission": -1.4,
"comment": "breakout",
"magic": 0,
"reason": "web",
"identifier": 51830012,
"time": 1790975498,
"time_msc": 1790975498123,
"time_update": 1790975498
}Order
ticketinteger requiredOrder ticket.
symbolstring requiredSymbol name.
typestring requiredOrder type.
GET /ordersandordersevents list pending orders only (limit, stop, stop limit); in atradeevent a market order isbuyorsell(withpending: false).buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_bysidestring requiredDirection.
buysellvolumenumber requiredLots still to fill.
volume_initialnumber requiredLots when placed.
pricenumber requiredTrigger price.
stop_limitnumber requiredLimit price for stop limit orders, 0 otherwise.
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
expirationinteger requiredExpiry, unix seconds, trade server clock. 0 = good till cancelled.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntime_setupinteger requiredWhen the order was placed, unix seconds, trade server clock.
time_setup_mscinteger requiredWhen the order was placed, unix milliseconds, trade server clock.
{
"ticket": 51830020,
"symbol": "XAUUSD",
"type": "buy_limit",
"side": "buy",
"volume": 0.1,
"volume_initial": 0.1,
"price": 2365.0,
"stop_limit": 0,
"sl": 2350.0,
"tp": 2410.0,
"expiration": 0,
"comment": "dip buy",
"magic": 0,
"reason": "web",
"time_setup": 1790977698,
"time_setup_msc": 1790977698412
}HistoryOrder
An order that left the book (GET /orders/history): the order shape plus how and when it ended and its position.
ticketinteger requiredOrder ticket.
symbolstring requiredSymbol name.
typestring requiredOrder type. Market orders are filed here too: buy, sell or close_by.
buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_bysidestring requiredDirection.
buysellvolumenumber requiredLots left unfilled when it left the book (0 for a filled order).
volume_initialnumber requiredLots when placed.
pricenumber requiredTrigger price.
stop_limitnumber requiredLimit price for stop limit orders, 0 otherwise.
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
expirationinteger requiredExpiry, unix seconds, trade server clock. 0 = good till cancelled.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntime_setupinteger requiredWhen the order was placed, unix seconds, trade server clock.
time_setup_mscinteger requiredWhen the order was placed, unix milliseconds, trade server clock.
statestring requiredThe order's MetaTrader state when it left the book: filled, cancelled, expired, rejected or partial (partly filled); started, placed and request are states an order passes through on its way; unknown only for a value MetaTrader does not define.
startedplacedcancelledpartialfilledrejectedexpiredrequestunknowntime_doneinteger requiredWhen it left the book, unix seconds, trade server clock.
time_done_mscinteger requiredWhen it left the book, unix milliseconds, trade server clock.
position_idinteger requiredThe position it opened or closed; 0 for an order that never filled.
{
"ticket": 51830012,
"symbol": "XAUUSD",
"type": "buy",
"side": "buy",
"volume": 0.0,
"volume_initial": 0.2,
"price": 2385.0,
"stop_limit": 0,
"sl": 2380.0,
"tp": 2420.0,
"expiration": 0,
"comment": "breakout",
"magic": 0,
"reason": "web",
"time_setup": 1790975498,
"time_setup_msc": 1790975497981,
"state": "filled",
"time_done": 1790975498,
"time_done_msc": 1790975498123,
"position_id": 51830012
}{
"ticket": 51830007,
"symbol": "XAUUSD",
"type": "sell_stop",
"side": "sell",
"volume": 0.1,
"volume_initial": 0.1,
"price": 2371.5,
"stop_limit": 0,
"sl": 2380.0,
"tp": 2350.0,
"expiration": 0,
"comment": "breakdown",
"magic": 0,
"reason": "web",
"time_setup": 1790962100,
"time_setup_msc": 1790962100544,
"state": "cancelled",
"time_done": 1790970120,
"time_done_msc": 1790970120310,
"position_id": 0
}Deal
ticketinteger requiredDeal ticket.
orderinteger requiredOrder that made the deal.
position_idinteger requiredPosition the deal belongs to (its identifier).
symbolstring requiredSymbol name. Empty for balance operations.
typestring requiredThe MetaTrader deal type, lowercase. unknown only for a value MetaTrader does not define.
buysellbalancecreditchargecorrectionbonuscommissioncommission_dailycommission_monthlycommission_agent_dailycommission_agent_monthlyinterestbuy_canceledsell_canceleddividenddividend_frankedtaxunknownentrystring requiredin opens, out closes, inout reverses, out_by closes by an opposite position. unknown only for a value MetaTrader does not define.
inoutinoutout_byunknownvolumenumber requiredLots.
pricenumber requiredDeal price.
profitnumber requiredRealised profit in the deposit currency.
commissionnumber requiredCommission.
swapnumber requiredSwap.
feenumber requiredFee.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). A closing deal (a close at the stop loss or take profit included) gets the magic of the position it closed.
commentstring requiredComment. The opening deal of an order sent through Termless with a comment past 31 characters gets the full text back; a closing deal keeps its own (IC Markets and Pepperstone write [sl 4129.45] or [tp ...] there on a close by stop, but read reason).
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntimeinteger requiredUnix seconds, trade server clock.
time_mscinteger requiredUnix milliseconds, trade server clock.
{
"ticket": 81200118,
"order": 51830012,
"position_id": 51830012,
"symbol": "XAUUSD",
"type": "buy",
"entry": "in",
"volume": 0.2,
"price": 2385.0,
"profit": 0.0,
"commission": -0.7,
"swap": 0.0,
"fee": 0.0,
"magic": 0,
"comment": "breakout",
"reason": "web",
"time": 1790975498,
"time_msc": 1790975498123
}{
"ticket": 81200152,
"order": 51830050,
"position_id": 51830012,
"symbol": "XAUUSD",
"type": "sell",
"entry": "out",
"volume": 0.2,
"price": 2380.0,
"profit": -100.0,
"commission": -0.7,
"swap": -1.12,
"fee": 0.0,
"magic": 0,
"comment": "[sl 2380.00]",
"reason": "sl",
"time": 1790990841,
"time_msc": 1790990841207
}TradeResult
okboolean requiredTrue when the broker placed (10008), did (10009) or partly did (10010) the request. Test this, not one code: brokers answer a placed pending order with 10008 or 10009.
retcodeinteger requiredMetaTrader return code. 10009 = done, 10008 = placed. See x-retcodes for the rest.
retcode_textstring requiredThe return code in words.
dealinteger requiredDeal ticket, 0 when no deal was made.
orderinteger requiredOrder ticket.
volumenumber requiredLots done.
pricenumber requiredPrice done.
bidnumber requiredBid when the broker handled the request.
asknumber requiredAsk when the broker handled the request.
commentstring requiredBroker's comment.
request_idinteger requiredThe broker's id for the request.
warningsarray of stringPresent only when something in the request was changed or cannot be kept, on a 200 and a 422 alike: a comment over 31 characters ("comment is N characters; the broker keeps the first 31, termlessd keeps the full text for this order", without the second half for an order that neither opens nor closes anything); a magic number on a market or pending order ("magic is not sent to the broker (MetaTrader's web protocol has no field for it); termlessd keeps it for this order"); a type_filling the symbol does not allow, when order_send named one ("ORDER_FILLING_FOK is not allowed for EURUSD; sent ORDER_FILLING_IOC"); an expiry with seconds ("the broker keeps expiry times to the whole minute: <unix s>").
{
"ok": true,
"retcode": 10009,
"retcode_text": "Request completed",
"deal": 81200131,
"order": 51830031,
"volume": 0.1,
"price": 2391.6,
"bid": 2391.42,
"ask": 2391.6,
"comment": "Request completed",
"request_id": 31
}{
"ok": true,
"retcode": 10009,
"retcode_text": "Request completed",
"deal": 81200131,
"order": 51830031,
"volume": 0.1,
"price": 2391.6,
"bid": 2391.42,
"ask": 2391.6,
"comment": "Request completed",
"request_id": 31,
"warnings": [
"comment is 40 characters; the broker keeps the first 31, termlessd keeps the full text for this order",
"magic is not sent to the broker (MetaTrader's web protocol has no field for it); termlessd keeps it for this order"
]
}TradeRejected
The answer to a trade the broker refused (422): the trade result, with ok false, plus an error whose code is rejected.
okboolean requiredTrue when the broker placed (10008), did (10009) or partly did (10010) the request. Test this, not one code: brokers answer a placed pending order with 10008 or 10009.
retcodeinteger requiredMetaTrader return code. 10009 = done, 10008 = placed. See x-retcodes for the rest.
retcode_textstring requiredThe return code in words.
dealinteger requiredDeal ticket, 0 when no deal was made.
orderinteger requiredOrder ticket.
volumenumber requiredLots done.
pricenumber requiredPrice done.
bidnumber requiredBid when the broker handled the request.
asknumber requiredAsk when the broker handled the request.
commentstring requiredBroker's comment.
request_idinteger requiredThe broker's id for the request.
warningsarray of stringPresent only when something in the request was changed or cannot be kept, on a 200 and a 422 alike: a comment over 31 characters ("comment is N characters; the broker keeps the first 31, termlessd keeps the full text for this order", without the second half for an order that neither opens nor closes anything); a magic number on a market or pending order ("magic is not sent to the broker (MetaTrader's web protocol has no field for it); termlessd keeps it for this order"); a type_filling the symbol does not allow, when order_send named one ("ORDER_FILLING_FOK is not allowed for EURUSD; sent ORDER_FILLING_IOC"); an expiry with seconds ("the broker keeps expiry times to the whole minute: <unix s>").
errorobject requiredFields
codestring requiredMachine-readable error code. Matches the HTTP status.
bad_requestunauthorizedforbiddenreal_accountnot_foundmethod_not_allowedconflictrejectedtoo_many_requestsinternalbroker_errordisconnectedbusystoppingtimeoutunconfirmedtrading_pausedkey_limituntrusted_certificatecertificate_changedbrowser_onlymessagestring requiredWhat went wrong, in a sentence a person can read.
{
"ok": false,
"retcode": 10014,
"retcode_text": "Invalid volume",
"deal": 0,
"order": 0,
"volume": 0,
"price": 0,
"bid": 2391.42,
"ask": 2391.6,
"comment": "Invalid volume",
"request_id": 32,
"error": {
"code": "rejected",
"message": "the broker refused the request: Invalid volume (10014)"
}
}MarketOrder
Opens a position at market.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots, for example 0.10.
pricenumberPrice sent with the request. Leave it out to fill at market.
slnumberStop loss price.
tpnumberTake profit price.
deviationinteger default20Largest slippage you accept, in points.
commentstringComment, up to 255 characters (more is 400). The broker keeps the first 31; for a market or pending order Termless keeps the full text and puts it back on the order, its position, its opening deal and the stream events. Longer than 31 adds a warning to the answer.
magicintegerMagic number. The web protocol's trade request has no field for it, so the broker stores 0; for a market or pending order Termless keeps it and puts it back on the order, its position, its deals and the stream events (MetaTrader's own apps still show 0). Sending one adds a warning to the answer.
{
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.1,
"sl": 2380.0,
"tp": 2420.0,
"comment": "breakout"
}PendingOrder
Places a pending order.
symbolstring requiredSymbol name.
sidestring requiredDirection.
buysellvolumenumber requiredLots.
typestring requiredlimit, stop or stop_limit. Its presence makes the order pending.
limitstopstop_limitpricenumber requiredTrigger price.
stop_limitnumberLimit price, required for stop_limit only.
slnumberStop loss price.
tpnumberTake profit price.
expirationintegerExpiry, unix seconds, trade server clock. Omit (or 0) for good till cancelled. The broker keeps whole minutes; one with seconds gets a warning naming the minute.
commentstringComment, up to 255 characters (more is 400). The broker keeps the first 31; for a market or pending order Termless keeps the full text and puts it back on the order, its position, its opening deal and the stream events. Longer than 31 adds a warning to the answer.
magicintegerMagic number. The web protocol's trade request has no field for it, so the broker stores 0; for a market or pending order Termless keeps it and puts it back on the order, its position, its deals and the stream events (MetaTrader's own apps still show 0). Sending one adds a warning to the answer.
{
"symbol": "XAUUSD",
"side": "buy",
"volume": 0.1,
"type": "limit",
"price": 2365.0,
"sl": 2350.0,
"tp": 2410.0
}OrderModify
Send only what changes; omitted fields keep their value.
pricenumberNew trigger price.
stop_limitnumberNew limit price (stop limit orders).
slnumberNew stop loss, 0 removes it.
tpnumberNew take profit, 0 removes it.
expirationintegerNew expiry, unix seconds, trade server clock. 0 = good till cancelled.
{
"price": 2360.0,
"sl": 2345.0
}PositionModify
Send sl, tp or both; an omitted one keeps its value, 0 removes it.
slnumberNew stop loss, 0 removes it.
tpnumberNew take profit, 0 removes it.
{
"sl": 2386.0,
"tp": 2425.0
}OrderSendRequest
The request dict of the official MetaTrader5 Python package's order_send(), with the same field names. Enum fields take the integer constants or their names; numbers may also be sent as strings.
actioninteger or string requiredTRADE_ACTION_*: 1 deal (market), 5 pending, 6 sltp, 7 modify, 8 remove, 10 close_by. A number or the official name, for example TRADE_ACTION_DEAL.
symbolstringSymbol name.
volumenumberLots.
typeinteger or stringORDER_TYPE_*: 0 buy, 1 sell, 2 buy_limit, 3 sell_limit, 4 buy_stop, 5 sell_stop, 6 buy_stop_limit, 7 sell_stop_limit, 8 close_by. A number or the official name, for example ORDER_TYPE_SELL.
pricenumberPrice.
stoplimitnumberLimit price of a stop limit order. stop_limit also works.
slnumberStop loss.
tpnumberTake profit.
deviationintegerLargest slippage, in points.
type_fillinginteger or stringORDER_FILLING_*: 0 FOK, 1 IOC, 2 return, 3 BOC. A number or the official name, for example ORDER_FILLING_IOC. A mode the symbol does not allow is replaced by one it does (IOC, then FOK, then return), as the web terminal does, and the answer's warnings name the mode sent. A pending order goes out as return unless the symbol is exchange-executed.
type_timeinteger or stringORDER_TIME_*: 0 GTC, 1 day, 2 specified, 3 specified day. A number or the official name, for example ORDER_TIME_GTC.
expirationintegerExpiry, unix seconds, trade server clock. The broker keeps whole minutes; one with seconds gets a warning.
commentstringComment, up to 255 characters (more is 400). The broker keeps the first 31; for a market or pending order Termless keeps the full text and puts it back on the order, its position, its opening deal and the stream events. Longer than 31 adds a warning to the answer.
magicintegerMagic number. The web protocol's trade request has no field for it, so the broker stores 0; for a market or pending order Termless keeps it and puts it back on the order, its position, its deals and the stream events (MetaTrader's own apps still show 0). Sending one adds a warning to the answer.
positionintegerPosition ticket, to close or modify a position.
position_byintegerOpposite position ticket, for close_by.
orderintegerOrder ticket, to modify or remove a pending order.
{
"action": "TRADE_ACTION_DEAL",
"symbol": "XAUUSD",
"volume": 0.1,
"type": "ORDER_TYPE_BUY",
"price": 2391.6,
"sl": 2380.0,
"tp": 2420.0,
"deviation": 20,
"type_filling": "ORDER_FILLING_IOC",
"type_time": 0,
"comment": "from mt5 script",
"magic": 7
}AuditRow
One row of the audit trail: every write and every security event, with the request id that caused it. Trades get one row per broker call and none for an idempotent replay.
idinteger requiredRow id, increasing. Page with
before.atinteger requiredWhen it happened, unix milliseconds (UTC).
kindstring requiredWhat kind of thing happened.
tradeaccountkeysigninauth_failedlockoutpasswordsetupserver_checkserver_truststartactorstring requiredWho did it: the key id for a key, admin for the dashboard, the client IP before sign-in, termlessd for the server itself.
actor_kindstring requiredadmin for the dashboard session, key for an API key, anonymous before sign-in, system for the server.
adminkeyanonymoussystemaccountstring or null requiredThe account it concerned, when one did.
routestring requiredWhat was done. For a trade: market order, pending order, order change, order cancel, SL/TP change, close, partial close or order_send. For an account: add, update or delete. For a key: create or delete.
summarystring requiredOne line a person can read.
requeststring or null requiredFor a trade: the request sent to the broker, in short JSON (cut to 400 characters).
statusinteger or null requiredThe HTTP status the caller got.
retcodeinteger or null requiredFor a trade the broker answered: its return code.
resultstring or null requiredFor a trade: the broker's answer in words with the order and deal tickets, or the error when it did not answer.
latency_msinteger or null requiredFor a trade: the broker round trip in milliseconds.
request_idstring or null requiredThe X-Request-Id of the request that caused the row; the same id is on its log lines.
ipstring or null requiredThe client IP, recorded for sign-ins, wrong passwords and lockouts.
{
"id": 4821,
"at": 1790981179473,
"kind": "trade",
"actor": "key_3f9a1c07",
"actor_kind": "key",
"account": "pepperstone-12345678",
"route": "market order",
"summary": "market buy 0.10 XAUUSD",
"request": "{\"symbol\":\"XAUUSD\",\"volume\":0.1,\"type\":0,\"price\":0.0,\"sl\":2380.0,\"tp\":2420.0,\"order\":0,\"position\":0,\"comment\":\"breakout\"}",
"status": 200,
"retcode": 10009,
"result": "Request completed order 51830031 deal 81200131",
"latency_ms": 212,
"request_id": "bot-20261003-0042",
"ip": null
}{
"id": 4790,
"at": 1790968301004,
"kind": "signin",
"actor": "203.0.113.7",
"actor_kind": "anonymous",
"account": null,
"route": "signin",
"summary": "dashboard sign-in from 203.0.113.7 (Mozilla/5.0 ...)",
"request": null,
"status": 200,
"retcode": null,
"result": null,
"latency_ms": null,
"request_id": "7c1e2a9f4b3d8e60",
"ip": "203.0.113.7"
}ConnectionEvent
One entry of an account's connection history.
idinteger requiredRow id, increasing. Page with
before.atinteger requiredWhen it happened, unix milliseconds (UTC).
accountstring requiredAccount id.
kindstring requiredstarted when the session began; connected (reason: the broker's build) the first time it logged in and reconnected after that; lost (reason: the session's last error) when the link dropped; connect_failed or login_rejected when an attempt failed; stopped when the account was turned off or removed.
startedconnectedreconnectedlostconnect_failedlogin_rejectedstoppedreasonstring or null requiredThe build for connected and reconnected, the error for lost, connect_failed and login_rejected.
duration_msinteger or null requiredFor connected and reconnected: how long the account had been disconnected. For lost and stopped: how long it had been connected.
quiet_sinceinteger or null requiredOn a lost event cut for missed pings (0.6.0): when the first unanswered ping was sent, unix milliseconds (UTC), so when the broker went quiet; null otherwise.
{
"id": 310,
"at": 1790968298412,
"account": "pepperstone-12345678",
"kind": "connected",
"reason": "build 6090",
"duration_ms": 1840,
"quiet_since": null
}{
"id": 309,
"at": 1790968296572,
"account": "pepperstone-12345678",
"kind": "lost",
"reason": "connection lost",
"duration_ms": 73284110,
"quiet_since": null
}EquityCurve
Balance, equity, margin and profit sampled about once a minute, kept 7 days, and the gaps when the account was not connected. Served from the database, so it works while the account is disconnected or turned off.
accountstring requiredAccount id.
hoursinteger requiredThe window asked for, ending now.
every_sinteger requiredSeconds between samples while connected (60).
samplesarray of EquitySample requiredOldest first. About one a minute while the account is connected, the first right after it connects; none while it is not (see gaps).
EquitySample fields
atinteger requiredUnix milliseconds (UTC).
balancenumber requiredBalance.
equitynumber requiredEquity, with live profit.
marginnumber requiredMargin in use.
profitnumber requiredFloating profit of open positions.
gapsarray of EquityGap requiredOldest first: the periods inside the window when the account was not connected, read from its connection events. Draw a break there instead of a line across the outage.
EquityGap fields
frominteger requiredWhen the account stopped being connected (a lost or stopped event, the window's start if it was already down, or for a run that ended without a stop the last sample before the restart), unix milliseconds (UTC).
tointeger or null requiredWhen it connected again, unix milliseconds (UTC). null while it still is not.
{
"account": "pepperstone-12345678",
"hours": 24,
"every_s": 60,
"samples": [
{
"at": 1790977560000,
"balance": 10412.58,
"equity": 10641.2,
"margin": 878.93,
"profit": 228.62
},
{
"at": 1790977620000,
"balance": 10412.58,
"equity": 10650.69,
"margin": 878.93,
"profit": 238.11
}
],
"gaps": [
{
"from": 1790968296572,
"to": 1790968298412
}
]
}EquitySample
atinteger requiredUnix milliseconds (UTC).
balancenumber requiredBalance.
equitynumber requiredEquity, with live profit.
marginnumber requiredMargin in use.
profitnumber requiredFloating profit of open positions.
{
"at": 1790977560000,
"balance": 10412.58,
"equity": 10641.2,
"margin": 878.93,
"profit": 228.62
}ApiKey
idstring requiredKey id, used to revoke it.
namestring requiredWhat the key is for.
prefixstring requiredThe key's first 12 characters (tl_ and 9 more), to recognise it.
scopesarray of string requiredOne scope.
readtradeadminaccountsarray or null requiredAccount ids the key may use. null = every account.
created_atinteger requiredUnix seconds (UTC).
last_used_atinteger or null requiredUnix seconds (UTC) of the last request, null if never used.
max_volumenumber or null requiredThe most lots one order that opens something may have (0.6.0); null: no limit.
max_open_per_mininteger or null requiredThe most orders that open something this key may send in 60 s (0.6.0); null: no limit.
max_daily_lossnumber or null requiredThe most the account may lose in a forex day (from 17:00 New York, account currency) before this key opens nothing (0.7.0); null: no limit.
max_drawdown_pctnumber or null requiredThe most percent the account's equity may fall below its high since the limit was set before this key opens nothing (0.7.0); null: no limit.
limits_sinceinteger or null requiredWhen the drawdown limit was set, unix milliseconds; its high counts from then (0.7.0).
{
"id": "key_3f9a1c07",
"name": "EA bridge (gold)",
"prefix": "tl_4be1a09c7",
"scopes": [
"trade"
],
"accounts": [
"pepperstone-12345678"
],
"created_at": 1790709498,
"last_used_at": 1790974298,
"max_volume": 0.5,
"max_open_per_min": 10,
"max_daily_loss": 500.0,
"max_drawdown_pct": null,
"limits_since": null
}ApiKeyCreate
namestring requiredWhat the key is for, for example "EA bridge (gold)". Up to 80 characters.
scopesone ofExactly one scope. trade includes read; admin includes everything. Defaults to ["read"].
["read"]["trade"]["admin"]accountsarray of stringLimit the key to these account ids. Omit for every account. Not allowed with admin (400); an unknown id is 400 too.
max_volumenumberThe most lots one order that opens something may have; above it the order answers 403 key_limit and is not sent. Closing is never limited. Omit for no limit (0.6.0).
max_open_per_minintegerThe most orders that open something this key may send in 60 s, 1 to 600; past it 429 key_limit with Retry-After, not sent. Omit for no limit (0.6.0).
max_daily_lossone ofA positive amount in the account's currency; past it (from the forex day's start) orders that open something answer 403 key_limit, not sent (0.7.0). null or left out: no limit.
max_drawdown_pctone ofMore than 0, at most 100: past that many percent below the equity's high since it was set, orders that open something answer 403 key_limit, not sent (0.7.0). Setting or changing it starts its high afresh.
{
"name": "EA bridge (gold)",
"scopes": [
"trade"
],
"accounts": [
"pepperstone-12345678"
],
"max_volume": 0.5,
"max_open_per_min": 10
}ApiKeyCreated
idstring requiredKey id, used to revoke it.
namestring requiredWhat the key is for.
prefixstring requiredThe key's first 12 characters (tl_ and 9 more), to recognise it.
scopesarray of string requiredOne scope.
readtradeadminaccountsarray or null requiredAccount ids the key may use. null = every account.
created_atinteger requiredUnix seconds (UTC).
last_used_atinteger or null requiredUnix seconds (UTC) of the last request, null if never used.
max_volumenumber or null requiredThe most lots one order that opens something may have (0.6.0); null: no limit.
max_open_per_mininteger or null requiredThe most orders that open something this key may send in 60 s (0.6.0); null: no limit.
max_daily_lossnumber or null requiredThe most the account may lose in a forex day (from 17:00 New York, account currency) before this key opens nothing (0.7.0); null: no limit.
max_drawdown_pctnumber or null requiredThe most percent the account's equity may fall below its high since the limit was set before this key opens nothing (0.7.0); null: no limit.
limits_sinceinteger or null requiredWhen the drawdown limit was set, unix milliseconds; its high counts from then (0.7.0).
keystring requiredThe full key, tl_ and 48 hex characters. It is shown only in this response, so store it now.
{
"id": "key_3f9a1c07",
"name": "EA bridge (gold)",
"prefix": "tl_4be1a09c7",
"scopes": [
"trade"
],
"accounts": [
"pepperstone-12345678"
],
"created_at": 1790981179,
"last_used_at": null,
"max_volume": 0.5,
"max_open_per_min": 10,
"max_daily_loss": 500.0,
"max_drawdown_pct": null,
"limits_since": null,
"key": "tl_4be1a09c7d2e5f8b1a3c6e9d0f2b4a7c8e1d3f5a7b9c0e2d"
}Me
kindstring requiredadmin for the dashboard session, key for an API key.
adminkeynamestring requiredadmin, or the key's name.
scopesarray of string requiredWhat this caller may do.
readtradeadminaccountsarray or null requiredAccount ids this caller may use. null means every account.
{
"kind": "key",
"name": "EA bridge (gold)",
"scopes": [
"trade"
],
"accounts": [
"pepperstone-12345678"
]
}Health
statusstring requiredok when every enabled account is connected, degraded when an enabled account is not, setup before the admin password exists.
okdegradedsetupversionstring or null requiredServer version, for a signed-in caller or a valid key; null for anyone else (the exact version tells an attacker which fixes are missing).
uptime_sinteger requiredSeconds since the server started.
accountsarray of object requiredEmpty unless the caller is signed in or sends a valid key; then the accounts it may see.
Fields
idstring requiredAccount id.
labelstring requiredDisplay name.
enabledboolean requiredFalse for an account that is turned off.
connectedboolean requiredWhether the session to the broker is up.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds.
reconnectsinteger requiredReconnects since the server started.
{
"status": "ok",
"version": "0.6.2",
"uptime_s": 86412,
"accounts": [
{
"id": "pepperstone-12345678",
"label": "Pepperstone demo",
"enabled": true,
"connected": true,
"ping_ms": 14.2,
"reconnects": 0
}
]
}{
"status": "ok",
"version": null,
"uptime_s": 86412,
"accounts": []
}Error
Every error response has this shape.
errorobject requiredFields
codestring requiredMachine-readable error code. Matches the HTTP status.
bad_requestunauthorizedforbiddenreal_accountnot_foundmethod_not_allowedconflictrejectedtoo_many_requestsinternalbroker_errordisconnectedbusystoppingtimeoutunconfirmedtrading_pausedkey_limituntrusted_certificatecertificate_changedbrowser_onlymessagestring requiredWhat went wrong, in a sentence a person can read.
{
"error": {
"code": "not_found",
"message": "no account with id pepperstone-live"
}
}Ok
okboolean requiredAlways true.
{
"ok": true
}SetupState
needs_setupboolean requiredTrue until the admin password has been set.
{
"needs_setup": true
}SetupRequest
tokenstring requiredThe one-time setup token from the server log or <data>/setup-token.
passwordstring requiredThe new admin password: 15 to 200 characters with a lowercase letter, a capital, a digit and a symbol (anything but a letter or a digit counts as a symbol).
{
"token": "4f1c9e0b7a2d5e8c3b6a9d0e",
"password": "A long passphrase, 2 commas"
}SessionRequest
passwordstring requiredThe admin password.
{
"password": "a long passphrase"
}PasswordChange
currentstring requiredThe admin password in use now. A wrong one is 400, not 401, so the dashboard stays signed in.
newstring requiredThe new admin password: 15 to 200 characters with a lowercase letter, a capital, a digit and a symbol (anything but a letter or a digit counts as a symbol).
{
"current": "A long passphrase, 2 commas",
"new": "An even longer passphrase, 3 commas"
}Server
serverstring requiredTrade server name exactly as the broker spells it, for example Pepperstone-Demo.
companystring requiredBroker company name.
hoststring requiredHost that serves the broker's MT5 web terminal.
portinteger requiredPort, usually 443.
typestring requiredDemo or real money server.
demorealbuildinteger or null requiredMT5 web terminal build seen on the host. null until this install has checked it.
verified_atinteger or null requiredUnix seconds (UTC) when this install last checked the host. null for a built-in entry it has not checked.
tls_namestring or null requiredFor an IP access point: the name sent (SNI) and checked against the certificate while TCP goes to the IP. null for a named host.
pin_sha256string or null requiredSHA-256 of the certificate key an admin pinned for this host (64 hex), or null.
prop_firmboolean requiredA prop firm's server (from the built-in directory).
{
"server": "Pepperstone-Demo",
"company": "Pepperstone Group Limited",
"host": "mt5-demo01.pepperstone.com",
"port": 443,
"type": "demo",
"build": 6090,
"verified_at": 1790966779,
"tls_name": null,
"pin_sha256": null,
"prop_firm": false
}{
"server": "Pepperstone-MT5-Live01",
"company": "Pepperstone Group Limited",
"host": "mt5-1.pepperstone.com",
"port": 443,
"type": "real",
"build": null,
"verified_at": null,
"tls_name": null,
"pin_sha256": null,
"prop_firm": false
}ServerCheckRequest
hoststring requiredHost name to check. A pasted link works: the scheme, path, query, fragment and any user@ are dropped, and host:port works when port is left out.
portinteger default443Port. Defaults to 443.
tls_namestringFor an IP access point: the name on its certificate (sent as SNI and checked). Defaults to the directory's for that host.
fingerprintstringPin this certificate key for the host: the spki_sha256 a refused check reported (64 hex; sha256: and colons allowed). Only for a host you know is the broker's; audited as server_trust.
{
"host": "mt5-demo01.pepperstone.com"
}{
"host": "52.221.81.217",
"tls_name": "exwebterm.com"
}ServerCheck
okboolean requiredTrue when the host serves an MT5 web terminal.
hoststring requiredThe host that was checked.
portinteger requiredThe port that was checked.
companystring requiredBroker company name from the terminal page.
buildinteger requiredWeb terminal build.
serversarray of object requiredTrade servers this host answers for. They are saved to the directory.
Fields
serverstring requiredTrade server name.
typestring requireddemo or real, from the server's name (Demo, Trial or Contest in it means demo), not from the page.
demoreal
tls_namestring or null requiredThe TLS name used, for an IP access point.
pin_sha256string or null requiredThe pinned key the host was checked with, if any.
{
"ok": true,
"host": "mt5-demo01.pepperstone.com",
"port": 443,
"company": "Pepperstone Group Limited",
"build": 6090,
"servers": [
{
"server": "Pepperstone-Demo",
"type": "demo"
}
],
"tls_name": null,
"pin_sha256": null
}Diagnostics
What the server itself is doing.
versionstring requiredServer version.
targetstring requiredThe platform the binary was built for, for example x86_64-unknown-linux-gnu.
pidinteger requiredProcess id.
started_atinteger requiredWhen the server started, unix seconds (UTC).
uptime_sinteger requiredSeconds since the server started.
processobject requiredRead from /proc; every field is null off Linux.
Fields
rss_kbinteger or null requiredResident memory in KB.
rss_peak_kbinteger or null requiredThe most resident memory since the start, in KB (VmHWM).
threadsinteger or null requiredThreads.
open_filesinteger or null requiredOpen file descriptors.
data_dirstring requiredThe data folder.
log_filestring or null requiredThe current log file, null before the first one is written.
db_bytesinteger requiredSize of the database (with its write-ahead log) in bytes.
dashboard_sessionsinteger requiredDashboard sign-ins that have not expired.
streamsobject requiredOpen price streams and their caps.
Fields
sseinteger requiredOpen SSE streams.
wsinteger requiredOpen WebSockets.
maxintegerCap on open streams in total.
max_per_keyintegerCap on open streams per key or dashboard session.
accountsarray of DiagnosticsAccount requiredEvery account, with its connection status.
DiagnosticsAccount fields
idstring requiredAccount id.
enabledboolean requiredFalse for an account that is turned off.
connectedboolean requiredWhether the session to the broker is up right now.
sinceinteger or null requiredUnix seconds (UTC) when the current connection came up. null while disconnected.
reconnectsinteger requiredAutomatic reconnects since the server started.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds. null before the first one.
server_buildinteger or null requiredMT5 build the broker's server reported. null before the first login.
last_errorstring or null requiredWhy the last connection attempt failed or the connection dropped. null while connected.
subscribedinteger requiredNumber of symbols with a live price subscription.
login_rejectedboolean requiredTrue after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.
retry_atinteger or null requiredUnix seconds (UTC) of the next connection attempt while disconnected, else null.
session_runningboolean requiredWhether the account's connection loop is running.
ticks_seeninteger requiredPrice ticks received since the session started.
last_tick_at_msinteger or null requiredWhen the last tick arrived, unix milliseconds (UTC). null before the first.
last_frame_at_msinteger or null requiredWhen the last frame of any kind (pings included) arrived from the broker, unix milliseconds (UTC). A connected account with an old value is about to be declared dead.
streamsinteger requiredOpen streams (SSE and WebSocket) on this account.
ticks_coalescedinteger requiredTicks dropped for slow stream readers (they got the latest tick per symbol instead).
undecodedinteger requiredFrames from this account the client could not decode.
undecodedobject requiredFrames the client could not decode.
Fields
totalinteger requiredFrames the client could not decode since the server started.
filestring requiredWhere kept frames are appended: <data>/captures/undecoded.jsonl.
by_commandarray of UndecodedCount requiredOne counter per (account, command, kind), most recent first.
UndecodedCount fields
accountstring requiredAccount id.
commandinteger requiredProtocol command id.
kindstring requiredframe: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.
framebodyunknown_pushextracontextstring requiredWhere it happened.
countinteger requiredHow many such frames arrived (kept or only counted).
first_atinteger requiredFirst one, unix seconds (UTC).
last_atinteger requiredLatest one, unix seconds (UTC).
last_errorstring requiredWhat the decoder said about the latest one.
recentarray of object requiredThe last 20 kept frames, newest first, without their bytes (GET /api/v1/diagnostics/undecoded has them). Frames kept before a restart are among them: the newest are read back from the file at start.
Fields
idinteger requiredFrame number since the server started.
timeinteger requiredWhen it arrived, unix seconds (UTC).
accountstring requiredAccount id.
kindstring requiredframe: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.
framebodyunknown_pushextracommandinteger requiredProtocol command id.
codeinteger requiredThe frame's result code.
contextstring requiredWhere it happened, for example tick push or account reply.
errorstring requiredWhat the decoder said.
server_buildinteger requiredThe broker's MT5 build at the time.
leninteger requiredBody length in bytes.
problemsarray of LogLine requiredThe last 100 warnings and errors from the log, newest first.
LogLine fields
timeinteger requiredUnix seconds (UTC).
levelstring requiredLog level.
warnerrortargetstring requiredThe module that logged it.
messagestring requiredThe log message.
crashesarray of CrashReport requiredCrash reports in <data>/crashes, newest first.
CrashReport fields
namestring requiredFile name in <data>/crashes; fetch the text with GET /api/v1/diagnostics/crashes/{name}.
timeinteger requiredWhen it was written, unix seconds (UTC).
sizeinteger requiredSize in bytes.
summarystring requiredThe panic message, or the first line of an unclean-exit report.
unclean_exit_reportstring or null requirednull, or the file name (such as unclean-exit-2026-10-03T00-12-07Z.txt) of the report written at this start because the previous run did not shut down cleanly (its pid file was still there). Read it with GET /api/v1/diagnostics/crashes/{name}. It stays set for the whole run.
{
"version": "0.1.0",
"target": "x86_64-unknown-linux-gnu",
"pid": 41822,
"started_at": 1790894779,
"uptime_s": 75600,
"process": {
"rss_kb": 23140,
"rss_peak_kb": 31200,
"threads": 9,
"open_files": 21
},
"data_dir": "/var/lib/termless",
"log_file": "/var/lib/termless/logs/termlessd.2026-10-03.log",
"db_bytes": 135168,
"dashboard_sessions": 1,
"streams": {
"sse": 1,
"ws": 0,
"max": 1024,
"max_per_key": 256
},
"accounts": [
{
"connected": true,
"since": 1790968298,
"reconnects": 0,
"ping_ms": 14.2,
"server_build": 6090,
"last_error": null,
"subscribed": 2,
"login_rejected": false,
"retry_at": null,
"id": "pepperstone-12345678",
"enabled": true,
"session_running": true,
"ticks_seen": 1840211,
"last_tick_at_ms": 1790970379473,
"last_frame_at_ms": 1790970381002,
"streams": 1,
"ticks_coalesced": 0,
"undecoded": 3
}
],
"undecoded": {
"total": 3,
"file": "/var/lib/termless/captures/undecoded.jsonl",
"by_command": [
{
"account": "pepperstone-12345678",
"command": 8,
"kind": "body",
"context": "tick push",
"count": 3,
"first_at": 1790964410,
"last_at": 1790965012,
"last_error": "short read at offset 40"
}
],
"recent": [
{
"id": 3,
"time": 1790965012,
"account": "pepperstone-12345678",
"kind": "body",
"command": 8,
"code": 0,
"context": "tick push",
"error": "short read at offset 40",
"server_build": 6090,
"len": 52
}
]
},
"problems": [
{
"time": 1790968290,
"level": "warn",
"target": "termless::session",
"message": "[pepperstone-12345678] connection lost, reconnecting"
}
],
"crashes": [
{
"name": "20261002T231405Z-panic.txt",
"time": 1790896445,
"size": 6120,
"summary": "index out of bounds: the len is 3 but the index is 3"
}
],
"unclean_exit_report": null
}DiagnosticsAccount
An account's status plus the counters diagnostics adds.
idstring requiredAccount id.
enabledboolean requiredFalse for an account that is turned off.
connectedboolean requiredWhether the session to the broker is up right now.
sinceinteger or null requiredUnix seconds (UTC) when the current connection came up. null while disconnected.
reconnectsinteger requiredAutomatic reconnects since the server started.
ping_msnumber or null requiredLast heartbeat round trip in milliseconds. null before the first one.
server_buildinteger or null requiredMT5 build the broker's server reported. null before the first login.
last_errorstring or null requiredWhy the last connection attempt failed or the connection dropped. null while connected.
subscribedinteger requiredNumber of symbols with a live price subscription.
login_rejectedboolean requiredTrue after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.
retry_atinteger or null requiredUnix seconds (UTC) of the next connection attempt while disconnected, else null.
session_runningboolean requiredWhether the account's connection loop is running.
ticks_seeninteger requiredPrice ticks received since the session started.
last_tick_at_msinteger or null requiredWhen the last tick arrived, unix milliseconds (UTC). null before the first.
last_frame_at_msinteger or null requiredWhen the last frame of any kind (pings included) arrived from the broker, unix milliseconds (UTC). A connected account with an old value is about to be declared dead.
streamsinteger requiredOpen streams (SSE and WebSocket) on this account.
ticks_coalescedinteger requiredTicks dropped for slow stream readers (they got the latest tick per symbol instead).
undecodedinteger requiredFrames from this account the client could not decode.
UndecodedFrame
A frame the client could not decode, kept with its bytes.
idinteger requiredFrame number since the server started.
timeinteger requiredWhen it arrived, unix seconds (UTC).
accountstring requiredAccount id.
logininteger requiredMT5 login of the account.
kindstring requiredframe: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.
framebodyunknown_pushextracommandinteger requiredProtocol command id.
codeinteger requiredThe frame's result code.
contextstring requiredWhere it happened, for example tick push or account reply.
errorstring requiredWhat the decoder said.
server_buildinteger requiredThe broker's MT5 build at the time.
leninteger requiredBody length in bytes.
body_hexstring requiredThe body as hex. Without
bodies=1it is cut to the first 128 bytes andbody_previewis true; with it, up to 64 KB a frame.truncatedboolean requiredTrue when the kept body itself holds only the first 64 KB.
body_previewbooleanPresent and true when body_hex was cut to its first 128 bytes; ask with
bodies=1for the whole body.
{
"id": 3,
"time": 1790965012,
"account": "pepperstone-12345678",
"login": 12345678,
"kind": "body",
"command": 8,
"code": 0,
"context": "tick push",
"error": "short read at offset 40",
"server_build": 6090,
"len": 52,
"body_hex": "0a000000b80b0000a4703d0ad7af924000000000000000000000000000000000c8b1e2a4b5010000",
"truncated": false
}UndecodedCount
accountstring requiredAccount id.
commandinteger requiredProtocol command id.
kindstring requiredframe: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.
framebodyunknown_pushextracontextstring requiredWhere it happened.
countinteger requiredHow many such frames arrived (kept or only counted).
first_atinteger requiredFirst one, unix seconds (UTC).
last_atinteger requiredLatest one, unix seconds (UTC).
last_errorstring requiredWhat the decoder said about the latest one.
{
"account": "pepperstone-12345678",
"command": 8,
"kind": "body",
"context": "tick push",
"count": 3,
"first_at": 1790964410,
"last_at": 1790965012,
"last_error": "short read at offset 40"
}LogLine
timeinteger requiredUnix seconds (UTC).
levelstring requiredLog level.
warnerrortargetstring requiredThe module that logged it.
messagestring requiredThe log message.
{
"time": 1790968290,
"level": "warn",
"target": "termless::session",
"message": "[pepperstone-12345678] connection lost, reconnecting"
}CrashReport
namestring requiredFile name in <data>/crashes; fetch the text with GET /api/v1/diagnostics/crashes/{name}.
timeinteger requiredWhen it was written, unix seconds (UTC).
sizeinteger requiredSize in bytes.
summarystring requiredThe panic message, or the first line of an unclean-exit report.
{
"name": "20261002T231405Z-panic.txt",
"time": 1790896445,
"size": 6120,
"summary": "index out of bounds: the len is 3 but the index is 3"
}DoctorReport
The same checks as termlessd doctor: data folder, master.key, database integrity and row counts, listen address, each account's gateway (DNS, TLS, the web terminal's build), the clock against the broker (the newest live tick), free disk.
verdictstring requiredok when every check passed, warnings when something should be looked at, problems when something is broken.
okwarningsproblemsversionstring requiredServer version.
data_dirstring requiredThe data folder that was checked.
checksarray of DoctorCheck requiredOne row per check, in the order they ran.
DoctorCheck fields
namestring requiredWhat was checked: data folder, master.key, setup-token, database, listen, gateway (one per account; gateways when there are none), clock, disk.
levelstring requiredok, warn or fail.
okwarnfaildetailstring requiredWhat was found, in a sentence.
fixstringWhat to do. Only on a warn or fail.
{
"verdict": "warnings",
"version": "0.1.0",
"data_dir": "/var/lib/termless",
"checks": [
{
"name": "data folder",
"level": "ok",
"detail": "/var/lib/termless exists and is writable"
},
{
"name": "master.key",
"level": "ok",
"detail": "/var/lib/termless/master.key present (owner-only)"
},
{
"name": "database",
"level": "ok",
"detail": "/var/lib/termless/termless.db (132 KB) integrity ok; rows: accounts 1, keys 2, audit 4821, account_events 310, equity_samples 1440"
},
{
"name": "listen",
"level": "ok",
"detail": "serving on http://127.0.0.1:8780"
},
{
"name": "gateway",
"level": "ok",
"detail": "pepperstone-12345678: mt5-demo01.pepperstone.com:443 is Pepperstone Group Limited build 6090 (2 servers); connected, build 6090"
},
{
"name": "clock",
"level": "warn",
"detail": "7 s off the broker's clock",
"fix": "enable NTP (timedatectl set-ntp true); candle times and expirations depend on it"
},
{
"name": "disk",
"level": "ok",
"detail": "18240 MB free; termless uses 3 MB"
}
]
}DoctorCheck
namestring requiredWhat was checked: data folder, master.key, setup-token, database, listen, gateway (one per account; gateways when there are none), clock, disk.
levelstring requiredok, warn or fail.
okwarnfaildetailstring requiredWhat was found, in a sentence.
fixstringWhat to do. Only on a warn or fail.
{
"name": "clock",
"level": "warn",
"detail": "7 s off the broker's clock",
"fix": "enable NTP (timedatectl set-ntp true); candle times and expirations depend on it"
}EquityGap
A period the account was not connected.
frominteger requiredWhen the account stopped being connected (a lost or stopped event, the window's start if it was already down, or for a run that ended without a stop the last sample before the restart), unix milliseconds (UTC).
tointeger or null requiredWhen it connected again, unix milliseconds (UTC). null while it still is not.
{
"from": 1790968296572,
"to": 1790968298412
}{
"from": 1790981100000,
"to": null
}Certificate
A gateway certificate that was refused, for a person to judge. Termless never accepts one on its own; an admin may pin its key.
hoststring requiredThe name that was checked (the TLS name, else the host).
reasonstring requiredWhy it was refused.
unknown_issuername_mismatchexpirednot_yet_validpin_mismatchinvaliddetailstring requiredThe TLS library's words.
namesarray of string requiredThe names the certificate is for (subjectAltName, else its common name).
subjectstring requiredIts subject, most specific first.
issuerstring requiredWho issued it.
not_beforeinteger requiredValid from, unix seconds (UTC).
not_afterinteger requiredValid until, unix seconds (UTC).
spki_sha256string requiredSHA-256 of its DER SubjectPublicKeyInfo, 64 lower-case hex: the value to pin.
pinnedstring or null requiredFor pin_mismatch: the key that was expected.
{
"host": "mt5-demo.broker-example.com",
"reason": "name_mismatch",
"detail": "NotValidForNameContext",
"names": [
"*.mobile-demo.example.net",
"mobile-demo.example.net"
],
"subject": "CN=*.mobile-demo.example.net",
"issuer": "CN=Example DV CA, O=Example Trust, C=LU",
"not_before": 1759190400,
"not_after": 1790726399,
"spki_sha256": "94f8fc63b835599dd9a14fbd30445e94040d65b2801597b764aae9bfb779d4e7",
"pinned": null
}CertificateError
502 untrusted_certificate or certificate_changed: the error and the certificate.
errorobject requiredFields
codestring requiredMachine-readable error code. Matches the HTTP status.
bad_requestunauthorizedforbiddenreal_accountnot_foundmethod_not_allowedconflictrejectedtoo_many_requestsinternalbroker_errordisconnectedbusystoppingtimeoutunconfirmedtrading_pausedkey_limituntrusted_certificatecertificate_changedbrowser_onlymessagestring requiredWhat went wrong, in a sentence a person can read.
certificateobject requiredA gateway certificate that was refused, for a person to judge. Termless never accepts one on its own; an admin may pin its key.
Certificate fields
hoststring requiredThe name that was checked (the TLS name, else the host).
reasonstring requiredWhy it was refused.
unknown_issuername_mismatchexpirednot_yet_validpin_mismatchinvaliddetailstring requiredThe TLS library's words.
namesarray of string requiredThe names the certificate is for (subjectAltName, else its common name).
subjectstring requiredIts subject, most specific first.
issuerstring requiredWho issued it.
not_beforeinteger requiredValid from, unix seconds (UTC).
not_afterinteger requiredValid until, unix seconds (UTC).
spki_sha256string requiredSHA-256 of its DER SubjectPublicKeyInfo, 64 lower-case hex: the value to pin.
pinnedstring or null requiredFor pin_mismatch: the key that was expected.
{
"error": {
"code": "untrusted_certificate",
"message": "the certificate of mt5-demo.broker-example.com is not trusted: it is for another name; ..."
},
"certificate": {
"host": "mt5-demo.broker-example.com",
"reason": "name_mismatch",
"detail": "NotValidForNameContext",
"names": [
"*.mobile-demo.example.net",
"mobile-demo.example.net"
],
"subject": "CN=*.mobile-demo.example.net",
"issuer": "CN=Example DV CA, O=Example Trust, C=LU",
"not_before": 1759190400,
"not_after": 1790726399,
"spki_sha256": "94f8fc63b835599dd9a14fbd30445e94040d65b2801597b764aae9bfb779d4e7",
"pinned": null
}
}TrustRequest
fingerprintstring requiredThe key to pin: spki_sha256 from a refused check (64 hex; sha256: and colons allowed).
{
"fingerprint": "94f8fc63b835599dd9a14fbd30445e94040d65b2801597b764aae9bfb779d4e7"
}TrustResult
okboolean requiredTrue: pinned.
serverstring requiredThe server named in the path.
hoststring requiredIts host.
portinteger requiredIts port.
tls_namestring or null requiredIts TLS name, if any.
pin_sha256string requiredThe pinned key.
accounts_restartedinteger requiredAccounts on that gateway that logged in again with the pin.
serversarray of object requiredServers the host's page lists (saved with the pin).
Fields
serverstring requiredTrade server name.
typestring requireddemo or real.
demoreal
HistoryTick
One kept tick (GET /ticks), in the shape of copy_ticks_from's rows.
timeinteger requiredUnix seconds, trade server clock.
time_mscinteger requiredUnix milliseconds, trade server clock.
bidnumber requiredBid after the tick (the previous one when the tick did not change it).
asknumber requiredAsk after the tick (the previous one when the tick did not change it).
lastnumber requiredLast deal price after the tick. 0 for most forex and CFD symbols.
volumeinteger requiredThe tick's volume; 0 unless the tick changed it (flag 16).
flagsinteger requiredMetaTrader's TICK_FLAG_* for what the tick changed, added together: 2 bid, 4 ask, 8 last, 16 volume.
volume_rawinteger requiredThe broker's volume number (lots times 10^8), as volume (0.7.0).
volume_realnumber requiredThe volume in lots (0.7.0).
{
"time": 1790981179,
"time_msc": 1790981179473,
"bid": 2391.42,
"ask": 2391.6,
"last": 0,
"volume": 0,
"volume_raw": 0,
"volume_real": 0.0,
"flags": 6
}TickHistory
The ticks termlessd kept for one symbol (the web protocol serves no tick history). Since 0.7.0 a symbol's ticks are kept from its first GET /ticks read on and dropped when it stops streaming, so a first read is often empty: the newest 1,000 per symbol by default, 100,000 over all of an account's symbols. A reconnect starts it again.
symbolstring requiredSymbol name, as the broker spells it.
kept_from_mscinteger or null requiredtime_msc of the oldest tick kept for the symbol, whatever the request asked: how far back GET /ticks can reach right now. null while none is kept (a symbol subscribed just now, or TERMLESS_TICK_HISTORY=0).
ticksarray of HistoryTick requiredTicks, oldest first.
HistoryTick fields
timeinteger requiredUnix seconds, trade server clock.
time_mscinteger requiredUnix milliseconds, trade server clock.
bidnumber requiredBid after the tick (the previous one when the tick did not change it).
asknumber requiredAsk after the tick (the previous one when the tick did not change it).
lastnumber requiredLast deal price after the tick. 0 for most forex and CFD symbols.
volumeinteger requiredThe tick's volume; 0 unless the tick changed it (flag 16).
flagsinteger requiredMetaTrader's TICK_FLAG_* for what the tick changed, added together: 2 bid, 4 ask, 8 last, 16 volume.
volume_rawinteger requiredThe broker's volume number (lots times 10^8), as volume (0.7.0).
volume_realnumber requiredThe volume in lots (0.7.0).
{
"symbol": "XAUUSD",
"kept_from_msc": 1790980874102,
"ticks": [
{
"time": 1790981179,
"time_msc": 1790981179473,
"bid": 2391.42,
"ask": 2391.6,
"last": 0,
"volume": 0,
"volume_raw": 0,
"volume_real": 0.0,
"flags": 6
},
{
"time": 1790981179,
"time_msc": 1790981179688,
"bid": 2391.45,
"ask": 2391.6,
"last": 0,
"volume": 0,
"volume_raw": 0,
"volume_real": 0.0,
"flags": 2
}
]
}BookLevel
One price level of an order book, as market_book_get's BookInfo.
typeinteger requiredMetaTrader's BOOK_TYPE_*: 1 sell, 2 buy, 3 sell market, 4 buy market.
1234sidestring requiredsell for types 1 and 3, buy for 2 and 4.
sellbuypricenumber requiredThe level's price.
volumeinteger requiredVolume at this price in the broker's units (units of the base, as the web terminal shows them; 0.7.0, it was called lots), whole (the official volume).
volume_dblnumber requiredThe same, exactly.
lotsnumber requiredThe units over the symbol's contract size (0.7.0).
{
"type": 1,
"side": "sell",
"price": 2391.8,
"volume": 250,
"volume_dbl": 250.0,
"lots": 2.5
}Book
A symbol's order book (depth of market), GET /book.
symbolstring requiredSymbol name, as the broker spells it.
timeinteger requiredThe trade server's time of this book, unix seconds, server time. 0 when the broker has sent no book for the symbol (it likely has no depth there; it is asked again after 5 minutes); an old time means the broker sent no fresh book within 3 s when asked again (asked again after 30 s).
time_mscinteger requiredThe same to the millisecond (a change the broker pushed carries its milliseconds; a full snapshot 0 of them). 0 when time is 0.
levelsarray of BookLevel requiredSells from the highest price down, then buys from the highest price down. Empty when the market is closed, or when the broker sent no book (time 0).
BookLevel fields
typeinteger requiredMetaTrader's BOOK_TYPE_*: 1 sell, 2 buy, 3 sell market, 4 buy market.
1234sidestring requiredsell for types 1 and 3, buy for 2 and 4.
sellbuypricenumber requiredThe level's price.
volumeinteger requiredVolume at this price in the broker's units (units of the base, as the web terminal shows them; 0.7.0, it was called lots), whole (the official volume).
volume_dblnumber requiredThe same, exactly.
lotsnumber requiredThe units over the symbol's contract size (0.7.0).
{
"symbol": "XAUUSD",
"time": 1790981179,
"time_msc": 1790981179629,
"levels": [
{
"type": 1,
"side": "sell",
"price": 2391.8,
"volume": 250,
"volume_dbl": 250.0,
"lots": 2.5
},
{
"type": 1,
"side": "sell",
"price": 2391.6,
"volume": 100,
"volume_dbl": 100.0,
"lots": 1.0
},
{
"type": 2,
"side": "buy",
"price": 2391.42,
"volume": 120,
"volume_dbl": 120.0,
"lots": 1.2
},
{
"type": 2,
"side": "buy",
"price": 2391.2,
"volume": 300,
"volume_dbl": 300.0,
"lots": 3.0
}
]
}{
"symbol": "XAUUSD",
"time": 0,
"time_msc": 0,
"levels": []
}OrdersSnapshot
The data of an orders event (events=orders): once right after the first status, then whenever a broker trade push added, changed or removed a pending order (and after a reconnect when the book changed meanwhile). Sent only when the list differs from the last one sent; orders carry no live price, so ticks never send one. Redraw from each snapshot.
ordersarray of Order requiredEvery pending order (limit, stop, stop limit), as
GET /orderslists them.Order fields
ticketinteger requiredOrder ticket.
symbolstring requiredSymbol name.
typestring requiredOrder type.
GET /ordersandordersevents list pending orders only (limit, stop, stop limit); in atradeevent a market order isbuyorsell(withpending: false).buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_bysidestring requiredDirection.
buysellvolumenumber requiredLots still to fill.
volume_initialnumber requiredLots when placed.
pricenumber requiredTrigger price.
stop_limitnumber requiredLimit price for stop limit orders, 0 otherwise.
slnumber requiredStop loss price, 0 when none.
tpnumber requiredTake profit price, 0 when none.
expirationinteger requiredExpiry, unix seconds, trade server clock. 0 = good till cancelled.
commentstring requiredComment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.
magicinteger requiredMagic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.
reasonstring requiredWhy it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.
clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknowntime_setupinteger requiredWhen the order was placed, unix seconds, trade server clock.
time_setup_mscinteger requiredWhen the order was placed, unix milliseconds, trade server clock.
time_msinteger requiredWhen it was read, unix milliseconds (UTC).
{
"orders": [
{
"ticket": 51830020,
"symbol": "XAUUSD",
"type": "buy_limit",
"side": "buy",
"volume": 0.1,
"volume_initial": 0.1,
"price": 2365.0,
"stop_limit": 0,
"sl": 2350.0,
"tp": 2410.0,
"expiration": 0,
"comment": "dip buy",
"magic": 0,
"reason": "web",
"time_setup": 1790977698,
"time_setup_msc": 1790977698412
}
],
"time_ms": 1790977698430
}{
"orders": [],
"time_ms": 1790981179473
}StreamConnection
An open stream and what it has sent.
idinteger requiredA number for the stream, unique until the server restarts.
kindstring requiredsse for /stream, ws for /ws.
ssewswhoobject requiredFields
kindstring requiredkey, or dashboard for the dashboard's own streams.
keydashboardkey_idstringThe key's id (absent for the dashboard).
namestring requiredThe key's name, or dashboard.
ipstring requiredThe client's address (behind --trust-proxy, the proxy header's).
user_agentstring requiredThe client's User-Agent (cut to 200 characters).
accountstring requiredThe account streamed.
symbolsarray of string requiredThe symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).
eventsarray of string requiredWhat it asked for with events=.
ticksbarstradesaccountpositionsordersbatch_msinteger requiredSSE batch window asked for; 0 writes every frame at once.
opened_atinteger requiredWhen it opened, unix milliseconds (UTC).
sentobject requiredFields
messagesinteger requiredEverything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).
bytesinteger requiredBytes written, heartbeats included.
ticksinteger requiredTick messages.
eventsinteger requiredtrade, account, positions and orders messages.
last_sent_atinteger or null requiredWhen the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.
rate_per_snumber requiredMessages a second over the last 10 s (or over the stream's life when it is younger).
coalescedinteger requiredTicks this stream never saw because it fell behind (the newest per symbol was kept).
{
"id": 12,
"kind": "sse",
"who": {
"kind": "key",
"key_id": "key_3f9a1c07",
"name": "EA bridge (gold)"
},
"ip": "203.0.113.7",
"user_agent": "python-requests/2.32",
"account": "pepperstone-12345678",
"symbols": [
"XAUUSD",
"EURUSD"
],
"events": [
"ticks",
"trades",
"account"
],
"batch_ms": 0,
"opened_at": 1790977520000,
"sent": {
"messages": 52811,
"bytes": 6203417,
"ticks": 52102,
"events": 708
},
"last_sent_at": 1790981179401,
"rate_per_s": 14.6,
"coalesced": 0
}KeyTraffic
One key's traffic since the server started (zeros when unused).
key_idstring requiredKey id.
namestring requiredKey name.
scopestring requiredread, trade or admin.
readtradeadminaccountsarray or null requiredAccounts it is limited to; null = every account.
streams_openinteger requiredStreams it has open now.
stream_bytesinteger requiredBytes its open streams have sent.
requests_1hinteger requiredRequests in the last hour.
requests_24hinteger requiredRequests in the last 24 hours (since the start, if that is later).
errors_1hinteger requiredRequests in the last hour answered 400 or above.
bytes_out_1hinteger requiredResponse body bytes in the last hour (streams not included).
last_request_atinteger or null requiredIts last request, unix milliseconds (UTC). null if none since the start.
last_ipstring or null requiredThe address of its last request.
top_routes_1harray of object requiredIts busiest routes in the last hour, at most 5.
Fields
routestring requiredMethod and route template.
countinteger requiredRequests in the last hour.
{
"key_id": "key_3f9a1c07",
"name": "EA bridge (gold)",
"scope": "trade",
"accounts": [
"pepperstone-12345678"
],
"streams_open": 1,
"stream_bytes": 6203417,
"requests_1h": 120,
"requests_24h": 2211,
"errors_1h": 0,
"bytes_out_1h": 48210,
"last_request_at": 1790981175002,
"last_ip": "203.0.113.7",
"top_routes_1h": [
{
"route": "GET /api/v1/accounts/{id}/positions",
"count": 60
},
{
"route": "GET /api/v1/accounts/{id}/deals",
"count": 60
}
]
}Connections
Who is connected and what they receive, live and in memory since the server started. Key secrets never appear.
time_msinteger requiredNow, unix milliseconds (UTC).
since_msinteger requiredWhen the server started: every counter here begins then; nothing is kept across a restart.
streamsarray of StreamConnection requiredOpen streams, newest first.
StreamConnection fields
idinteger requiredA number for the stream, unique until the server restarts.
kindstring requiredsse for /stream, ws for /ws.
ssewswhoobject requiredFields
kindstring requiredkey, or dashboard for the dashboard's own streams.
keydashboardkey_idstringThe key's id (absent for the dashboard).
namestring requiredThe key's name, or dashboard.
ipstring requiredThe client's address (behind --trust-proxy, the proxy header's).
user_agentstring requiredThe client's User-Agent (cut to 200 characters).
accountstring requiredThe account streamed.
symbolsarray of string requiredThe symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).
eventsarray of string requiredWhat it asked for with events=.
ticksbarstradesaccountpositionsordersbatch_msinteger requiredSSE batch window asked for; 0 writes every frame at once.
opened_atinteger requiredWhen it opened, unix milliseconds (UTC).
sentobject requiredFields
messagesinteger requiredEverything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).
bytesinteger requiredBytes written, heartbeats included.
ticksinteger requiredTick messages.
eventsinteger requiredtrade, account, positions and orders messages.
last_sent_atinteger or null requiredWhen the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.
rate_per_snumber requiredMessages a second over the last 10 s (or over the stream's life when it is younger).
coalescedinteger requiredTicks this stream never saw because it fell behind (the newest per symbol was kept).
keysarray of KeyTraffic requiredEvery key in the keys table.
KeyTraffic fields
key_idstring requiredKey id.
namestring requiredKey name.
scopestring requiredread, trade or admin.
readtradeadminaccountsarray or null requiredAccounts it is limited to; null = every account.
streams_openinteger requiredStreams it has open now.
stream_bytesinteger requiredBytes its open streams have sent.
requests_1hinteger requiredRequests in the last hour.
requests_24hinteger requiredRequests in the last 24 hours (since the start, if that is later).
errors_1hinteger requiredRequests in the last hour answered 400 or above.
bytes_out_1hinteger requiredResponse body bytes in the last hour (streams not included).
last_request_atinteger or null requiredIts last request, unix milliseconds (UTC). null if none since the start.
last_ipstring or null requiredThe address of its last request.
top_routes_1harray of object requiredIts busiest routes in the last hour, at most 5.
Fields
routestring requiredMethod and route template.
countinteger requiredRequests in the last hour.
dashboardobject requiredFields
sessions_activeinteger requiredDashboard sessions signed in.
streams_openinteger requiredStreams the dashboard has open.
stream_bytesinteger requiredBytes those streams have sent.
requests_1hinteger requiredDashboard requests in the last hour.
requests_24hinteger requiredDashboard requests in the last 24 hours.
errors_1hinteger requiredOf them, answered 400 or above.
bytes_out_1hinteger requiredResponse body bytes in the last hour.
last_request_atinteger or null requiredThe dashboard's last request, unix milliseconds (UTC).
{
"time_ms": 1790981179473,
"since_ms": 1790968290000,
"streams": [
{
"id": 12,
"kind": "sse",
"who": {
"kind": "key",
"key_id": "key_3f9a1c07",
"name": "EA bridge (gold)"
},
"ip": "203.0.113.7",
"user_agent": "python-requests/2.32",
"account": "pepperstone-12345678",
"symbols": [
"XAUUSD",
"EURUSD"
],
"events": [
"ticks",
"trades",
"account"
],
"batch_ms": 0,
"opened_at": 1790977520000,
"sent": {
"messages": 52811,
"bytes": 6203417,
"ticks": 52102,
"events": 708
},
"last_sent_at": 1790981179401,
"rate_per_s": 14.6,
"coalesced": 0
}
],
"keys": [
{
"key_id": "key_3f9a1c07",
"name": "EA bridge (gold)",
"scope": "trade",
"accounts": [
"pepperstone-12345678"
],
"streams_open": 1,
"stream_bytes": 6203417,
"requests_1h": 120,
"requests_24h": 2211,
"errors_1h": 0,
"bytes_out_1h": 48210,
"last_request_at": 1790981175002,
"last_ip": "203.0.113.7",
"top_routes_1h": [
{
"route": "GET /api/v1/accounts/{id}/positions",
"count": 60
},
{
"route": "GET /api/v1/accounts/{id}/deals",
"count": 60
}
]
}
],
"dashboard": {
"sessions_active": 1,
"streams_open": 0,
"stream_bytes": 0,
"requests_1h": 340,
"requests_24h": 1902,
"errors_1h": 0,
"bytes_out_1h": 912044,
"last_request_at": 1790981179470
}
}TrafficRequest
atinteger requiredWhen it was answered, unix milliseconds (UTC).
methodstring requiredHTTP method.
routestring requiredMethod and the route template it matched, for example GET /api/v1/accounts/{id}/quotes; (no route) when none matched.
pathstring requiredThe path asked for, with its query (key= removed, cut to 300 characters).
statusinteger requiredHTTP status answered.
latency_msnumber requiredTime to the response's headers, milliseconds.
bytesinteger requiredResponse body bytes (0 for a stream; see its own counters).
ipstring requiredThe client's address.
accountstring or null requiredThe account in the path, if any.
{
"at": 1790981175002,
"method": "GET",
"route": "GET /api/v1/accounts/{id}/positions",
"path": "/api/v1/accounts/pepperstone-12345678/positions?symbol=XAUUSD",
"status": 200,
"latency_ms": 0.21,
"bytes": 812,
"ip": "203.0.113.7",
"account": "pepperstone-12345678"
}KeyTrafficLog
key_idstring requiredKey id.
namestring requiredKey name.
time_msinteger requiredNow, unix milliseconds (UTC).
since_msinteger requiredWhen the server started.
requestsarray of TrafficRequest requiredIts last requests, newest first (up to 500 are kept).
TrafficRequest fields
atinteger requiredWhen it was answered, unix milliseconds (UTC).
methodstring requiredHTTP method.
routestring requiredMethod and the route template it matched, for example GET /api/v1/accounts/{id}/quotes; (no route) when none matched.
pathstring requiredThe path asked for, with its query (key= removed, cut to 300 characters).
statusinteger requiredHTTP status answered.
latency_msnumber requiredTime to the response's headers, milliseconds.
bytesinteger requiredResponse body bytes (0 for a stream; see its own counters).
ipstring requiredThe client's address.
accountstring or null requiredThe account in the path, if any.
streamsarray of StreamConnection requiredIts open streams.
StreamConnection fields
idinteger requiredA number for the stream, unique until the server restarts.
kindstring requiredsse for /stream, ws for /ws.
ssewswhoobject requiredFields
kindstring requiredkey, or dashboard for the dashboard's own streams.
keydashboardkey_idstringThe key's id (absent for the dashboard).
namestring requiredThe key's name, or dashboard.
ipstring requiredThe client's address (behind --trust-proxy, the proxy header's).
user_agentstring requiredThe client's User-Agent (cut to 200 characters).
accountstring requiredThe account streamed.
symbolsarray of string requiredThe symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).
eventsarray of string requiredWhat it asked for with events=.
ticksbarstradesaccountpositionsordersbatch_msinteger requiredSSE batch window asked for; 0 writes every frame at once.
opened_atinteger requiredWhen it opened, unix milliseconds (UTC).
sentobject requiredFields
messagesinteger requiredEverything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).
bytesinteger requiredBytes written, heartbeats included.
ticksinteger requiredTick messages.
eventsinteger requiredtrade, account, positions and orders messages.
last_sent_atinteger or null requiredWhen the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.
rate_per_snumber requiredMessages a second over the last 10 s (or over the stream's life when it is younger).
coalescedinteger requiredTicks this stream never saw because it fell behind (the newest per symbol was kept).
{
"key_id": "key_3f9a1c07",
"name": "EA bridge (gold)",
"time_ms": 1790981179473,
"since_ms": 1790968290000,
"requests": [
{
"at": 1790981175002,
"method": "GET",
"route": "GET /api/v1/accounts/{id}/positions",
"path": "/api/v1/accounts/pepperstone-12345678/positions?symbol=XAUUSD",
"status": 200,
"latency_ms": 0.21,
"bytes": 812,
"ip": "203.0.113.7",
"account": "pepperstone-12345678"
}
],
"streams": [
{
"id": 12,
"kind": "sse",
"who": {
"kind": "key",
"key_id": "key_3f9a1c07",
"name": "EA bridge (gold)"
},
"ip": "203.0.113.7",
"user_agent": "python-requests/2.32",
"account": "pepperstone-12345678",
"symbols": [
"XAUUSD",
"EURUSD"
],
"events": [
"ticks",
"trades",
"account"
],
"batch_ms": 0,
"opened_at": 1790977520000,
"sent": {
"messages": 52811,
"bytes": 6203417,
"ticks": 52102,
"events": 708
},
"last_sent_at": 1790981179401,
"rate_per_s": 14.6,
"coalesced": 0
}
]
}Calc
order_calc_margin and order_calc_profit in one answer (GET /calc).
symbolstring requiredSymbol name, as the broker spells it.
sidestring requiredDirection.
buyselltypestring requiredThe MetaTrader order type the side and type make.
buysellbuy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitvolumenumber requiredLots.
pricenumber requiredThe open price used: the one asked for, else the current ask for a buy and bid for a sell.
marginnumber or null requiredThe margin the trade needs once it is open, at price, in the account currency, rounded to its digits (order_calc_margin with the market type of its side): for a pending type, what the position needs when the order fills. null when no symbol converts the margin currency to the account's.
margin_pendingnumber or null requiredFor a pending type: what the broker holds while the order waits (its type's own rate, margin_rates in the spec; 0 at the brokers seen, so nothing). null for a market order, or when no symbol converts the margin currency.
closenumber or null requiredThe closing price asked for; null without one.
profitnumber or null requiredWhat the order makes from price to close, in the account currency, rounded to its digits (order_calc_profit). null without close, or when no symbol converts the profit currency to the account's.
currencystring requiredThe account currency the numbers are in.
{
"symbol": "XAUUSD",
"side": "buy",
"type": "buy",
"volume": 0.1,
"price": 2391.6,
"margin": 119.58,
"margin_pending": null,
"close": 2400.0,
"profit": 84.0,
"currency": "USD"
}{
"symbol": "XAUUSD",
"side": "buy",
"type": "buy_limit",
"volume": 0.1,
"price": 2365.0,
"margin": 118.25,
"margin_pending": 0.0,
"close": null,
"profit": null,
"currency": "USD"
}OrderCheck
What sending an order_send request would do to the account (POST /order_check), in the account currency. The order is not sent.
okboolean requiredTrue when retcode is 0: sent now, the order would pass these checks.
retcodeinteger required0 when every check passes, else the first that failed: 10014 invalid volume, 10017 trading disabled, 10044 close only, 10042 long only, 10043 short only, 10018 market closed, 10015 invalid price (a pending price on the wrong side of the market), 10016 invalid stops (a stop-loss or take-profit on the wrong side of its price or closer than stops_level), 10019 not enough money.
0100141001710042100431004410018100151001610019commentstring requiredThe result in words.
DoneInvalid volumeTrade disabledOnly position closing is allowedOnly long positions are allowedOnly short positions are allowedMarket closedInvalid priceInvalid stopsNo moneybalancenumber requiredBalance now.
equitynumber requiredEquity now, live.
profitnumber requiredFloating profit now, live.
marginnumber requiredMargin in use with the order (includes request_margin).
margin_freenumber requiredequity - margin, with the order. Below 0 is 10019 for an order that opens something.
margin_levelnumber requiredequity / margin x 100 with the order, in percent. 0 with no margin.
request_marginnumber requiredThe margin the order itself needs: for a pending order what the broker holds while it waits (usually 0). 0 for an action that opens nothing, and when an earlier check failed.
{
"ok": true,
"retcode": 0,
"comment": "Done",
"balance": 10412.58,
"equity": 10650.69,
"profit": 238.11,
"margin": 998.51,
"margin_free": 9652.18,
"margin_level": 1066.66,
"request_margin": 119.58
}{
"ok": false,
"retcode": 10014,
"comment": "Invalid volume",
"balance": 10412.58,
"equity": 10650.69,
"profit": 238.11,
"margin": 878.93,
"margin_free": 9771.76,
"margin_level": 1211.78,
"request_margin": 0.0
}ApiKeyUpdate
Any of the fields; the ones left out stay as they are (0.6.0).
namestringA new name, up to 80 characters.
scopesone ofExactly one scope, as on create.
["read"]["trade"]["admin"]accountsone ofThe account ids it may use; null or [] for every account. Not allowed with admin (400); an unknown id is 400 too.
max_volumeone ofThe most lots per order that opens something; null for no limit.
max_open_per_minone ofThe most orders that open something in 60 s, 1 to 600; null for no limit.
max_daily_lossone ofA positive amount in the account's currency; past it (from the forex day's start) orders that open something answer 403 key_limit, not sent (0.7.0). null or left out: no limit.
max_drawdown_pctone ofMore than 0, at most 100: past that many percent below the equity's high since it was set, orders that open something answer 403 key_limit, not sent (0.7.0). Setting or changing it starts its high afresh.
{
"scopes": [
"read"
]
}{
"accounts": [
"pepperstone-12345678"
]
}Ready
A bot's pre-flight check, answered from memory with no broker round trip.
accountstring requiredAccount id.
checked_atinteger requiredWhen this was worked out, unix milliseconds (UTC).
ready_to_readboolean requiredReads of this account work now: false when any reason blocks read.
ready_to_tradeboolean requiredAn order sent now can reach the broker and be accepted on the account side: false when any reason blocks read or trade.
reasonsarray of ReadyReason requiredWhy not, and warnings. Empty when all is well.
ReadyReason fields
codestring requiredWhat it is. Blocks read: turned_off, disconnected, login_rejected. Blocks trade (an order would certainly fail): trade_disabled, investor_login, real_account_blocked, key_read_only, account_not_loaded, market_closed, unknown_symbol. Notes: price_stale and no_price (an asked symbol's price is old or missing; since 0.5.1 a note, since a market order still fills at the broker's price), build_unverified, undecoded_frames, link_quiet, connected_recently.
turned_offdisconnectedlogin_rejectedtrade_disabledinvestor_loginreal_account_blockedkey_read_onlyaccount_not_loadedmarket_closedprice_staleno_priceunknown_symbolbuild_unverifiedundecoded_frameslink_quietping_overdueconnected_recentlynew_trades_pausedblocksstring requiredread (reading and trading both fail), trade, or none (a note).
readtradenonemessagestring requiredOne plain sentence for people and logs.
symbolstringThe symbol, on the per-symbol reasons only.
linkobject requiredFields
connectedboolean requiredWhether the session's link to the broker is up.
sinceinteger or null requiredWhen the current connection came up, unix seconds (UTC); null while disconnected.
connected_for_sinteger or null requiredSeconds since then; null while disconnected.
ping_msnumber or null requiredLast heartbeat round trip; null while disconnected.
reconnectsinteger requiredReconnects since the session started.
last_frame_age_msinteger or null requiredMilliseconds since the last frame of any kind from the broker; null while disconnected.
ping_pending_msinteger or null requiredHow long the oldest unanswered ping has waited, in milliseconds; null when none is waiting (0.6.0). Past 2,000 the reasons carry ping_overdue.
pings_missedinteger requiredPings missed in a row; the link is cut at two (0.6.0).
last_errorstring or null requiredThe last error, only while disconnected.
retry_atinteger or null requiredThe next connection attempt, unix seconds (UTC), only while disconnected.
loginobject requiredFields
logged_inboolean requiredThe session holds a logged-in link.
rejectedboolean requiredThe last refusal was of the login details.
serverobject requiredFields
buildinteger or null requiredThe broker's server build; null before the first connect.
build_verifiedboolean requiredA build Termless's decoding has been checked against live.
verified_buildsarray of integer requiredThe builds checked against live (health::VERIFIED_BUILDS).
tradingobject requiredFields
allowedboolean requiredEvery check on the trade side passes.
account_trade_allowedboolean requiredThe broker allows trading on the account.
investorboolean requiredLogged in with the investor (read-only) password.
demoboolean requiredA demo or contest account.
real_moneystring or null requireddemo, allowed (real money with trade_real on), blocked (real money with it off); null before the account record is read.
demoallowedblockedNonekey_can_tradeboolean requiredThe caller's scope is trade or admin.
pricesarray of ReadyPrice requiredThe watched symbols, then the asked ones that are not watched.
ReadyPrice fields
symbolstring requiredSymbol name.
watchedboolean requiredOn the account's watchlist (streamed).
askedboolean requiredNamed in symbols=.
last_tick_age_msinteger or null requiredMilliseconds since its last tick; null before the first.
market_openboolean or null requiredWhether its market is open now; null when that cannot be told.
market_sourcestring or null requiredsessions (the spec's quote sessions, on the broker's clock), heuristic (no spec loaded yet: the forex week, Sunday 17:00 to Friday 17:00 New York time), or null.
sessionsheuristicNonefreshboolean requiredA tick came within 120 s, or the market is closed (a closed market is never stale). Information: nothing is blocked on it (since 0.5.1).
undecoded_last_hourinteger requiredFrames from this account the client could not decode in the last hour.
{
"account": "pepperstone-12345678",
"checked_at": 1792300000123,
"ready_to_read": true,
"ready_to_trade": true,
"reasons": [],
"link": {
"connected": true,
"since": 1792290000,
"connected_for_s": 10000,
"ping_ms": 12.4,
"reconnects": 2,
"last_frame_age_ms": 800,
"ping_pending_ms": null,
"pings_missed": 0,
"last_error": null,
"retry_at": null
},
"login": {
"logged_in": true,
"rejected": false
},
"server": {
"build": 6090,
"build_verified": true,
"verified_builds": [
6090,
6182,
6230
]
},
"trading": {
"allowed": true,
"account_trade_allowed": true,
"investor": false,
"demo": true,
"real_money": "demo",
"key_can_trade": true
},
"prices": [
{
"symbol": "XAUUSD",
"watched": true,
"asked": true,
"last_tick_age_ms": 812,
"market_open": true,
"market_source": "sessions",
"fresh": true
},
{
"symbol": "EURUSD",
"watched": true,
"asked": false,
"last_tick_age_ms": 240,
"market_open": true,
"market_source": "sessions",
"fresh": true
}
],
"undecoded_last_hour": 0
}{
"account": "pepperstone-12345678",
"checked_at": 1792300000123,
"ready_to_read": true,
"ready_to_trade": false,
"reasons": [
{
"code": "market_closed",
"blocks": "trade",
"symbol": "EURUSD",
"message": "EURUSD's market is closed now (its trading sessions say so); orders would be refused"
}
],
"link": {
"connected": true,
"since": 1792290000,
"connected_for_s": 10000,
"ping_ms": 12.4,
"reconnects": 2,
"last_frame_age_ms": 800,
"ping_pending_ms": null,
"pings_missed": 0,
"last_error": null,
"retry_at": null
},
"login": {
"logged_in": true,
"rejected": false
},
"server": {
"build": 6090,
"build_verified": true,
"verified_builds": [
6090,
6182,
6230
]
},
"trading": {
"allowed": true,
"account_trade_allowed": true,
"investor": false,
"demo": true,
"real_money": "demo",
"key_can_trade": true
},
"prices": [
{
"symbol": "EURUSD",
"watched": true,
"asked": true,
"last_tick_age_ms": 172800000,
"market_open": false,
"market_source": "sessions",
"fresh": true
}
],
"undecoded_last_hour": 0
}ReadyReason
codestring requiredWhat it is. Blocks read: turned_off, disconnected, login_rejected. Blocks trade (an order would certainly fail): trade_disabled, investor_login, real_account_blocked, key_read_only, account_not_loaded, market_closed, unknown_symbol. Notes: price_stale and no_price (an asked symbol's price is old or missing; since 0.5.1 a note, since a market order still fills at the broker's price), build_unverified, undecoded_frames, link_quiet, connected_recently.
turned_offdisconnectedlogin_rejectedtrade_disabledinvestor_loginreal_account_blockedkey_read_onlyaccount_not_loadedmarket_closedprice_staleno_priceunknown_symbolbuild_unverifiedundecoded_frameslink_quietping_overdueconnected_recentlynew_trades_pausedblocksstring requiredread (reading and trading both fail), trade, or none (a note).
readtradenonemessagestring requiredOne plain sentence for people and logs.
symbolstringThe symbol, on the per-symbol reasons only.
{
"code": "market_closed",
"blocks": "trade",
"symbol": "EURUSD",
"message": "EURUSD's market is closed now (its trading sessions say so); orders would be refused"
}ReadyPrice
symbolstring requiredSymbol name.
watchedboolean requiredOn the account's watchlist (streamed).
askedboolean requiredNamed in symbols=.
last_tick_age_msinteger or null requiredMilliseconds since its last tick; null before the first.
market_openboolean or null requiredWhether its market is open now; null when that cannot be told.
market_sourcestring or null requiredsessions (the spec's quote sessions, on the broker's clock), heuristic (no spec loaded yet: the forex week, Sunday 17:00 to Friday 17:00 New York time), or null.
sessionsheuristicNonefreshboolean requiredA tick came within 120 s, or the market is closed (a closed market is never stale). Information: nothing is blocked on it (since 0.5.1).
{
"symbol": "XAUUSD",
"watched": true,
"asked": true,
"last_tick_age_ms": 812,
"market_open": true,
"market_source": "sessions",
"fresh": true
}StatusReport
Termless and each broker link, over time: uptime, outages and their causes, prices, order latency, protocol drift.
verdictstring requireddown when every enabled account is down (and at least one is enabled), degraded when any account is down or degraded or Termless wrote a crash report in the last 24 hours, healthy otherwise (also with no accounts).
healthydegradeddownsummarystring requiredOne plain sentence for people.
checked_atinteger requiredWhen this was worked out, unix milliseconds (UTC).
termlessobject requiredFields
versionstring requiredServer version.
started_atinteger requiredWhen this run started, unix seconds (UTC).
uptime_sinteger requiredSeconds since then.
rss_kbinteger or null requiredResident memory in KB; null off Linux.
rss_peak_kbinteger or null requiredThe most resident memory since the start, in KB; null off Linux.
restarts_30dinteger requiredStarts of the server in the last 30 days (the audit trail's start rows); the first start of an install is not a restart.
unclean_exits_30dinteger requiredRuns in the last 30 days that ended without shutting down (killed, crashed, out of memory, power lost).
last_start_atinteger or null requiredThe latest start, unix milliseconds (UTC).
crash_reports_24hinteger requiredCrash reports written in the last 24 hours: a panic termlessd survived, or an unclean exit found at a start (they are under GET /diagnostics). One makes the verdict degraded.
errors_1hinteger requiredError lines in termlessd's log in the last hour: counted, not judged.
trail_rows_droppedinteger requiredAudit rows, events and samples dropped since the start because the trails writer fell behind (its queue holds 50,000; 0.6.0). Anything above 0 means the database is slow or full.
accountsarray of AccountHealth requiredThe accounts the caller may use.
AccountHealth fields
idstring requiredAccount id.
labelstring requiredDisplay name.
serverstring requiredTrade server name.
brokerstring requiredThe server name's first word (Pepperstone-Demo is Pepperstone), used in the sentences.
enabledboolean requiredFalse when an admin turned it off.
verdictstring requireddown: enabled and not connected. degraded: connected but an unverified build, undecoded frames in the last hour, its price feed stopped (ticks.feed_quiet), ping over 1000 ms, or under 99% up over the last hour. off: turned off. healthy otherwise.
healthydegradeddownoffsummarystring requiredOne plain sentence for people.
connectedboolean requiredWhether the link is up now.
sinceinteger or null requiredWhen the current connection came up, unix seconds (UTC).
ping_msnumber or null requiredLast heartbeat round trip.
tracked_sinceinteger or null requiredWhere the 30-day numbers start: 30 days ago, or later when the account was added or its connection history starts inside that window; unix milliseconds (UTC); null with no history.
uptimeobject requiredEach window ends now.
Fields
1hobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
24hobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
7dobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
30dobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
daysarray of UptimeDay requiredThe last 30 UTC days, oldest first; today runs up to now.
UptimeDay fields
datestring requiredThe UTC day, YYYY-MM-DD.
frominteger requiredIts 00:00 UTC, unix milliseconds.
percentnumber or null requiredAs in a window; null for a day with nothing measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected.
measured_msinteger requiredMeasured time in the day (today: up to now).
outagesinteger requiredOutages overlapping the day.
outagesarray of Outage requiredNewest first: those overlapping the last 30 days, at most 50.
Outage fields
frominteger requiredWhen the link was lost (or Termless stopped), unix milliseconds (UTC).
tointeger or null requiredWhen it was connected again; null while it lasts.
duration_msinteger requiredto - from, or up to now while it lasts.
ongoingboolean requiredTrue while it lasts.
start_estimatedboolean requiredTrue when from is an estimate (0.6.0): a link cut for missed pings is down from its first unanswered ping, 12 to 17 s before the cut.
detected_atinteger or null requiredWhen the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.
causestring requiredbroker_maintenance (logins refused with code 2 right after the drop, or the forex weekend break), broker_unreachable (TCP, TLS or the WebSocket upgrade failed or timed out), broker_unresponsive (connected but the broker stopped answering), termless_restart (Termless stopped, restarted, upgraded or was killed, or the account's session started again), network (name lookups failing, no route, connections reset), login_refused (the login details refused), unknown.
broker_maintenancebroker_unreachablebroker_unresponsivetermless_restartnetworklogin_refusedunknownmessagestring requiredOne plain sentence for people.
detailstring or null requiredThe technical reason seen (the lost event's reason, the connect errors).
ticksobject requiredFields
per_minnumber or null requiredTicks over the last minute; null until a minute of samples exists.
seeninteger requiredTicks since the session started.
last_tick_age_msinteger or null requiredAge of the newest tick of any symbol; null before one.
feed_quietboolean requiredConnected over 120 s and every watched symbol whose market is open has gone 120 s without a tick: the feed stopped while the link stays up. One quiet symbol is the market (since 0.5.1).
symbolsarray of object requiredThe watchlist.
Fields
symbolstring requiredSymbol name.
last_tick_age_msinteger or null requiredMilliseconds since its last tick.
market_openboolean or null requiredAs in /ready.
freshboolean requiredAs in /ready.
ordersobject requiredFields
window_hinteger required24.
countinteger requiredTrade requests sent through this server in the window (from the audit trail).
doneinteger requiredThe broker executed or placed it.
rejectedinteger requiredThe broker refused it (422).
timeoutinteger requiredNo answer (504).
failedinteger requiredAnything else: busy, disconnected, a 502.
latency_msobject or null requiredThe broker round trip over done and rejected requests; null when there were none.
Fields
p50integerMedian.
p95integer95th percentile.
maxintegerSlowest.
pings_missedinteger requiredHeartbeat pings the broker did not answer in time since the server started (0.6.0); two in a row cut the link.
trades_unconfirmedinteger requiredTrades answered 504 unconfirmed since the start (0.6.0).
trades_lateinteger requiredOf them, those whose final result came later (0.6.0).
command_waitsinteger requiredRequests that waited for their command's turn since the start (most wait no time; 0.6.0).
command_wait_msinteger requiredThe time they waited, in all, in milliseconds (0.6.0).
protocolobject requiredFields
buildinteger or null requiredThe broker's server build.
build_verifiedboolean requiredA build Termless has been checked against (see /ready).
undecoded_1hinteger requiredUndecodable frames in the last hour.
undecoded_24hinteger requiredUndecodable frames in the last 24 hours.
undecoded_by_commandarray of object requiredLast 24 hours, by command.
Fields
commandinteger requiredProtocol command id.
countinteger requiredFrames.
{
"verdict": "healthy",
"summary": "All good: 1 account connected, 99.86% up over the last 24 hours.",
"checked_at": 1792300000123,
"termless": {
"version": "0.6.2",
"started_at": 1792200000,
"uptime_s": 100000,
"rss_kb": 16384,
"rss_peak_kb": 20480,
"restarts_30d": 3,
"unclean_exits_30d": 0,
"last_start_at": 1792200000000,
"crash_reports_24h": 0,
"errors_1h": 0,
"trail_rows_dropped": 0
},
"accounts": [
{
"id": "pepperstone-12345678",
"label": "Pepperstone demo",
"server": "Pepperstone-Demo",
"broker": "Pepperstone",
"enabled": true,
"verdict": "healthy",
"summary": "Connected for 2 h 46 min, ping 12 ms.",
"connected": true,
"since": 1792290000,
"ping_ms": 12.4,
"tracked_since": 1790000000000,
"uptime": {
"1h": {
"percent": 100.0,
"up_ms": 3600000,
"down_ms": 0,
"measured_ms": 3600000,
"reconnects": 0,
"outages": 0,
"longest_outage_ms": 0
},
"24h": {
"percent": 99.86,
"up_ms": 86280000,
"down_ms": 120000,
"measured_ms": 86400000,
"reconnects": 1,
"outages": 1,
"longest_outage_ms": 120000
},
"7d": {
"percent": 99.97,
"up_ms": 604620000,
"down_ms": 180000,
"measured_ms": 604800000,
"reconnects": 3,
"outages": 2,
"longest_outage_ms": 120000
},
"30d": {
"percent": 99.95,
"up_ms": 2590710000,
"down_ms": 1290000,
"measured_ms": 2592000000,
"reconnects": 9,
"outages": 6,
"longest_outage_ms": 600000
}
},
"days": [
{
"date": "2026-09-19",
"from": 1789776000000,
"percent": null,
"up_ms": 0,
"down_ms": 0,
"measured_ms": 0,
"outages": 0
},
{
"date": "2026-10-18",
"from": 1792281600000,
"percent": 99.35,
"up_ms": 18280000,
"down_ms": 120000,
"measured_ms": 18400000,
"outages": 1
}
],
"outages": [
{
"from": 1792291200000,
"to": 1792291320000,
"duration_ms": 120000,
"ongoing": false,
"start_estimated": false,
"detected_at": null,
"cause": "broker_maintenance",
"message": "Pepperstone restarted its servers; back after 2 min.",
"detail": "login refused (code 2) for 1 min after the link dropped"
},
{
"from": 1792199996000,
"to": 1792200001200,
"duration_ms": 5200,
"ongoing": false,
"start_estimated": false,
"detected_at": null,
"cause": "termless_restart",
"message": "Termless restarted; back after 5 s.",
"detail": "termlessd stopped (upgrade or restart)"
}
],
"ticks": {
"per_min": 384.0,
"seen": 1234567,
"last_tick_age_ms": 400,
"feed_quiet": false,
"symbols": [
{
"symbol": "EURUSD",
"last_tick_age_ms": 400,
"market_open": true,
"fresh": true
},
{
"symbol": "XAUUSD",
"last_tick_age_ms": 812,
"market_open": true,
"fresh": true
}
]
},
"orders": {
"window_h": 24,
"count": 12,
"done": 11,
"rejected": 1,
"timeout": 0,
"failed": 0,
"latency_ms": {
"p50": 41,
"p95": 120,
"max": 133
}
},
"protocol": {
"build": 6090,
"build_verified": true,
"undecoded_1h": 0,
"undecoded_24h": 0,
"undecoded_by_command": []
},
"pings_missed": 2,
"trades_unconfirmed": 0,
"trades_late": 0,
"command_waits": 1840,
"command_wait_ms": 3120
}
]
}AccountHealth
One account in GET /status.
idstring requiredAccount id.
labelstring requiredDisplay name.
serverstring requiredTrade server name.
brokerstring requiredThe server name's first word (Pepperstone-Demo is Pepperstone), used in the sentences.
enabledboolean requiredFalse when an admin turned it off.
verdictstring requireddown: enabled and not connected. degraded: connected but an unverified build, undecoded frames in the last hour, its price feed stopped (ticks.feed_quiet), ping over 1000 ms, or under 99% up over the last hour. off: turned off. healthy otherwise.
healthydegradeddownoffsummarystring requiredOne plain sentence for people.
connectedboolean requiredWhether the link is up now.
sinceinteger or null requiredWhen the current connection came up, unix seconds (UTC).
ping_msnumber or null requiredLast heartbeat round trip.
tracked_sinceinteger or null requiredWhere the 30-day numbers start: 30 days ago, or later when the account was added or its connection history starts inside that window; unix milliseconds (UTC); null with no history.
uptimeobject requiredEach window ends now.
Fields
1hobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
24hobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
7dobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
30dobject requiredUptimeWindow fields
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
daysarray of UptimeDay requiredThe last 30 UTC days, oldest first; today runs up to now.
UptimeDay fields
datestring requiredThe UTC day, YYYY-MM-DD.
frominteger requiredIts 00:00 UTC, unix milliseconds.
percentnumber or null requiredAs in a window; null for a day with nothing measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected.
measured_msinteger requiredMeasured time in the day (today: up to now).
outagesinteger requiredOutages overlapping the day.
outagesarray of Outage requiredNewest first: those overlapping the last 30 days, at most 50.
Outage fields
frominteger requiredWhen the link was lost (or Termless stopped), unix milliseconds (UTC).
tointeger or null requiredWhen it was connected again; null while it lasts.
duration_msinteger requiredto - from, or up to now while it lasts.
ongoingboolean requiredTrue while it lasts.
start_estimatedboolean requiredTrue when from is an estimate (0.6.0): a link cut for missed pings is down from its first unanswered ping, 12 to 17 s before the cut.
detected_atinteger or null requiredWhen the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.
causestring requiredbroker_maintenance (logins refused with code 2 right after the drop, or the forex weekend break), broker_unreachable (TCP, TLS or the WebSocket upgrade failed or timed out), broker_unresponsive (connected but the broker stopped answering), termless_restart (Termless stopped, restarted, upgraded or was killed, or the account's session started again), network (name lookups failing, no route, connections reset), login_refused (the login details refused), unknown.
broker_maintenancebroker_unreachablebroker_unresponsivetermless_restartnetworklogin_refusedunknownmessagestring requiredOne plain sentence for people.
detailstring or null requiredThe technical reason seen (the lost event's reason, the connect errors).
ticksobject requiredFields
per_minnumber or null requiredTicks over the last minute; null until a minute of samples exists.
seeninteger requiredTicks since the session started.
last_tick_age_msinteger or null requiredAge of the newest tick of any symbol; null before one.
feed_quietboolean requiredConnected over 120 s and every watched symbol whose market is open has gone 120 s without a tick: the feed stopped while the link stays up. One quiet symbol is the market (since 0.5.1).
symbolsarray of object requiredThe watchlist.
Fields
symbolstring requiredSymbol name.
last_tick_age_msinteger or null requiredMilliseconds since its last tick.
market_openboolean or null requiredAs in /ready.
freshboolean requiredAs in /ready.
ordersobject requiredFields
window_hinteger required24.
countinteger requiredTrade requests sent through this server in the window (from the audit trail).
doneinteger requiredThe broker executed or placed it.
rejectedinteger requiredThe broker refused it (422).
timeoutinteger requiredNo answer (504).
failedinteger requiredAnything else: busy, disconnected, a 502.
latency_msobject or null requiredThe broker round trip over done and rejected requests; null when there were none.
Fields
p50integerMedian.
p95integer95th percentile.
maxintegerSlowest.
pings_missedinteger requiredHeartbeat pings the broker did not answer in time since the server started (0.6.0); two in a row cut the link.
trades_unconfirmedinteger requiredTrades answered 504 unconfirmed since the start (0.6.0).
trades_lateinteger requiredOf them, those whose final result came later (0.6.0).
command_waitsinteger requiredRequests that waited for their command's turn since the start (most wait no time; 0.6.0).
command_wait_msinteger requiredThe time they waited, in all, in milliseconds (0.6.0).
protocolobject requiredFields
buildinteger or null requiredThe broker's server build.
build_verifiedboolean requiredA build Termless has been checked against (see /ready).
undecoded_1hinteger requiredUndecodable frames in the last hour.
undecoded_24hinteger requiredUndecodable frames in the last 24 hours.
undecoded_by_commandarray of object requiredLast 24 hours, by command.
Fields
commandinteger requiredProtocol command id.
countinteger requiredFrames.
{
"id": "pepperstone-12345678",
"label": "Pepperstone demo",
"server": "Pepperstone-Demo",
"broker": "Pepperstone",
"enabled": true,
"verdict": "healthy",
"summary": "Connected for 2 h 46 min, ping 12 ms.",
"connected": true,
"since": 1792290000,
"ping_ms": 12.4,
"tracked_since": 1790000000000,
"uptime": {
"1h": {
"percent": 100.0,
"up_ms": 3600000,
"down_ms": 0,
"measured_ms": 3600000,
"reconnects": 0,
"outages": 0,
"longest_outage_ms": 0
},
"24h": {
"percent": 99.86,
"up_ms": 86280000,
"down_ms": 120000,
"measured_ms": 86400000,
"reconnects": 1,
"outages": 1,
"longest_outage_ms": 120000
},
"7d": {
"percent": 99.97,
"up_ms": 604620000,
"down_ms": 180000,
"measured_ms": 604800000,
"reconnects": 3,
"outages": 2,
"longest_outage_ms": 120000
},
"30d": {
"percent": 99.95,
"up_ms": 2590710000,
"down_ms": 1290000,
"measured_ms": 2592000000,
"reconnects": 9,
"outages": 6,
"longest_outage_ms": 600000
}
},
"days": [
{
"date": "2026-09-19",
"from": 1789776000000,
"percent": null,
"up_ms": 0,
"down_ms": 0,
"measured_ms": 0,
"outages": 0
},
{
"date": "2026-10-18",
"from": 1792281600000,
"percent": 99.35,
"up_ms": 18280000,
"down_ms": 120000,
"measured_ms": 18400000,
"outages": 1
}
],
"outages": [
{
"from": 1792291200000,
"to": 1792291320000,
"duration_ms": 120000,
"ongoing": false,
"start_estimated": false,
"detected_at": null,
"cause": "broker_maintenance",
"message": "Pepperstone restarted its servers; back after 2 min.",
"detail": "login refused (code 2) for 1 min after the link dropped"
},
{
"from": 1792199996000,
"to": 1792200001200,
"duration_ms": 5200,
"ongoing": false,
"start_estimated": false,
"detected_at": null,
"cause": "termless_restart",
"message": "Termless restarted; back after 5 s.",
"detail": "termlessd stopped (upgrade or restart)"
}
],
"ticks": {
"per_min": 384.0,
"seen": 1234567,
"last_tick_age_ms": 400,
"feed_quiet": false,
"symbols": [
{
"symbol": "EURUSD",
"last_tick_age_ms": 400,
"market_open": true,
"fresh": true
},
{
"symbol": "XAUUSD",
"last_tick_age_ms": 812,
"market_open": true,
"fresh": true
}
]
},
"orders": {
"window_h": 24,
"count": 12,
"done": 11,
"rejected": 1,
"timeout": 0,
"failed": 0,
"latency_ms": {
"p50": 41,
"p95": 120,
"max": 133
}
},
"protocol": {
"build": 6090,
"build_verified": true,
"undecoded_1h": 0,
"undecoded_24h": 0,
"undecoded_by_command": []
},
"pings_missed": 2,
"trades_unconfirmed": 0,
"trades_late": 0,
"command_waits": 1840,
"command_wait_ms": 3120
}UptimeWindow
percentnumber or null requiredup_ms / measured_ms x 100, 2 decimals; null when nothing was measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected, Termless's own downtime included.
measured_msinteger requiredThe window less the time before the account was added (or before its history starts) and the time it was turned off.
reconnectsinteger requiredLinks that came back inside the window.
outagesinteger requiredOutages overlapping the window.
longest_outage_msinteger requiredThe longest of them, clipped to the window.
{
"percent": 99.86,
"up_ms": 86280000,
"down_ms": 120000,
"measured_ms": 86400000,
"reconnects": 1,
"outages": 1,
"longest_outage_ms": 120000
}UptimeDay
datestring requiredThe UTC day, YYYY-MM-DD.
frominteger requiredIts 00:00 UTC, unix milliseconds.
percentnumber or null requiredAs in a window; null for a day with nothing measured.
up_msinteger requiredConnected.
down_msinteger requiredNot connected.
measured_msinteger requiredMeasured time in the day (today: up to now).
outagesinteger requiredOutages overlapping the day.
{
"date": "2026-10-18",
"from": 1792281600000,
"percent": 99.35,
"up_ms": 18280000,
"down_ms": 120000,
"measured_ms": 18400000,
"outages": 1
}{
"date": "2026-09-19",
"from": 1789776000000,
"percent": null,
"up_ms": 0,
"down_ms": 0,
"measured_ms": 0,
"outages": 0
}Outage
frominteger requiredWhen the link was lost (or Termless stopped), unix milliseconds (UTC).
tointeger or null requiredWhen it was connected again; null while it lasts.
duration_msinteger requiredto - from, or up to now while it lasts.
ongoingboolean requiredTrue while it lasts.
start_estimatedboolean requiredTrue when from is an estimate (0.6.0): a link cut for missed pings is down from its first unanswered ping, 12 to 17 s before the cut.
detected_atinteger or null requiredWhen the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.
causestring requiredbroker_maintenance (logins refused with code 2 right after the drop, or the forex weekend break), broker_unreachable (TCP, TLS or the WebSocket upgrade failed or timed out), broker_unresponsive (connected but the broker stopped answering), termless_restart (Termless stopped, restarted, upgraded or was killed, or the account's session started again), network (name lookups failing, no route, connections reset), login_refused (the login details refused), unknown.
broker_maintenancebroker_unreachablebroker_unresponsivetermless_restartnetworklogin_refusedunknownmessagestring requiredOne plain sentence for people.
detailstring or null requiredThe technical reason seen (the lost event's reason, the connect errors).
{
"from": 1792291200000,
"to": 1792291320000,
"duration_ms": 120000,
"ongoing": false,
"start_estimated": false,
"detected_at": null,
"cause": "broker_maintenance",
"message": "Pepperstone restarted its servers; back after 2 min.",
"detail": "login refused (code 2) for 1 min after the link dropped"
}{
"from": 1792199996000,
"to": 1792200001200,
"duration_ms": 5200,
"ongoing": false,
"start_estimated": false,
"detected_at": null,
"cause": "termless_restart",
"message": "Termless restarted; back after 5 s.",
"detail": "termlessd stopped (upgrade or restart)"
}Gap
Ticks a stream missed (0.7.0): event: gap on SSE, type: gap on the WebSocket. They are never replayed: the broker keeps no tick history.
reasonstring requiredbehind: this stream fell behind and kept only the newest tick per symbol; reconnect: the broker link was down; fanout: the account's fan-out fell behind the session.
behindreconnectfanoutsymbolsarray of string requiredbehind: the symbols that lost ticks; otherwise every symbol of the stream.
droppedinteger or null requiredbehind: how many ticks this stream lost; null when nobody can count them.
from_mscinteger requiredbehind: the first dropped tick's time; otherwise the last tick this stream got before. Ticks' own clock.
to_mscinteger requiredbehind: the last dropped tick's time; otherwise the first tick after, which follows this event.
from_utc_mscintegerfrom_msc in UTC; only with the account's clock rule (0.7.1).
to_utc_mscintegerto_msc in UTC; only with the account's clock rule (0.7.1).
from_utc_ambiguousbooleantrue when from_msc falls in New York's repeated autumn hour (0.7.1).
to_utc_ambiguousbooleantrue when to_msc falls in New York's repeated autumn hour (0.7.1).
{
"reason": "reconnect",
"symbols": [
"XAUUSD"
],
"dropped": null,
"from_msc": 1790981170212,
"to_msc": 1790981191408
}Bar
A bar of a bar series (0.7.0, events=bars): event: bar on SSE, type: bar on the WebSocket.
symbolstring requiredSymbol name.
timeframestring requiredTimeframe.
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1timeinteger requiredBar open time, unix seconds, trade server clock.
opennumber requiredOpen.
highnumber requiredHigh.
lownumber requiredLow.
closenumber requiredClose.
tick_volumeinteger requiredTick count in the bar.
real_volumeinteger requiredExchange volume.
statestring requiredforming: built from the bids, at most four a second per series; closed: the broker's bar once its period ended (plus 2 s), sent once per period, or later for a period whose tick came late (0.7.1: bars can arrive out of time order, place each by time); corrected: the broker's bar differs from the one sent (read again a minute later, or after the server clock went back).
formingclosedcorrected
{
"symbol": "XAUUSD",
"timeframe": "M1",
"time": 1790981160,
"open": 2391.2,
"high": 2391.9,
"low": 2391.1,
"close": 2391.42,
"tick_volume": 112,
"real_volume": 0,
"state": "forming"
}BarsGap
Bars a series cannot send (0.7.0): over 500 missed during an outage, a stream far behind, or (0.7.1) a bar that could not be read again or a minute of failed reads. Read the range by REST.
symbolstring requiredSymbol name.
timeframestring requiredTimeframe.
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1frominteger requiredThe first missed bar's open time.
tointeger requiredThe last missed bar's open time.
from_utcintegerfrom in UTC; only with the account's clock rule (0.7.1).
to_utcintegerto in UTC; only with the account's clock rule (0.7.1).
from_utc_ambiguousbooleantrue when from falls in New York's repeated autumn hour (0.7.1).
to_utc_ambiguousbooleantrue when to falls in New York's repeated autumn hour (0.7.1).
{
"symbol": "XAUUSD",
"timeframe": "M1",
"from": 1790944800,
"to": 1790981100
}OverviewAccount
One account: its summary, or why there is none (not connected, for example).
idstring requiredAccount id.
summaryobjectSummary fields
logininteger requiredMT5 login number.
namestring requiredAccount holder name at the broker.
serverstring requiredTrade server name.
companystring requiredBroker company name.
currencystring requiredDeposit currency.
leverageinteger requiredLeverage, for example 200 for 1:200.
balancenumber requiredBalance without open positions.
creditnumber requiredCredit from the broker.
profitnumber requiredFloating profit of open positions, live.
equitynumber requiredbalance + credit + profit, live.
marginnumber requiredMargin in use, live.
margin_freenumber requiredequity - margin.
margin_levelnumber requiredequity / margin x 100, in percent. 0 with no margin in use.
margin_so_callnumber requiredMargin call level.
margin_so_sonumber requiredStop out level.
trade_allowedboolean requiredWhether the broker allows trading on this account.
demoboolean requiredTrue for a demo account.
hedgingboolean requiredTrue for a hedging account, false for netting.
server_offsetinteger requiredTrade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.
positionsinteger requiredOpen positions.
ordersinteger requiredPending orders.
errorobjectFields
codestring requiredError code.
messagestring requiredWhat went wrong.
statusinteger requiredThe HTTP status the summary route would answer.
Overview
accountsarray of OverviewAccount requiredEvery enabled account the caller may read.
OverviewAccount fields
idstring requiredAccount id.
summaryobjectSummary fields
logininteger requiredMT5 login number.
namestring requiredAccount holder name at the broker.
serverstring requiredTrade server name.
companystring requiredBroker company name.
currencystring requiredDeposit currency.
leverageinteger requiredLeverage, for example 200 for 1:200.
balancenumber requiredBalance without open positions.
creditnumber requiredCredit from the broker.
profitnumber requiredFloating profit of open positions, live.
equitynumber requiredbalance + credit + profit, live.
marginnumber requiredMargin in use, live.
margin_freenumber requiredequity - margin.
margin_levelnumber requiredequity / margin x 100, in percent. 0 with no margin in use.
margin_so_callnumber requiredMargin call level.
margin_so_sonumber requiredStop out level.
trade_allowedboolean requiredWhether the broker allows trading on this account.
demoboolean requiredTrue for a demo account.
hedgingboolean requiredTrue for a hedging account, false for netting.
server_offsetinteger requiredTrade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.
positionsinteger requiredOpen positions.
ordersinteger requiredPending orders.
errorobjectFields
codestring requiredError code.
messagestring requiredWhat went wrong.
statusinteger requiredThe HTTP status the summary route would answer.
{
"accounts": [
{
"id": "pepperstone-12345678",
"summary": {
"login": 12345678,
"name": "Demo Trader",
"server": "Pepperstone-Demo",
"company": "Pepperstone Group Limited",
"currency": "USD",
"leverage": 200,
"balance": 10412.58,
"credit": 0.0,
"profit": 238.11,
"equity": 10650.69,
"margin": 878.93,
"margin_free": 9771.76,
"margin_level": 1211.78,
"margin_so_call": 100.0,
"margin_so_so": 50.0,
"trade_allowed": true,
"demo": true,
"hedging": true,
"server_offset": 10800,
"positions": 3,
"orders": 2
}
}
]
}StatsDay
daystring requiredYYYY-MM-DD: the forex day under a clock rule, else the server's date.
profitnumber requiredWhat the trades closed that day made.
tradesinteger requiredTrades closed that day.
Stats
A trade is a position with a closing deal in the range; its result is every deal of it the history read holds (profit, swap, commission, fee; the read starts 7 days early so an opening commission counts), its time its last closing deal's.
tradesinteger requiredPositions with a closing deal in the range.
winsinteger requiredTrades that made money.
lossesinteger requiredTrades that lost money.
win_ratenumber or null requiredPercent of trades won; null with no trades.
profit_factornumber or null requiredWhat the wins made over what the losses lost; null with no losses.
avg_winnumber or null requiredPer winning trade.
avg_lossnumber or null requiredPer losing trade (negative).
gross_profitnumber requiredWhat the wins made.
gross_lossnumber requiredWhat the losses lost (negative).
netnumber requiredThe trades' results together.
max_drawdownnumber requiredThe largest fall of the closed results from a high, in time order (positive).
by_dayarray of StatsDay requiredEach day with a closed trade, oldest first.
StatsDay fields
daystring requiredYYYY-MM-DD: the forex day under a clock rule, else the server's date.
profitnumber requiredWhat the trades closed that day made.
tradesinteger requiredTrades closed that day.
frominteger requiredRange start, unix seconds, server time.
tointeger requiredRange end.
from_utcintegerRange start in UTC; only with the account's clock rule (0.7.1).
to_utcintegerRange end in UTC; only with the account's clock rule (0.7.1).
from_utc_ambiguousbooleantrue when from falls in New York's repeated autumn hour (0.7.1).
to_utc_ambiguousbooleantrue when to falls in New York's repeated autumn hour (0.7.1).
currencystring or null requiredThe account's currency.
{
"trades": 5,
"wins": 3,
"losses": 2,
"win_rate": 60.0,
"profit_factor": 2.02,
"avg_win": 29.0,
"avg_loss": -21.5,
"gross_profit": 87.0,
"gross_loss": -43.0,
"net": 44.0,
"max_drawdown": 32.0,
"by_day": [
{
"day": "2026-11-30",
"profit": 16.0,
"trades": 2
},
{
"day": "2026-12-01",
"profit": 28.0,
"trades": 3
}
],
"from": 1793780000,
"to": 1796372000,
"currency": "USD"
}SpecItem
A spec as GET /symbols/{symbol} gives it, plus its name and when it was read; or an error for a name the broker does not know.
spec
namestring requiredSymbol name.
descriptionstring requiredBroker's description.
pathstring requiredFolder in the broker's symbol tree.
digitsinteger requiredPrice decimals.
pointnumber requiredSmallest price step, 10^-digits.
contract_sizenumber requiredUnits per 1.00 lot.
tick_sizenumber requiredSmallest price change. The point when the broker does not send one.
tick_valuenumber or null requiredValue of one tick_size move for 1.00 lot, in the account currency. The broker's own figure, else worked out as the terminal does: tick_size x contract_size, converted from currency_profit to the account currency, for forex, CFD, leveraged CFD and exchange stock symbols. null when the broker sends none and it cannot be worked out (futures and index CFDs, or no conversion symbol). Pepperstone sends neither tick value nor tick size.
currency_basestring requiredBase currency.
currency_profitstring requiredProfit currency.
currency_marginstring requiredMargin currency.
volume_minnumber requiredSmallest order, in lots.
volume_maxnumber requiredLargest order, in lots.
volume_stepnumber requiredLot step.
volume_limitnumber requiredLargest total of open positions and pending orders in one direction, in lots. 0 = no limit.
trade_modestring requiredWhether trading is allowed. unknown only for a value MetaTrader does not define.
fulllong_onlyshort_onlyclose_onlydisabledunknownexecutionstring requiredExecution mode. unknown only for a value MetaTrader does not define.
marketinstantrequestexchangeunknownfillingarray of string requiredFilling modes the symbol allows.
fokiocreturnstops_levelinteger requiredMinimum distance of SL and TP from the price, in points.
freeze_levelinteger requiredDistance in points inside which orders cannot be changed.
swap_longnumber requiredSwap for long positions, in the unit swap_mode names.
swap_shortnumber requiredSwap for short positions, in the unit swap_mode names.
swap_modestring requiredThe unit of swap_long and swap_short. unknown only for a value MetaTrader does not define.
disabledpointssymbol_currencymargin_currencydeposit_currencyinterest_currentinterest_openreopen_currentreopen_bidprofit_currencyunknownswap_3daystring or null requiredThe day the swap is charged three times: sunday, monday, tuesday, wednesday, thursday, friday or saturday. null for none (crypto CFDs send none).
margin_initialnumber requiredInitial margin setting of the symbol, as the broker sends it.
margin_maintenancenumber requiredMaintenance margin setting, as the broker sends it.
margin_hedgednumber requiredMargin for a hedged pair of positions (one lot each way), as the broker sends it.
margin_rate_buynumber requiredInitial margin rate for a buy (the same as margin_rates.buy).
margin_rate_sellnumber requiredInitial margin rate for a sell (the same as margin_rates.sell).
margin_ratesobject requiredEvery order type's initial margin rate, as the broker sends it. A pending type's rate is what the broker holds while such an order waits: the brokers seen send 0 there (nothing is held), and once the order fills the position needs its side's market rate. A market rate of 0 counts as 1.
Fields
buynumber requiredInitial margin rate for a buy.
sellnumber requiredInitial margin rate for a sell.
buy_limitnumber requiredInitial margin rate for a buy limit.
sell_limitnumber requiredInitial margin rate for a sell limit.
buy_stopnumber requiredInitial margin rate for a buy stop.
sell_stopnumber requiredInitial margin rate for a sell stop.
buy_stop_limitnumber requiredInitial margin rate for a buy stop limit.
sell_stop_limitnumber requiredInitial margin rate for a sell stop limit.
expirationarray of string requiredThe expiry modes a pending order on this symbol may use.
gtcdayspecifiedspecified_dayorder_typesarray of string requiredThe order types the symbol takes.
marketlimitstopstop_limitsltpclose_bysessionsobject requiredFields
quotearray of array of array of integer requiredQuote sessions: 7 lists, one per weekday, Sunday first, each a list of [open_min, close_min] in minutes from midnight, trade server time.
tradearray of array of array of integer requiredTrade sessions, same shape as quote.
tradeableboolean or null requiredWhether a trade can be opened now, as on /quotes: the trade_mode is full, long_only or short_only, and one of today's trade sessions is open by the server's clock. null when the broker sent no trade sessions.
book_depthintegerThe levels a side of the symbol's order book may hold (0 when the broker sends none); a book past it is renewed (0.7.0).
fetched_at_msinteger or null requiredWhen it was read from the broker, unix ms.
error
namestring requiredThe name as asked.
errorobject requiredFields
codestring requiredError code.
messagestring requiredWhat went wrong.
CandleBatchRequest
itemsarray of object required1 to 20 ranges, at most 200,000 bars in all (each item's whole range counts).
Fields
symbolstring requiredSymbol name.
timeframestringTimeframe (default M5).
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1frominteger requiredRange start, unix seconds, server time.
tointeger requiredRange end.
{
"items": [
{
"symbol": "XAUUSD",
"timeframe": "M5",
"from": 1790894400,
"to": 1790980800
},
{
"symbol": "EURUSD",
"timeframe": "H1",
"from": 1790376000,
"to": 1790980800
}
]
}CandleBatchItem
candles
symbolstring requiredSymbol name, as the broker spells it.
timeframestring requiredTimeframe.
M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1frominteger requiredAs asked.
tointeger requiredAs asked.
truncatedboolean requiredThe range held more than 50,000 bars; the newest are kept.
candlesarray of Candle requiredBars, oldest first.
Candle fields
timeinteger requiredBar open time, unix seconds, trade server clock.
opennumber requiredOpen.
highnumber requiredHigh.
lownumber requiredLow.
closenumber requiredClose.
tick_volumeinteger requiredTick count in the bar.
real_volumeinteger requiredExchange volume. 0 for most CFD symbols.
spreadinteger requiredAlways 0: the web protocol's bars carry no spread (MetaTrader builds bars from the bid).
completeboolean requiredThe bar has closed, by the server's clock (a month bar closes at the next month's start). The newest bar is usually still forming, but at a weekend or a daily break it may be closed too: read this rather than dropping the last bar.
time_utcintegerBar open time in UTC, unix seconds; only with the account's clock rule (0.7.0).
time_utc_ambiguousbooleantrue when the time falls in New York's repeated autumn hour (0.7.0).
error
symbolstring requiredThe name as asked.
timeframestring requiredTimeframe.
frominteger requiredAs asked.
tointeger requiredAs asked.
errorobject requiredFields
codestring requiredError code.
messagestring requiredWhat went wrong.
statusinteger requiredThe HTTP status a single read would answer.
CandleBatch
itemsarray of CandleBatchItem requiredOne per range asked, in order.
See CandleBatchItem.