Postman, TradingView and n8n Templates for the MT5 API
Explore the fxapis MT5 API in Postman, send TradingView alerts straight to MT5, and automate trades with n8n — ready-made templates from fxapis-integrations.
In short
- fxapis-integrations holds a Postman collection for every API endpoint, ready-to-paste TradingView alert messages, and importable n8n workflows.
- The Postman collection adds a fresh Idempotency-Key to every POST and PATCH, so exploring by hand cannot double an order.
- A TradingView hook turns an alert into an MT5 order with no code: point the alert's webhook at the hook and paste a template as its message.
- Every template is meant for a broker demo account first: an alert hook places real orders on the accounts it points at.
On this page
Not everything that talks to MetaTrader 5 needs a program. fxapis-integrations collects the low-code ways in: a Postman collection for exploring the API, ready-to-paste TradingView alert messages, and n8n workflows for automations you would rather build on a canvas.
Postman: try every endpoint by hand
postman/fxapis.postman_collection.json is a Postman collection covering every public endpoint — connecting accounts, bringing them online, market and pending orders, positions, history and multi-account orders — with a ready-to-send example body on every request that takes one. It is generated from the live API spec, one folder per section of the API.
- In Postman, choose Import and select the file.
- Open the collection's Variables and set
apiKeyto your key. Fill inaccountIdand the other ids as you go. - Send Connect an MT5 account with a demo login, then Bring an account online, then poll its status.
The collection's pre-request script gives every POST and PATCH a fresh Idempotency-Key, so clicking Send twice on an order cannot open two positions. If the API changes, node postman/generate.mjs regenerates the collection from the live spec.
TradingView: alerts straight to MT5
A TradingView hook is a URL that turns each alert into an MT5 order — no bridge, no Expert Advisor, no VPS. Create one in the console under TradingView, choose the accounts and the default volume, and use the URL as the alert's Webhook URL. Then paste a message from the tradingview/ folder:
{ "action": "buy", "symbol": "{{ticker}}", "volume": "0.20", "sl": "2310.5", "tp": "2385", "id": "{{ticker}}-{{timenow}}" }
There are templates for indicators (one alert per direction: buy, sell, close, close everything), for strategies (one alert that handles entries, exits and reversals from {{strategy.market_position}}), and in plain text for when JSON is more than you need. The id makes a repeated alert harmless: the same id within a minute is recognised as a duplicate, not a second order.
Two cautions from the templates' notes. A hook places real orders on whatever accounts it points at, so fire your first test alert at a demo account. And TradingView sizes strategies in units, not lots — so the strategy template sends no volume and uses the hook's default, and anything above 1,000 lots is refused as a units mistake. The TradingView guide has the full field reference.
n8n: automations on a canvas
fxapis has no official n8n node yet, so the two templates in n8n/ use n8n's built-in HTTP Request node:
- TradingView webhook to market order — receives an alert-shaped body, places a market order, and responds with the result.
- Scheduled flat-all — every weekday at 21:00 UTC, lists an account's positions and closes each one.
Import either file from Workflows → Import from File. The API key is read from an environment variable ($env.FXAPIS_API_KEY), so it never lives inside the workflow JSON; the n8n notes cover instances where environment access is switched off.
The rules every template follows
- An idempotency key on every order — the Postman script and the n8n templates send
Idempotency-Key; the TradingView templates sendid. - Volumes and prices are strings, and stops and targets are absolute prices, not pips.
- The hook URL and the API key are credentials. Keep them out of anything you commit, screenshot or share.
- Demo accounts first.
fx_test_is a label, not a sandbox.
Where to go next
- TradingView alerts to MT5 on the website, and the TradingView guide in the docs.
- The API reference — the same requests as the Postman collection, with samples in 13 languages.
- Runnable examples when you are ready to write code.