# Termless > Keep MetaTrader 5 accounts connected around the clock and use them over HTTP. Termless keeps MetaTrader 5 accounts logged in on a Linux box and serves one HTTP API for prices, candles, account state and trading, with live SSE and WebSocket streams, API keys with read, trade and admin scopes, and a dashboard. Every URL below is relative to the server's origin. Send `Authorization: Bearer ` on every API call. Times from the market are in the trade server's clock; subtract the account's `server_offset` for UTC. Trades the broker refuses answer 422 with the trade result and a `retcode`. Send an `Idempotency-Key` on every trade call and retry with the same key: the stored answer is replayed (`Idempotent-Replayed: true`) and the broker never sees a trade twice. Every response carries `X-Request-Id`; the audit trail (`GET /api/v1/audit`) records every write with it. ## Read first For a bot that reads prices and trades, these 5 pages are enough (about 19,000 tokens together): [Quickstart](/docs/quickstart.md), [Conventions](/docs/conventions.md), [Trading safely](/docs/trading.md), [Health checks for bots](/docs/health-checks.md), [Errors and retries](/docs/errors.md). Fetch any other page, or a route's reference page, when a task needs it. Do not load /llms-full.txt into a working context: it is every page at once (about 190,000 tokens), for search indexes and offline copies. ## Guides - [Introduction](/docs/index.md): MetaTrader 5 without the terminal. Termless keeps your MT5 accounts logged in on a Linux box and gives every app, script and AI agent one HTTP API for prices, candles, account state and trading. (about 1,600 tokens) - [Quickstart](/docs/quickstart.md): From a fresh key to a live price stream and a demo trade in five short steps. (about 2,500 tokens) - [Finding your broker's server](/docs/find-your-server.md): Where to find your MT5 server name and your broker's web terminal address, in the broker's client area, on its website or in a prop firm's dashboard, and how to add it to Termless. (about 1,100 tokens) - [Authentication and scopes](/docs/authentication.md): API keys with one scope each, limited to the accounts they need; the dashboard's own session; and how the two differ. (about 1,900 tokens) - [Conventions](/docs/conventions.md): The rules every route follows: two clocks, lots, prices, symbols, timeframes, ids, request ids, cursors, why a trade happened and the one error shape. (about 2,300 tokens) - [Streaming prices](/docs/streaming.md): Every tick pushed to you over Server-sent events or a WebSocket, the trade, account, positions and orders events a bot should read instead of polling, which trade events a UI should show, how a client that dropped picks up the trades it missed, what a status event means, how the stream ends, and what happens when you fall behind. (about 7,900 tokens) - [Trading safely](/docs/trading.md): Market and pending orders, stops and trailing them, partial closes, comments and magic numbers, the history of deals and orders, how to read a refusal, real-money accounts, and the Idempotency-Key that lets a bot retry without ever doubling a position. (about 6,700 tokens) - [Setting up a bot](/docs/bots.md): How to wire a trading bot to Termless so it stays right when the broker link blips: one login for prices and orders, one key per program, an Idempotency-Key per order, what to do with an unconfirmed trade, timeouts, and where to watch the link. (about 1,600 tokens) - [Health checks for bots](/docs/health-checks.md): Ask /ready before you send an order and act on what it says, read /status for uptime, outages and order latency over time, scrape /metrics with Prometheus, and watch it all on the dashboard's Health page. (about 3,600 tokens) - [Errors and retries](/docs/errors.md): Every HTTP status and error code the API answers with, what each one means, which ones to retry (and how a trade is retried safely), request ids, and the full list of MetaTrader return codes. (about 3,500 tokens) - [Limits and lockouts](/docs/limits.md): Every cap in the API in one place: request sizes, stream counts, timeouts, lockouts and the broker's own limits. (about 3,200 tokens) - [Activity and trails](/docs/trails.md): The audit trail of every write and security event, each account's connection history, the equity curve, who is connected and what they receive right now, and the request id that ties a bot's log, the server log and the trail together. (about 3,200 tokens) - [Running the server](/docs/running.md): Installing termlessd on Linux as a system service, its settings, running it behind a proxy, the data folder, adding an account, upgrading, the doctor, and reading diagnostics, the trails, crash reports and undecoded frames. (about 5,700 tokens) - [Running in Docker](/docs/docker.md): Run termlessd as a container with Docker Compose. The files in the release folder, the first start, settings, putting it on your domain with Caddy or a Cloudflare Tunnel, everyday commands, upgrades, backups and moving over from systemd. (about 3,100 tokens) - [Reaching Termless from elsewhere](/docs/remote-access.md): termlessd listens on its own machine only. The four ways to reach it from somewhere else, from an SSH tunnel to a public HTTPS address, and how a bot on another server calls it. (about 1,300 tokens) - [Putting Termless on your own domain](/docs/domains.md): Serve the dashboard and the API at an address such as https://termless.example.com. The DNS record, then one of Caddy, nginx, a Cloudflare Tunnel or Tailscale, the settings termlessd needs behind each, an optional sign-in in front, and how to check it worked. (about 2,900 tokens) - [The MetaTrader5 Python mapping](/docs/python-mapping.md): Every function of the official MetaTrader5 Python package and the termlessd route that does the same, with what differs. (about 2,300 tokens) - [The MetaTrader5 order_send mapping](/docs/order-send.md): How the official MetaTrader5 Python package's order_send request maps onto Termless, so an existing script ports over without rewriting its trading code. (about 1,800 tokens) - [For AI agents](/docs/agents.md): How an agent should use this API without doing harm, the Idempotency-Key it sends on every trade, the trail it reads back, and how to read these docs without filling its context. (about 3,400 tokens) - [What's new](/docs/releases.md): What changed in each Termless release, newest first, and when the database changed (which decides whether an older version can run on a newer one's data). (about 9,000 tokens) ## Reference - [API reference](/docs/reference.md): Every route, grouped the way you use them. Each one with its parameters, every field of the request and response, every error, and copy-ready calls in curl, Python and JavaScript. (about 1,200 tokens) - [Accounts](/docs/reference/accounts.md): The MT5 accounts this server keeps connected around the clock. Each has an id you choose, used in every account URL. A route that needs the broker answers 503 while the account reconnects (it waits up to 2 s first) or while it is turned off. On an account the broker reports as real money, trading is off until an admin sets `trade_real: true`. (about 12,000 tokens) - [Market data](/docs/reference/market.md): Symbols, their full specs, quotes, candles, the recent ticks the server kept and order books. Times are in the trade server's clock; subtract the account's server_offset for UTC. (about 13,000 tokens) - [Streaming](/docs/reference/streaming.md): Live prices pushed to you. Server-sent events for browsers and simple scripts, a WebSocket when you want to change symbols on the fly. Both end when the account is deleted or logs in with new details; reconnect to follow it. Trade events are numbered per account, and the numbering survives a restart: a client that dropped resumes with `Last-Event-ID` or `?after=` and gets what it missed first (from the last 1,024), or a `resync` when that cannot be done. After a gap (the broker link was down, the server stopped, the account's session started again) the deals made meanwhile come as trade events marked `caught_up`, then a `resync`. `GET /trades?after=` serves the same numbering to clients that poll. (about 5,400 tokens) - [Trading](/docs/reference/trading.md): Positions, pending orders, deal and order history, the calls that change them, and margin, profit and order checks that send nothing (GET /calc, POST /order_check). Every change returns a trade result with the broker's return code: 200 when placed or done, 422 when the broker refused it, with `warnings` when something in the request was changed or cannot be kept. `comment` takes up to 255 characters; the broker keeps 31. `magic` cannot be sent to the broker (the web protocol has no field for it). For a market or pending order, Termless keeps both and puts them back on its positions, orders, deals and stream events. Positions, orders and deals carry `reason` (web, sl, tp, stop_out, ...). On an account the broker reports as real money, the routes that trade answer 403 `real_account` until an admin sets `trade_real: true` on it. (about 28,000 tokens) - [Trails](/docs/reference/trails.md): 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). (about 5,700 tokens) - [API keys](/docs/reference/keys.md): Keys for apps, scripts and agents. Each has one scope; a read or trade key can be limited to some accounts. The full key is shown once, when you create it. (about 4,100 tokens) - [Health, setup and session](/docs/reference/health.md): 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. (about 6,300 tokens) - [Broker servers](/docs/reference/servers.md): The directory of known broker servers and a check for any address. Used when adding an account. (about 3,600 tokens) - [Diagnostics](/docs/reference/diagnostics.md): What the server itself is doing: the process, each account's connection, frames the client could not decode, recent warnings, crash reports and the log. Undecodable frames are the first sign of a broker build the client does not understand. Each (account, command, kind) keeps at most 5 bodies an hour; the rest are only counted. Kept ones are also appended to `/captures/undecoded.jsonl`, and the newest of them are read back at start, so a restart does not empty the list (the counters start again). Admin only. (about 4,600 tokens) - [Objects](/docs/reference/objects.md): Every JSON shape the API sends or takes. (about 40,000 tokens) ## Machine-readable - [OpenAPI 3.1](/api/openapi.json): every route, parameter, schema and example as JSON, for building a client (about 150,000 tokens; read a route's reference page instead) - [Everything as one Markdown file](/llms-full.txt): for a search index or an offline copy (about 190,000 tokens)