Developer API Hub

MT5 REST API. Try it live.

Connect Python, JavaScript, C#, Go, Java, C++, Rust or Ruby to MetaTrader. Run a real MT5 demo below. MetaRPC hosts the terminals, so your application can run on Linux, macOS or Windows. MT4 APIs are also available.

Guests can try the demo without signing up. TRIAL limits apply; signed-in runs use your balance.

Run a complete MT5 demo

Choose a language and run the complete example: create a fresh demo account, connect, read account data, open a 0.01 EURUSD demo position, inspect it, close it, verify the close, and disconnect. Only demo funds are traded. Your own API key uses service credit.

When you are signed in, your API key is used automatically; guests use TRIAL. Trial limits apply. With your own key, normal terminal billing applies until disconnection.

Language

Run Python or JavaScript here, or download the example to run locally. Python loads its browser runtime on the first run. Every example uses REST and calls Disconnect during cleanup.

Run locally · Python 3.10+
Run locallyPython 3.10+ · No API SDK or extra packages
python mt5_demo.py

Local downloads use TRIAL by default. Set MRPC_API_KEY to use your own key. A five-minute terminal expiry is requested as a cleanup fallback.

Python · REST
Loading example…

$4 per terminal/month. As low as $1 at volume.

Show example workflow

MT5 REST API quickstart

Choose a language and run the complete example: create a fresh demo account, connect, read account data, open a 0.01 EURUSD demo position, inspect it, close it, verify the close, and disconnect. Only demo funds are traded. Your own API key uses service credit.

The complete demo lifecycle

  1. /DemoAccount/Open

    Create a MetaQuotes demo account. Keep the returned login details private. This step does not fund a real trading account.

  2. /ConnectEx

    Connect the demo account and keep its terminal ID. The API key identifies your MRPC account; the terminal ID identifies this connection.

  3. /AccountSummary

    Read the connected account. A successful response confirms the integration can retrieve data; this request does not place a trade.

  4. /OrderSend

    Buy 0.01 lot of EURUSD. Check the broker return code: HTTP 200 alone does not confirm execution.

  5. /OpenedOrders

    positionInfos contains open positions; openedOrders contains pending orders. Use the position ticket from this response for closing.

  6. /OrderClose → /OpenedOrders

    Close the position by its ticket and volume, then read OpenedOrders again to confirm it is gone.

  7. /Disconnect

    Disconnect even if a previous request fails. The downloadable examples use cleanup logic and request a five-minute terminal expiry as a fallback.

Authenticate and read an account

Send your API key in the APIKey header. ConnectEx returns terminalInstanceGuid: use that value in the id header for AccountSummary and Disconnect. These are different identifiers. The request below reads an already connected account.

curl --request GET "https://mt5.mrpc.pro/AccountSummary" \
  --header "APIKey: YOUR_API_KEY" \
  --header "id: YOUR_TERMINAL_ID"

Disconnect after the request

Call Disconnect in a finally block, including when a read fails. The demo requests a five-minute terminal expiry as a cleanup fallback. Download the complete example above for your programming language.

Troubleshoot a failed connection

Check the API key, broker server name, login and password. If ConnectEx fails without returning a terminal ID, do not continue to AccountSummary. Check your service balance and trial limits; do not expose credentials in logs.

Run a live demo →
MT5 API · 0:46

MT5 API. From browser to code.

A real demo. Four API steps. One downloadable example.

Run a live demo Watch on YouTube Watch video and read the transcript
Read the transcript

MT5 API. From browser to code. A real demo. Four API steps. One downloadable example.

Start with the browser demo Choose Python or JavaScript. The guest demo needs no signup.

Open. Connect. Read. Disconnect. The console shows all four steps completing against the live MT5 API.

See the response Demo-account data only. This is not a paid deposit or a real-money balance.

Take the example into your app Download the code. Use your own API key for your application.

Try MT5 REST API mrpc.pro/api Browser demo • Python • JavaScript

All tutorials →

API Authentication

Get Your Free API Key

Connect to mt5.mrpc.pro, mt4.mrpc.pro, ct.mrpc.pro and tl.mrpc.pro with your personal API key. Register at https://mrpc.pro/signup to receive your key after email verification. Usage is charged per minute at an hourly rate; any welcome credit is shown in your dashboard.

Usage-based API access No Credit Card Required Instant Token Generation

Interactive Client Explorers

Requires sign-in. All requests execute with your authenticated APIKey. Connect directly via /ConnectEx (which auto-generates your session token), then stream in real time.

MT5
REST + WebSockets

MT5 Client API Explorer

Authenticated playground for MetaTrader 5. Connect directly via /ConnectEx (auto-generating your session ID), inspect balance, open positions and pending orders, and stream live ticks.

Requires Sign-In • APIKey Auth Launch Explorer
MT4
REST + WebSockets

MT4 Client API Explorer

Authenticated playground for MetaTrader 4. Connect directly via /ConnectEx (auto-generating your session ID), query account margin and open positions, and stream live quotes.

Requires Sign-In • APIKey Auth Launch Explorer
CT
REST + WebSockets

cTrader Client API Explorer

Authenticated playground for cTrader. Sign in with your cTrader tokens via /Authenticate, pick an account, connect, read the balance and open positions, trade, and stream live quotes.

Billed at 50% of the MetaTrader price.

Requires Sign-In • APIKey Auth Launch Explorer
TL
REST + WebSockets

TradeLocker Client API Explorer

Authenticated playground for TradeLocker. Sign in with your email, password and server via /Authenticate, pick an account, connect, read the balance and open positions, trade, and stream live quotes.

Billed at 50% of the MetaTrader price.

Requires Sign-In • APIKey Auth Launch Explorer
COPY
gRPC + REST

Trade Copier API Explorer

Authenticated playground for cross-broker trade replication. Create and manage copier instances via /Start, set risk models (LotMultiplier, FixedLot, Equity), and stream real-time trade logs.

Requires Sign-In • APIKey Auth Launch Explorer

OpenAPI 3.0 (Postman / Insomnia)

JSON Spec

Import full REST endpoint contracts into Postman, Insomnia, or custom API gateways in one click.

MetaTrader 4 Client SDKs

Official, open-source client SDKs for MetaTrader 4 across 8 programming languages.

8 Languages • MT4 SDKs
C# MT4

CSharpMT4

dotnet add package MetaRPC.MT4
Python MT4

PyMT4

pip install MetaRpcMT4
Go MT4

GoMT4

go get github.com/MetaRPC/GoMT4/package
Java MT4

JavaMT4

git clone https://github.com/MetaRPC/JavaMT4.git && cd JavaMT4 && ./gradlew publishToMavenLocal
C++ MT4

CppMT4

git clone https://github.com/MetaRPC/CppMT4.git
Preview: returns simulated results, does not trade
Rust MT4

RustMT4

git clone https://github.com/MetaRPC/RustMT4.git
Preview: returns simulated results, does not trade
Ruby MT4

RubyMT4

git clone https://github.com/MetaRPC/RubyMT4.git
Preview: returns simulated results, does not trade
Node.js MT4

NodeMT4

npm install github:MetaRPC/NodeMT4 @grpc/grpc-js

MetaTrader 5 Client SDKs

Official, open-source client SDKs for MetaTrader 5 across 8 programming languages.

8 Languages • MT5 SDKs
C# MT5

CSharpMT5

dotnet add package MetaRPC.MT5
Python MT5

PyMT5

pip install MetaRpcMT5
Go MT5

GoMT5

go get github.com/MetaRPC/GoMT5/package
Java MT5

JavaMT5

git clone https://github.com/MetaRPC/JavaMT5.git && cd JavaMT5 && mvn install -DskipTests
C++ MT5

CppMT5

git clone https://github.com/MetaRPC/CppMT5.git
Preview: returns simulated results, does not trade
Rust MT5

RustMT5

git clone https://github.com/MetaRPC/RustMT5.git
Preview: returns simulated results, does not trade
Ruby MT5

RubyMT5

git clone https://github.com/MetaRPC/RubyMT5.git
Preview: returns simulated results, does not trade
Node.js MT5

NodeMT5

npm install github:MetaRPC/NodeMT5 @grpc/grpc-js

Trade Copier Client SDKs

Official, open-source client SDKs for Trade Copier across 8 programming languages.

8 Languages • Copier SDKs
C# COPY

CSharpCopier

git clone https://github.com/MetaRPC/CSharpCopier.git && dotnet add reference CSharpCopier/MetaRPC.CSharpCopier.csproj
Python COPY

PyCopier

pip install git+https://github.com/MetaRPC/PyCopier.git
Go COPY

GoCopier

go get github.com/MetaRPC/GoCopier/copier
Java COPY

JavaCopier

git clone https://github.com/MetaRPC/JavaCopier.git && cd JavaCopier && mvn install -DskipTests
C++ COPY

CppCopier

git clone https://github.com/MetaRPC/CppCopier.git
Rust COPY

RustCopier

git clone https://github.com/MetaRPC/RustCopier.git
Ruby COPY

RubyCopier

git clone https://github.com/MetaRPC/RubyCopier.git
Node.js COPY

NodeCopier

npm install github:MetaRPC/NodeCopier @grpc/grpc-js