Guides
Step-by-step guides for the fxapis MetaTrader 5 API: complete programs in Python, Node.js, PHP, C#, Go, Java and Ruby, connecting accounts, multi-account orders, trade copiers, idempotent orders, TradingView alerts, AI agents, prop-firm monitoring and migrating from MetaApi.
Practical guides for building on fxapis, from a first order in your language to
a trade copier. Each one has code you can run against a broker demo
account — every fxapis key, including fx_test_ keys, reaches a real broker.
New here? Start with the Quickstart, then pick your language.
Place orders from your language
Complete programs that connect an MT5 account, bring it online, place a market order with an idempotency key, handle every failure correctly, read positions, close the trade and disconnect. No MetaTrader terminal on your side.
Python
With requests (or httpx) — on Linux, macOS or Windows.
Node.js and TypeScript
With the built-in fetch, fully typed, no dependencies.
PHP
With Guzzle — for Laravel, Symfony, queue workers and cron jobs.
C# and .NET
With HttpClient and System.Text.Json on .NET 8.
Go
With net/http — a single static binary, standard library only.
Java
With java.net.http.HttpClient and Jackson on Java 17+.
Ruby
With Net::HTTP — for Rails, Sidekiq or a plain script.
Linux and macOS
Why the official MetaTrader5 package needs Windows, and how to trade over HTTP instead.
Build it well
Connect MT5 accounts
Server names, trading versus investor passwords, 2FA, safe credential handling and account states.
Idempotent MT5 orders
Never double-fill on retry: how Idempotency-Key works and how to choose keys.
One order across many accounts
The same trade on many accounts — up to 500 on Enterprise (Starter 10, Scale 100) — with barrier policies and per-account results.
Build an MT5 trade copier
Detect a master's deals, fan out to followers, mirror closes and stop changes.
Connect other tools
TradingView alerts
Turn TradingView alerts into MT5 orders with a webhook — no EA, no VPS.
MCP server for AI agents
Let Claude, Cursor, VS Code and other agents work with MT5 accounts, safely.
Run a business on it
Monitor prop-firm accounts
Daily loss and drawdown checks from deals and positions, with narrow keys.
Migrate from MetaApi
Concepts, equivalent calls, and what has no equivalent yet.
For endpoint details, see the API reference; for every error code, see Errors.
Signals and click-to-trade
A complete integration for apps whose members approve each trade: connecting their accounts, instant execution on approval, showing their trades, and closing.
Place MetaTrader 5 orders from Python — no MetaTrader installed
A complete Python program that connects an MT5 account, places a market order with an idempotency key, handles every failure correctly, reads positions and closes the trade — over plain HTTP with requests, on Linux, macOS or Windows.