TermlessDocs

Reference

Trails

What happened, with the request id that caused it: the audit trail (every write and every security event), each account's connection history, and an equity curve sampled once a minute. Rows are written off the request path and pruned hourly: audit 90 days or 200,000 rows, connection events 90 days or 50,000 rows, equity 7 days. Also who is connected right now and what they receive (in memory, since the server started).

Read the audit trail

GET/api/v1/audit

Every write and every security event, newest first: trades (one row per broker call with the request in short JSON, the retcode, the result and the broker latency; none for an idempotent replay), account and key changes, sign-ins, wrong passwords, lockouts, password changes, setup, server checks and server starts. Each row carries the X-Request-Id of the request that caused it, so a bot's log, the server log and the trail line up. Every filter given must match; an empty one is ignored. request_id finds the rows of one request (exact, indexed). q finds a piece of text, case-insensitive, in the request id, actor, account, route, summary or result; it reads from the newest row down and stops at limit matches (a search that matches little reads the whole trail, 40 to 60 ms at the 200,000-row cap). Page with before = the id of the last row seen, with or without a search.

Scope admin

Query parameters

  • account string

    Only rows about this account.

  • kind string

    Only rows of this kind.

    tradeaccountkeysigninauth_failedlockoutpasswordsetupserver_checkserver_truststart
  • actor string

    Only rows by this actor (a key id, admin, an IP, termlessd).

  • request_id string

    Only rows caused by the request with this X-Request-Id (exact match).

  • q string

    Only rows whose request_id, actor, account, route, summary or result contains this text, ignoring case (% and _ are plain characters). More than 200 characters is 400.

  • before integer

    Only rows with an id below this: the id of the last row of the previous page.

  • limit integer default 100 min 1, max 1000

    Most rows to return, at most 1000.

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 Rows, newest first.

A JSON array of AuditRow objects.

  • id integer required

    Row id, increasing. Page with before.

  • at integer required

    When it happened, unix milliseconds (UTC).

  • kind string required

    What kind of thing happened.

    tradeaccountkeysigninauth_failedlockoutpasswordsetupserver_checkserver_truststart
  • actor string required

    Who did it: the key id for a key, admin for the dashboard, the client IP before sign-in, termlessd for the server itself.

  • actor_kind string required

    admin for the dashboard session, key for an API key, anonymous before sign-in, system for the server.

    adminkeyanonymoussystem
  • account string or null required

    The account it concerned, when one did.

  • route string required

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

  • summary string required

    One line a person can read.

  • request string or null required

    For a trade: the request sent to the broker, in short JSON (cut to 400 characters).

  • status integer or null required

    The HTTP status the caller got.

  • retcode integer or null required

    For a trade the broker answered: its return code.

  • result string or null required

    For a trade: the broker's answer in words with the order and deal tickets, or the error when it did not answer.

  • latency_ms integer or null required

    For a trade: the broker round trip in milliseconds.

  • request_id string or null required

    The X-Request-Id of the request that caused the row; the same id is on its log lines.

  • ip string or null required

    The client IP, recorded for sign-ins, wrong passwords and lockouts.

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 "$TERMLESS_URL/api/v1/audit?account=pepperstone-12345678&kind=trade&request_id=bot-20261003-0042&q=xauusd&limit=100" \
  -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}/audit", headers=auth, params={"account": "pepperstone-12345678", "kind": "trade", "request_id": "bot-20261003-0042", "q": "xauusd", "limit": 100})
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}/audit?account=pepperstone-12345678&kind=trade&request_id=bot-20261003-0042&q=xauusd&limit=100", 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}/audit?account=pepperstone-12345678&kind=trade&request_id=bot-20261003-0042&q=xauusd&limit=100`, {
  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
[
  {
    "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"
  }
]

Get connection history

GET/api/v1/accounts/{id}/events

The account's connection events, newest first: started, connected (with the broker's build and how long it had been disconnected), reconnected, lost (why: connection lost: ... with the cause, and how long it had been connected), connect_failed, login_rejected, stopped. Kept 90 days or 50,000 rows. Page with before = the id of the last row seen.

Scope read

Path parameters

  • id string required

    Account id.

Query parameters

  • before integer

    Only rows with an id below this: the id of the last row of the previous page.

  • limit integer default 100 min 1, max 1000

    Most rows to return, at most 1000.

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 Events, newest first.

A JSON array of ConnectionEvent objects.

  • id integer required

    Row id, increasing. Page with before.

  • at integer required

    When it happened, unix milliseconds (UTC).

  • account string required

    Account id.

  • kind string required

    started 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_rejectedstopped
  • reason string or null required

    The build for connected and reconnected, the error for lost, connect_failed and login_rejected.

  • duration_ms integer or null required

    For connected and reconnected: how long the account had been disconnected. For lost and stopped: how long it had been connected.

  • quiet_since integer or null required

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

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.
  • 404 not_found No such account, symbol, ticket, key or route.
  • 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/accounts/pepperstone-12345678/events?limit=100" \
  -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}/accounts/pepperstone-12345678/events", headers=auth, params={"limit": 100})
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}/accounts/pepperstone-12345678/events?limit=100", 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}/accounts/pepperstone-12345678/events?limit=100`, {
  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
[
  {
    "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: 2 pings unanswered in a row (the broker keeps the socket open but has stopped answering)",
    "duration_ms": 73284110,
    "quiet_since": 1790968282572
  }
]

Get the equity curve

GET/api/v1/accounts/{id}/equity

Balance, equity, margin and profit sampled about once a minute while the account is connected (the first sample right after connecting), oldest first, for the last hours hours, and gaps: the periods in that window when the account was not connected (to: null while it still is not), so a chart can break there. Kept 7 days (168 hours). Read from the database: an account that is disconnected or turned off still shows its curve.

Scope read

Path parameters

  • id string required

    Account id.

Query parameters

  • hours integer default 24 min 1, max 168

    How far back, 1 to 168.

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

A EquityCurve object.

  • account string required

    Account id.

  • hours integer required

    The window asked for, ending now.

  • every_s integer required

    Seconds between samples while connected (60).

  • samples array of EquitySample required

    Oldest 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
    • at integer required

      Unix milliseconds (UTC).

    • balance number required

      Balance.

    • equity number required

      Equity, with live profit.

    • margin number required

      Margin in use.

    • profit number required

      Floating profit of open positions.

  • gaps array of EquityGap required

    Oldest 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
    • from integer required

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

    • to integer or null required

      When it connected again, unix milliseconds (UTC). null while it still is not.

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.
  • 404 not_found No such account, symbol, ticket, key or route.
  • 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/accounts/pepperstone-12345678/equity?hours=24" \
  -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}/accounts/pepperstone-12345678/equity", headers=auth, params={"hours": 24})
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}/accounts/pepperstone-12345678/equity?hours=24", 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}/accounts/pepperstone-12345678/equity?hours=24`, {
  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
{
  "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
    }
  ]
}

See a key's traffic

GET/api/v1/keys/{id}/traffic

One key's last requests, newest first (a ring of the last 500, in memory since the server started), each with its route template, path and query (key= removed), status, time, bytes and address, and its open streams with what they have sent.

Scope admin

Path parameters

  • id string required

    Key id.

Query parameters

  • limit integer default 100 min 1, max 500

    Most requests to return, at most 500.

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 key's traffic.

A KeyTrafficLog object.

  • key_id string required

    Key id.

  • name string required

    Key name.

  • time_ms integer required

    Now, unix milliseconds (UTC).

  • since_ms integer required

    When the server started.

  • requests array of TrafficRequest required

    Its last requests, newest first (up to 500 are kept).

    TrafficRequest fields
    • at integer required

      When it was answered, unix milliseconds (UTC).

    • method string required

      HTTP method.

    • route string required

      Method and the route template it matched, for example GET /api/v1/accounts/{id}/quotes; (no route) when none matched.

    • path string required

      The path asked for, with its query (key= removed, cut to 300 characters).

    • status integer required

      HTTP status answered.

    • latency_ms number required

      Time to the response's headers, milliseconds.

    • bytes integer required

      Response body bytes (0 for a stream; see its own counters).

    • ip string required

      The client's address.

    • account string or null required

      The account in the path, if any.

  • streams array of StreamConnection required

    Its open streams.

    StreamConnection fields
    • id integer required

      A number for the stream, unique until the server restarts.

    • kind string required

      sse for /stream, ws for /ws.

      ssews
    • who object required

      Fields
      • kind string required

        key, or dashboard for the dashboard's own streams.

        keydashboard
      • key_id string

        The key's id (absent for the dashboard).

      • name string required

        The key's name, or dashboard.

    • ip string required

      The client's address (behind --trust-proxy, the proxy header's).

    • user_agent string required

      The client's User-Agent (cut to 200 characters).

    • account string required

      The account streamed.

    • symbols array of string required

      The symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).

    • events array of string required

      What it asked for with events=.

      ticksbarstradesaccountpositionsorders
    • batch_ms integer required

      SSE batch window asked for; 0 writes every frame at once.

    • opened_at integer required

      When it opened, unix milliseconds (UTC).

    • sent object required

      Fields
      • messages integer required

        Everything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).

      • bytes integer required

        Bytes written, heartbeats included.

      • ticks integer required

        Tick messages.

      • events integer required

        trade, account, positions and orders messages.

    • last_sent_at integer or null required

      When the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.

    • rate_per_s number required

      Messages a second over the last 10 s (or over the stream's life when it is younger).

    • coalesced integer required

      Ticks this stream never saw because it fell behind (the newest per symbol was kept).

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.
  • 404 not_found No such account, symbol, ticket, key or route.
  • 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/keys/key_3f9a1c07/traffic?limit=100" \
  -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}/keys/key_3f9a1c07/traffic", headers=auth, params={"limit": 100})
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}/keys/key_3f9a1c07/traffic?limit=100", 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}/keys/key_3f9a1c07/traffic?limit=100`, {
  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
{
  "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
    }
  ]
}

See who is connected

GET/api/v1/connections

What leaves the server and to whom, live: every open stream (who opened it, from where, for which account, symbols and events, and what it has sent, with its rate over the last 10 s), every key's requests (1 h and 24 h counts, errors, bytes, busiest routes, last request; zeros when unused) and the dashboard's, counted apart. In memory since the server started (since_ms); nothing is persisted and key secrets never appear.

Scope admin

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

A Connections object.

  • time_ms integer required

    Now, unix milliseconds (UTC).

  • since_ms integer required

    When the server started: every counter here begins then; nothing is kept across a restart.

  • streams array of StreamConnection required

    Open streams, newest first.

    StreamConnection fields
    • id integer required

      A number for the stream, unique until the server restarts.

    • kind string required

      sse for /stream, ws for /ws.

      ssews
    • who object required

      Fields
      • kind string required

        key, or dashboard for the dashboard's own streams.

        keydashboard
      • key_id string

        The key's id (absent for the dashboard).

      • name string required

        The key's name, or dashboard.

    • ip string required

      The client's address (behind --trust-proxy, the proxy header's).

    • user_agent string required

      The client's User-Agent (cut to 200 characters).

    • account string required

      The account streamed.

    • symbols array of string required

      The symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).

    • events array of string required

      What it asked for with events=.

      ticksbarstradesaccountpositionsorders
    • batch_ms integer required

      SSE batch window asked for; 0 writes every frame at once.

    • opened_at integer required

      When it opened, unix milliseconds (UTC).

    • sent object required

      Fields
      • messages integer required

        Everything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).

      • bytes integer required

        Bytes written, heartbeats included.

      • ticks integer required

        Tick messages.

      • events integer required

        trade, account, positions and orders messages.

    • last_sent_at integer or null required

      When the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.

    • rate_per_s number required

      Messages a second over the last 10 s (or over the stream's life when it is younger).

    • coalesced integer required

      Ticks this stream never saw because it fell behind (the newest per symbol was kept).

  • keys array of KeyTraffic required

    Every key in the keys table.

    KeyTraffic fields
    • key_id string required

      Key id.

    • name string required

      Key name.

    • scope string required

      read, trade or admin.

      readtradeadmin
    • accounts array or null required

      Accounts it is limited to; null = every account.

    • streams_open integer required

      Streams it has open now.

    • stream_bytes integer required

      Bytes its open streams have sent.

    • requests_1h integer required

      Requests in the last hour.

    • requests_24h integer required

      Requests in the last 24 hours (since the start, if that is later).

    • errors_1h integer required

      Requests in the last hour answered 400 or above.

    • bytes_out_1h integer required

      Response body bytes in the last hour (streams not included).

    • last_request_at integer or null required

      Its last request, unix milliseconds (UTC). null if none since the start.

    • last_ip string or null required

      The address of its last request.

    • top_routes_1h array of object required

      Its busiest routes in the last hour, at most 5.

      Fields
      • route string required

        Method and route template.

      • count integer required

        Requests in the last hour.

  • dashboard object required

    Fields
    • sessions_active integer required

      Dashboard sessions signed in.

    • streams_open integer required

      Streams the dashboard has open.

    • stream_bytes integer required

      Bytes those streams have sent.

    • requests_1h integer required

      Dashboard requests in the last hour.

    • requests_24h integer required

      Dashboard requests in the last 24 hours.

    • errors_1h integer required

      Of them, answered 400 or above.

    • bytes_out_1h integer required

      Response body bytes in the last hour.

    • last_request_at integer or null required

      The dashboard's last request, unix milliseconds (UTC).

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 "$TERMLESS_URL/api/v1/connections" \
  -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}/connections", 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}/connections", 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}/connections`, {
  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
{
  "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
  }
}