# Testing

> MetaTrader API docs for developers and coding agents. Last updated: 2026-10-15. Index: https://www.metatraderapi.net/llms.txt
>
> © 2026 Apex Vanguard Dynamics LLC. You, and the software tools and AI agents working for you, may read and use this documentation to build, run and support integrations with MetaTrader API; its code examples may be copied into your own software. Republishing or redistributing the documentation, in whole or in substantial part, is not permitted. Terms: https://www.metatraderapi.net/en/terms/

## There is no sandbox

There are no test keys, no simulated mode and no free trial. Requests always go to a real broker account. That is also the safest way to test: the same code runs unchanged later.

## Test with a broker demo account

1. Open a **demo account** at the broker you will use. Almost every MetaTrader broker offers free demo accounts with virtual money; demo servers usually have `Demo` or `Trial` in their name (e.g. `ICMarketsSC-Demo`, `Exness-MT5Trial`).
2. Connect it like a live account (dashboard, `POST /v1/seats` or `/ConnectEx`). It uses a normal paid seat.
3. Run your code against it. `/AccountSummary` reports `"type": "demo"`.
4. To go live, connect the live account (a different server name and login) and switch the account id and key. Nothing else changes.

A removed seat stays paid until the end of the billing month and is reused by your next connection, so swapping a demo account for the live one later costs nothing extra that month.

## Checks worth automating

- `/Ping` answers `"pong"` when the key, the account id and the account's API connection work (it does not check the broker).
- `/CheckConnect` answers whether the account is connected to its broker right now.
- `/ConnectState?id=` gives the connection status and the reason for an `ERROR`.

## Testing trades safely

- Use the smallest volume the symbol allows (`symbolGroup.minVolume` in `/SymbolParams`, lots x 10000).
- Always send a `clientOrderId`, and tag test orders with an `expertId` so you can find and close them (`/OpenedOrders`).
- Test the refusal path too: send an order with a stop loss too close to the price and check that your code reads `state` (`10016`) instead of treating HTTP 200 as success.
