Reference
Health, setup and session
Whether the server is up and how well it has been (GET /status, GET /metrics for Prometheus), first-run setup, and the dashboard's own sign-in. Apps and agents need /health, /me, /status and each account's /ready.
Check health
/api/v1/healthAnswers without a key, so it works for uptime monitors. degraded means an enabled account is not connected. version and accounts are filled in only for a signed-in caller or a valid key (accounts then only with the accounts it may see); anyone else gets version: null and no accounts.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Response 200 Server state.
A Health object.
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.
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere).
curl -s "$TERMLESS_URL/api/v1/health"import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
r = requests.get(f"{base}/health")
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {}
req = urllib.request.Request(f"{base}/health", data=None, headers=headers, method="GET")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/health`);
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"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
}
]
}Check whether setup is needed
/api/v1/setupTrue on a new install until the admin password is set.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Response 200 Setup state.
A SetupState object.
needs_setupboolean requiredTrue until the admin password has been set.
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere).
curl -s "$TERMLESS_URL/api/v1/setup"import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
r = requests.get(f"{base}/setup")
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {}
req = urllib.request.Request(f"{base}/setup", data=None, headers=headers, method="GET")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/setup`);
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"needs_setup": false
}Finish first-run setup
/api/v1/setupSets the admin password using the one-time setup token the server printed to its log (also in <data>/setup-token), and signs you in with a session cookie. The token stops anyone who reaches the port first from claiming the install. Setting TERMLESS_ADMIN_PASSWORD in the environment skips this step; termlessd passwd resets the password. Wrong tokens count toward the 5-try lockout.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Request body 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).
Response 200 Done, and signed in (Set-Cookie).
A Ok object.
okboolean requiredAlways true.
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere). - 401
unauthorizedNo valid API key or session. - 409
conflictThe thing already exists or the state does not allow it. On a trade route with an Idempotency-Key: the key was already used with a different body or query string, or the first request with it did not finish (cut off, or the server restarted; check positions and orders, then use a new key), or it is still running after 30 s. - 429
too_many_requestsThis IP is locked out for 15 minutes (5 wrong passwords or setup tokens lock it out of sign-in, 30 unknown API keys in 15 minutes lock it out of key auth), or a stream cap was hit (1,024 open streams per server, 256 per key or dashboard session), or a password check could not start (one at a time per IP, two at a time per server). Retry-After has the seconds to wait.
curl -s -X POST "$TERMLESS_URL/api/v1/setup" \
-c cookies.txt \
-H "Content-Type: application/json" \
-d '{"token": "4f1c9e0b7a2d5e8c3b6a9d0e", "password": "A long passphrase, 2 commas"}'import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
r = requests.post(f"{base}/setup", json={
"token": "4f1c9e0b7a2d5e8c3b6a9d0e",
"password": "A long passphrase, 2 commas"
})
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {}
payload = {
"token": "4f1c9e0b7a2d5e8c3b6a9d0e",
"password": "A long passphrase, 2 commas"
}
headers["Content-Type"] = "application/json"
req = urllib.request.Request(f"{base}/setup", data=json.dumps(payload).encode(), headers=headers, method="POST")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/setup`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"token": "4f1c9e0b7a2d5e8c3b6a9d0e",
"password": "A long passphrase, 2 commas"
})
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"ok": true
}Sign in to the dashboard
/api/v1/sessionChecks the admin password and sets the HttpOnly, SameSite=Strict cookie termless_session (30 days) that acts like an admin key. A cookie-authenticated write or WebSocket whose Origin is another site is refused (403). Five wrong tries from one IP lock that IP out for 15 minutes.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Request body SessionRequest
passwordstring requiredThe admin password.
Response 200 Signed in (Set-Cookie).
A Ok object.
okboolean requiredAlways true.
Errors
- 401
unauthorizedNo valid API key or session. - 409
conflictThe thing already exists or the state does not allow it. On a trade route with an Idempotency-Key: the key was already used with a different body or query string, or the first request with it did not finish (cut off, or the server restarted; check positions and orders, then use a new key), or it is still running after 30 s. - 429
too_many_requestsThis IP is locked out for 15 minutes (5 wrong passwords or setup tokens lock it out of sign-in, 30 unknown API keys in 15 minutes lock it out of key auth), or a stream cap was hit (1,024 open streams per server, 256 per key or dashboard session), or a password check could not start (one at a time per IP, two at a time per server). Retry-After has the seconds to wait.
curl -s -X POST "$TERMLESS_URL/api/v1/session" \
-c cookies.txt \
-H "Content-Type: application/json" \
-d '{"password": "a long passphrase"}'import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
r = requests.post(f"{base}/session", json={
"password": "a long passphrase"
})
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {}
payload = {
"password": "a long passphrase"
}
headers["Content-Type"] = "application/json"
req = urllib.request.Request(f"{base}/session", data=json.dumps(payload).encode(), headers=headers, method="POST")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/session`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"password": "a long passphrase"
})
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"ok": true
}Sign out
/api/v1/sessionClears the session cookie.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Response 200 Signed out.
A Ok object.
okboolean requiredAlways true.
curl -s -X DELETE "$TERMLESS_URL/api/v1/session" \
-b cookies.txtimport os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
s = requests.Session() # signed in earlier with POST /api/v1/session
r = s.delete(f"{base}/session")
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {"Cookie": "termless_session=" + os.environ["TERMLESS_SESSION"]} # from POST /api/v1/session
req = urllib.request.Request(f"{base}/session", data=None, headers=headers, method="DELETE")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/session`, {
method: "DELETE",
credentials: "same-origin"
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"ok": true
}Who am I
/api/v1/meTells you what the key (or session) you sent may do. A good first call for an agent: it shows the scope and the accounts in reach.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Response 200 The caller.
A Me object.
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.
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere). - 401
unauthorizedNo valid API key or session. - 429
too_many_requestsThis IP is locked out for 15 minutes (5 wrong passwords or setup tokens lock it out of sign-in, 30 unknown API keys in 15 minutes lock it out of key auth), or a stream cap was hit (1,024 open streams per server, 256 per key or dashboard session), or a password check could not start (one at a time per IP, two at a time per server). Retry-After has the seconds to wait.
curl -s "$TERMLESS_URL/api/v1/me" \
-H "Authorization: Bearer $TERMLESS_KEY"import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
auth = {"Authorization": "Bearer " + os.environ["TERMLESS_KEY"]}
r = requests.get(f"{base}/me", headers=auth)
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {"Authorization": "Bearer " + os.environ["TERMLESS_KEY"]}
req = urllib.request.Request(f"{base}/me", data=None, headers=headers, method="GET")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/me`, {
headers: { Authorization: `Bearer ${process.env.TERMLESS_KEY}` }
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"kind": "key",
"name": "EA bridge (gold)",
"scopes": [
"trade"
],
"accounts": [
"pepperstone-12345678"
]
}Change the admin password
/api/v1/admin/passwordDashboard session only; an API key gets 403. Signs out every other dashboard session. A wrong current is 400 (not 401, so the dashboard stays signed in) and counts toward the 5-try lockout.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Request body 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).
Response 200 Changed.
A Ok object.
okboolean requiredAlways true.
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere). - 401
unauthorizedNo valid API key or session. - 403
forbiddenThe key lacks the scope, or may not use this account, or a cookie request came from another site. - 429
too_many_requestsThis IP is locked out for 15 minutes (5 wrong passwords or setup tokens lock it out of sign-in, 30 unknown API keys in 15 minutes lock it out of key auth), or a stream cap was hit (1,024 open streams per server, 256 per key or dashboard session), or a password check could not start (one at a time per IP, two at a time per server). Retry-After has the seconds to wait.
curl -s -X PUT "$TERMLESS_URL/api/v1/admin/password" \
-b cookies.txt \
-H "Content-Type: application/json" \
-d '{"current": "A long passphrase, 2 commas", "new": "An even longer passphrase, 3 commas"}'import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
s = requests.Session() # signed in earlier with POST /api/v1/session
r = s.put(f"{base}/admin/password", json={
"current": "A long passphrase, 2 commas",
"new": "An even longer passphrase, 3 commas"
})
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {"Cookie": "termless_session=" + os.environ["TERMLESS_SESSION"]} # from POST /api/v1/session
payload = {
"current": "A long passphrase, 2 commas",
"new": "An even longer passphrase, 3 commas"
}
headers["Content-Type"] = "application/json"
req = urllib.request.Request(f"{base}/admin/password", data=json.dumps(payload).encode(), headers=headers, method="PUT")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/admin/password`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"current": "A long passphrase, 2 commas",
"new": "An even longer passphrase, 3 commas"
}),
credentials: "same-origin"
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"ok": true
}Get the status report
/api/v1/statusWhether Termless and each broker link are working, and how well over time: a verdict and one plain sentence at the top; the process (version, uptime, memory, restarts and unclean exits in 30 days); and per account its verdict, uptime over 1 hour, 24 hours, 7 days and 30 days (time before the account was added and time it was turned off are left out; Termless's own downtime counts as down), reconnects, the longest outage, a 30-day strip of UTC days, the outages with a cause (broker maintenance, broker unreachable, broker unresponsive, Termless restart, network, login refused), the tick rate and each watched symbol's last tick, order round-trip latency and counts over 24 hours, and protocol drift (the build, whether it is verified, undecoded frames). A key limited to some accounts sees only those; an admin key, a key without an account list and the dashboard see all. Read from the connection history and the audit trail.
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Response 200 The report.
A StatusReport object.
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.
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere). - 401
unauthorizedNo valid API key or session. - 429
too_many_requestsThis IP is locked out for 15 minutes (5 wrong passwords or setup tokens lock it out of sign-in, 30 unknown API keys in 15 minutes lock it out of key auth), or a stream cap was hit (1,024 open streams per server, 256 per key or dashboard session), or a password check could not start (one at a time per IP, two at a time per server). Retry-After has the seconds to wait.
curl -s "$TERMLESS_URL/api/v1/status" \
-H "Authorization: Bearer $TERMLESS_KEY"import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
auth = {"Authorization": "Bearer " + os.environ["TERMLESS_KEY"]}
r = requests.get(f"{base}/status", headers=auth)
r.raise_for_status()
print(r.json())import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {"Authorization": "Bearer " + os.environ["TERMLESS_KEY"]}
req = urllib.request.Request(f"{base}/status", data=None, headers=headers, method="GET")
with urllib.request.urlopen(req, timeout=35) as r:
print(json.load(r))const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/status`, {
headers: { Authorization: `Bearer ${process.env.TERMLESS_KEY}` }
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());{
"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
}
]
}Get Prometheus metrics
/api/v1/metricsThe same numbers in the Prometheus text format 0.0.4 (text/plain; version=0.0.4), for a scraper: termless_up, termless_build_info{version}, termless_uptime_seconds, termless_process_resident_memory_bytes (Linux), and per account (label account): enabled, connected, ready{kind=read|trade}, ping_seconds, reconnects_total, ticks_total, last_tick_age_seconds, uptime_ratio{window=1h|24h|7d|30d}, undecoded_frames_total, server_build, build_verified, orders_total{result=done|rejected|timeout|failed} and order_latency_seconds_sum/_count (since this start). The accounts follow the same rule as GET /status. Send the key as Authorization: Bearer (Prometheus: authorization: {credentials: ...}).
Headers
X-Request-IdstringYour own id for the request, kept and echoed in the response header of the same name (and written on every log line and audit row of the request). Anything else is replaced by one the server makes.
Response 200 The metrics, text/plain; version=0.0.4.
Plain text (text/plain).
Errors
- 400
bad_requestA field is missing or not valid, or the query string has a parameter the route does not take (the message names the ones it takes;key=is accepted anywhere). - 401
unauthorizedNo valid API key or session. - 429
too_many_requestsThis IP is locked out for 15 minutes (5 wrong passwords or setup tokens lock it out of sign-in, 30 unknown API keys in 15 minutes lock it out of key auth), or a stream cap was hit (1,024 open streams per server, 256 per key or dashboard session), or a password check could not start (one at a time per IP, two at a time per server). Retry-After has the seconds to wait.
curl -s "$TERMLESS_URL/api/v1/metrics" \
-H "Authorization: Bearer $TERMLESS_KEY"import os
import requests
base = os.environ["TERMLESS_URL"] + "/api/v1"
auth = {"Authorization": "Bearer " + os.environ["TERMLESS_KEY"]}
r = requests.get(f"{base}/metrics", headers=auth)
r.raise_for_status()
print(r.text)import json
import os
import urllib.error
import urllib.request
base = os.environ["TERMLESS_URL"] + "/api/v1"
headers = {"Authorization": "Bearer " + os.environ["TERMLESS_KEY"]}
req = urllib.request.Request(f"{base}/metrics", data=None, headers=headers, method="GET")
with urllib.request.urlopen(req, timeout=35) as r:
print(r.read().decode())const base = `${process.env.TERMLESS_URL}/api/v1`;
const res = await fetch(`${base}/metrics`, {
headers: { Authorization: `Bearer ${process.env.TERMLESS_KEY}` }
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.text());# HELP termless_up Always 1 while termlessd answers.
# TYPE termless_up gauge
termless_up 1
# HELP termless_build_info The termlessd version.
# TYPE termless_build_info gauge
termless_build_info{version="0.6.2"} 1
# HELP termless_uptime_seconds Seconds since termlessd started.
# TYPE termless_uptime_seconds gauge
termless_uptime_seconds 100000
# HELP termless_crash_reports_24h Crash reports (panics termlessd survived, unclean exits) written in the last 24 hours.
# TYPE termless_crash_reports_24h gauge
termless_crash_reports_24h 0
# HELP termless_errors_logged_1h Error lines in termlessd's log in the last hour.
# TYPE termless_errors_logged_1h gauge
termless_errors_logged_1h 0
# HELP termless_account_connected 1 while the account's link to the broker is up.
# TYPE termless_account_connected gauge
termless_account_connected{account="pepperstone-12345678"} 1
# HELP termless_account_ready The ready check without asked symbols, 1 or 0.
# TYPE termless_account_ready gauge
termless_account_ready{account="pepperstone-12345678",kind="read"} 1
termless_account_ready{account="pepperstone-12345678",kind="trade"} 1
# HELP termless_account_uptime_ratio Share of the window the account was connected (as /status).
# TYPE termless_account_uptime_ratio gauge
termless_account_uptime_ratio{account="pepperstone-12345678",window="24h"} 0.9986
# HELP termless_account_orders_total Trade requests since this start, by result.
# TYPE termless_account_orders_total counter
termless_account_orders_total{account="pepperstone-12345678",result="done"} 11