API Documentation:
----------------------------
Introduction:
mtconnect api is simple REST api that takes account information and sends back entire account history. The reason this API is created is to help developers build projects that need Meta Trader trading account data such as open trades, closed trades, balance, equity etc. (refer to the output section below for more information) but don't want to run individual accounts with EAs or don't have any other means of getting the account history.
API Structure:
Protocol: REST API.
Method: POST
End point for MT4 accounts data: https://app.mtconnectapi.com/api/api.php
End point for MT5 accounts data: coming soon ...
Inputs:
Parameter |
Type |
Possible values |
Mandatory (Y/N) |
Description |
caller |
String |
Alpha-numeric string |
Y |
This is the API key that you get when you create your account. You can go to the members area and you will find your API key in there. This uniquely identifies you as a caller of the API. |
tradeserver |
String |
IP Address format with port number |
Y |
This is the IP address of the trade server on which the trading account has been created. For example - if the trader's account is created at Exness or Forex.com then IP address of their respective trade server with the port number is required. This is usually of this format - 111.222.333.444:443 You can find the IP address easily by following steps given in this video - https://youtu.be/A5oWTuozjkE |
uid |
String |
Alpha-numeric string representing the user id |
Y |
This is the ID of the user who holds the account. This field is mostly not useful for many projects so can be ignored. Enter any alpha-numeric value of upto 20 characters. This field has no particular use in most of the cases. This is only useful if you wish to identify a specific API call by a specific ID. |
uacc |
String |
Numeric value representing account number |
Y |
This is the account number that you wish to read the trade data for. |
upass |
String |
String representing the investor password |
Y |
This is the investor (read-only) password for the account that you want to read the data for. Investor password should be used as much as possible but if you don't have access to investor password and only know the master password, that is also ok to use in this field. Again, use of master password is discouraged for obvious security risks. Use of investor password is preferred. |
suffix |
String |
Character string indicating the chart suffix used by the broker. |
N |
This is the suffix used for the charts at the broker. Refer to the FAQs section for more information on this. |
lastticket |
String |
Numeric value indicating the last ticket |
Y |
This is the ticket number from which you want the API to retrieve the data. If you want the entire account history data, use 0 in this field. If you provide any value greater than 0, the API will retrieve data only from that ticket onwards. This is mostly provided for performance reasons in case the account has high volume of trades in the history. |
Outputs:
If inputs are provided correctly, the output is usually the account trading history and account header level data such as balance, equity, margin used etc. as shown in the two images below. If there is any issue and / or the API is unable to read the data successfully, an error message is shown instead.
There are two main types of records the CSV output has:
1 - Trade record - this is indicated by the first character as "T". In case of MT5, these will be indicated by D for deal, P for position.
2 - Header record - this is indicated by the first character as "H".
For each column and its purpose, refer to the following images.
Image 1 - Illustration of Header record in CSV file:

Image 2 - Illustration of Trade record in CSV file:

|