View as Markdown

API reference / Account REST API (/users/current)

Health, uptime, snapshot and audit trail

Account REST API (/users/current). Generated from the OpenAPI document the services export (/openapi.json).

Samples use the placeholders YOUR_API_KEY and YOUR_ACCOUNT_ID. Paste a sandbox key (twsk_…) to fill them in and to use Try it. It stays in this browser tab and is only sent to the sandbox, never to the live API.

Try it is off in this build: No sandbox URL is configured for this build of the docs.

GET /users/current/accounts/{account_id}/audit

Account Audit Auth: auth-token

The newest audit entries of this account's terminal, oldest first: {"entries": [...]}, limit 1..1000 (default 100). A row that held odd values (a lone surrogate, NaN) is listed escaped with sanitized: true; one that still can't be encoded is listed as {seq, ts_utc, action, error: "unreadable_entry"}. One bad row never fails the list. broker_time is the broker's wall clock with its true UTC offset when that is known, else with no offset.

Parameters of GET /users/current/accounts/{account_id}/audit
ParameterInTypeDescription
account_id requiredpathstring
limitqueryinteger

Responses

  • 200 Successful Response
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 422 The body is not valid JSON, or a typed query parameter is not valid. details lists each one. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/audit' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/audit",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/audit");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/health

Get the account's health Auth: auth-token

The account's truthful health: connected, synchronized, prices moving. status is healthy, degraded, stale, disconnected or down, and reason_codes says why. healthStatus is the same in camelCase. Prices that stopped moving (the market is likely closed) are degraded with prices_stale, while connectedToBroker stays true. The answer is 200 while reads work and 503 otherwise, with the same body. When a fresh terminal probe is slow, the last probe's result is returned with cached: true, checked_at (when it was probed) and evidence_age_s. Evidence older than 60 s is never served.

Parameters of GET /users/current/accounts/{account_id}/health
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Healthy or degraded. Reads work. · Health
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 Not healthy. The same body says why. · Health

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/health' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/health",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/health");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/snapshot

Account Snapshot Auth: auth-token

Account information, positions, orders, health and server time in one read (MT4 and MT5). Agents reach it as GET /v1/agent/accounts/{id}/snapshot. Body: {account_id, platform, as_of, complete, terminal_connected, account_information, positions, orders, health, server_time}. as_of is when the snapshot was complete (UTC); complete is true when every section is ok; terminal_connected is null when it is not known. Each section is {status, read_at, age_ms, data, error?}. status is ok (read from a terminal connected to its broker), stale (read, but the terminal was not connected, so values may be out of date) or unavailable (data is null and error is {error, message}); health and server_time are ok whenever they could be read. Sections are read one after another: compare read_at when that matters. data has the same shape as the individual routes; server_time gives brokerUtcOffsetMinutes (null until known, never assumed to be 0). Always 200 (an unreadable section says so); 503 only if nothing could be read.

Parameters of GET /users/current/accounts/{account_id}/snapshot
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Successful Response
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/snapshot' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/snapshot",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/snapshot");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /users/current/accounts/{account_id}/uptime

Get account uptime Auth: auth-token

The account's measured availability over the last days (1 to 90, default 30), with outages, their causes and a daily breakdown. Only time when the terminal was meant to run counts.

Parameters of GET /users/current/accounts/{account_id}/uptime
ParameterInTypeDescription
account_id requiredpathstring
daysqueryinteger

Responses

  • 200 Successful Response
  • 400 Bad request. On the account API paths a body or query validation failure is a 400 ValidationError with details: [{parameter, message}]. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account or resource in the path does not exist, or this credential cannot see it. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/users/current/accounts/YOUR_ACCOUNT_ID/uptime' \
  -H 'auth-token: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/users/current/accounts/YOUR_ACCOUNT_ID/uptime",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/users/current/accounts/YOUR_ACCOUNT_ID/uptime");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.