TermlessDocs

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

GET/api/v1/health

Answers 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.

Scope No key needed

Headers

  • X-Request-Id string

    Your 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.

  • status string required

    ok when every enabled account is connected, degraded when an enabled account is not, setup before the admin password exists.

    okdegradedsetup
  • version string or null required

    Server 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_s integer required

    Seconds since the server started.

  • accounts array of object required

    Empty unless the caller is signed in or sends a valid key; then the accounts it may see.

    Fields
    • id string required

      Account id.

    • label string required

      Display name.

    • enabled boolean required

      False for an account that is turned off.

    • connected boolean required

      Whether the session to the broker is up.

    • ping_ms number or null required

      Last heartbeat round trip in milliseconds.

    • reconnects integer required

      Reconnects since the server started.

Errors

  • 400 bad_request A 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
curl -s "$TERMLESS_URL/api/v1/health"
Python
import os
import requests

base = os.environ["TERMLESS_URL"] + "/api/v1"

r = requests.get(f"{base}/health")
r.raise_for_status()
print(r.json())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "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

GET/api/v1/setup

True on a new install until the admin password is set.

Scope No key needed

Headers

  • X-Request-Id string

    Your 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_setup boolean required

    True until the admin password has been set.

Errors

  • 400 bad_request A 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
curl -s "$TERMLESS_URL/api/v1/setup"
Python
import os
import requests

base = os.environ["TERMLESS_URL"] + "/api/v1"

r = requests.get(f"{base}/setup")
r.raise_for_status()
print(r.json())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "needs_setup": false
}

Finish first-run setup

POST/api/v1/setup

Sets 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.

Scope No key needed

Headers

  • X-Request-Id string

    Your 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

  • token string required

    The one-time setup token from the server log or <data>/setup-token.

  • password string required

    The 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.

  • ok boolean required

    Always true.

Errors

  • 400 bad_request A 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 unauthorized No valid API key or session.
  • 409 conflict The 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_requests This 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
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"}'
Python
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())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "ok": true
}

Sign in to the dashboard

POST/api/v1/session

Checks 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.

Scope No key needed

Headers

  • X-Request-Id string

    Your 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

  • password string required

    The admin password.

Response 200 Signed in (Set-Cookie).

A Ok object.

  • ok boolean required

    Always true.

Errors

  • 401 unauthorized No valid API key or session.
  • 409 conflict The 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_requests This 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
curl -s -X POST "$TERMLESS_URL/api/v1/session" \
  -c cookies.txt \
  -H "Content-Type: application/json" \
  -d '{"password": "a long passphrase"}'
Python
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())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "ok": true
}

Sign out

DELETE/api/v1/session

Clears the session cookie.

Scope No key needed

Headers

  • X-Request-Id string

    Your 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.

  • ok boolean required

    Always true.

curl
curl -s -X DELETE "$TERMLESS_URL/api/v1/session" \
  -b cookies.txt
Python
import 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())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "ok": true
}

Who am I

GET/api/v1/me

Tells 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.

Scope Any key

Headers

  • X-Request-Id string

    Your 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.

  • kind string required

    admin for the dashboard session, key for an API key.

    adminkey
  • name string required

    admin, or the key's name.

  • scopes array of string required

    What this caller may do.

    readtradeadmin
  • accounts array or null required

    Account ids this caller may use. null means every account.

Errors

  • 400 bad_request A 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 unauthorized No valid API key or session.
  • 429 too_many_requests This 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
curl -s "$TERMLESS_URL/api/v1/me" \
  -H "Authorization: Bearer $TERMLESS_KEY"
Python
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())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "kind": "key",
  "name": "EA bridge (gold)",
  "scopes": [
    "trade"
  ],
  "accounts": [
    "pepperstone-12345678"
  ]
}

Change the admin password

PUT/api/v1/admin/password

Dashboard 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.

Scope admin · cookie only

Headers

  • X-Request-Id string

    Your 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

  • current string required

    The admin password in use now. A wrong one is 400, not 401, so the dashboard stays signed in.

  • new string required

    The 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.

  • ok boolean required

    Always true.

Errors

  • 400 bad_request A 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 unauthorized No valid API key or session.
  • 403 forbidden The key lacks the scope, or may not use this account, or a cookie request came from another site.
  • 429 too_many_requests This 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
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"}'
Python
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())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "ok": true
}

Get the status report

GET/api/v1/status

Whether 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.

Scope read

Headers

  • X-Request-Id string

    Your 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.

  • verdict string required

    down 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).

    healthydegradeddown
  • summary string required

    One plain sentence for people.

  • checked_at integer required

    When this was worked out, unix milliseconds (UTC).

  • termless object required

    Fields
    • version string required

      Server version.

    • started_at integer required

      When this run started, unix seconds (UTC).

    • uptime_s integer required

      Seconds since then.

    • rss_kb integer or null required

      Resident memory in KB; null off Linux.

    • rss_peak_kb integer or null required

      The most resident memory since the start, in KB; null off Linux.

    • restarts_30d integer required

      Starts 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_30d integer required

      Runs in the last 30 days that ended without shutting down (killed, crashed, out of memory, power lost).

    • last_start_at integer or null required

      The latest start, unix milliseconds (UTC).

    • crash_reports_24h integer required

      Crash 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_1h integer required

      Error lines in termlessd's log in the last hour: counted, not judged.

    • trail_rows_dropped integer required

      Audit 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.

  • accounts array of AccountHealth required

    The accounts the caller may use.

    AccountHealth fields
    • id string required

      Account id.

    • label string required

      Display name.

    • server string required

      Trade server name.

    • broker string required

      The server name's first word (Pepperstone-Demo is Pepperstone), used in the sentences.

    • enabled boolean required

      False when an admin turned it off.

    • verdict string required

      down: 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.

      healthydegradeddownoff
    • summary string required

      One plain sentence for people.

    • connected boolean required

      Whether the link is up now.

    • since integer or null required

      When the current connection came up, unix seconds (UTC).

    • ping_ms number or null required

      Last heartbeat round trip.

    • tracked_since integer or null required

      Where 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.

    • uptime object required

      Each window ends now.

      Fields
      • 1h object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

      • 24h object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

      • 7d object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

      • 30d object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

    • days array of UptimeDay required

      The last 30 UTC days, oldest first; today runs up to now.

      UptimeDay fields
      • date string required

        The UTC day, YYYY-MM-DD.

      • from integer required

        Its 00:00 UTC, unix milliseconds.

      • percent number or null required

        As in a window; null for a day with nothing measured.

      • up_ms integer required

        Connected.

      • down_ms integer required

        Not connected.

      • measured_ms integer required

        Measured time in the day (today: up to now).

      • outages integer required

        Outages overlapping the day.

    • outages array of Outage required

      Newest first: those overlapping the last 30 days, at most 50.

      Outage fields
      • from integer required

        When the link was lost (or Termless stopped), unix milliseconds (UTC).

      • to integer or null required

        When it was connected again; null while it lasts.

      • duration_ms integer required

        to - from, or up to now while it lasts.

      • ongoing boolean required

        True while it lasts.

      • start_estimated boolean required

        True 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_at integer or null required

        When the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.

      • cause string required

        broker_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_refusedunknown
      • message string required

        One plain sentence for people.

      • detail string or null required

        The technical reason seen (the lost event's reason, the connect errors).

    • ticks object required

      Fields
      • per_min number or null required

        Ticks over the last minute; null until a minute of samples exists.

      • seen integer required

        Ticks since the session started.

      • last_tick_age_ms integer or null required

        Age of the newest tick of any symbol; null before one.

      • feed_quiet boolean required

        Connected 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).

      • symbols array of object required

        The watchlist.

        Fields
        • symbol string required

          Symbol name.

        • last_tick_age_ms integer or null required

          Milliseconds since its last tick.

        • market_open boolean or null required

          As in /ready.

        • fresh boolean required

          As in /ready.

    • orders object required

      Fields
      • window_h integer required

        24.

      • count integer required

        Trade requests sent through this server in the window (from the audit trail).

      • done integer required

        The broker executed or placed it.

      • rejected integer required

        The broker refused it (422).

      • timeout integer required

        No answer (504).

      • failed integer required

        Anything else: busy, disconnected, a 502.

      • latency_ms object or null required

        The broker round trip over done and rejected requests; null when there were none.

        Fields
        • p50 integer

          Median.

        • p95 integer

          95th percentile.

        • max integer

          Slowest.

    • pings_missed integer required

      Heartbeat pings the broker did not answer in time since the server started (0.6.0); two in a row cut the link.

    • trades_unconfirmed integer required

      Trades answered 504 unconfirmed since the start (0.6.0).

    • trades_late integer required

      Of them, those whose final result came later (0.6.0).

    • command_waits integer required

      Requests that waited for their command's turn since the start (most wait no time; 0.6.0).

    • command_wait_ms integer required

      The time they waited, in all, in milliseconds (0.6.0).

    • protocol object required

      Fields
      • build integer or null required

        The broker's server build.

      • build_verified boolean required

        A build Termless has been checked against (see /ready).

      • undecoded_1h integer required

        Undecodable frames in the last hour.

      • undecoded_24h integer required

        Undecodable frames in the last 24 hours.

      • undecoded_by_command array of object required

        Last 24 hours, by command.

        Fields
        • command integer required

          Protocol command id.

        • count integer required

          Frames.

Errors

  • 400 bad_request A 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 unauthorized No valid API key or session.
  • 429 too_many_requests This 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
curl -s "$TERMLESS_URL/api/v1/status" \
  -H "Authorization: Bearer $TERMLESS_KEY"
Python
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())
Python, stdlib
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))
JavaScript
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());
Response 200
{
  "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

GET/api/v1/metrics

The 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: ...}).

Scope read

Headers

  • X-Request-Id string

    Your 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_request A 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 unauthorized No valid API key or session.
  • 429 too_many_requests This 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
curl -s "$TERMLESS_URL/api/v1/metrics" \
  -H "Authorization: Bearer $TERMLESS_KEY"
Python
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)
Python, stdlib
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())
JavaScript
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());
Response 200
# 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