# MT5 REST API reference

Complete reference for every AlgoDeltaFX MT5 REST API endpoint: orders, positions, symbols, trade history, MT5 account management and copy trading groups.

## Account API (v2)

Trade one MetaTrader 5 account: place, modify, cancel and close orders, and read positions, symbols and history.

Base URL: `https://api.algodeltafx.com/api/v2/forexaccount`

### Orders & positions

| Endpoint | Method | Path | Description |
| --- | --- | --- | --- |
| [Place Order](https://docs.algodeltafx.com/api/place-order.md) | POST | `/placeorder` | Open a market order or place a pending order (limit, stop, stop-limit) on an MT5 account. |
| [Modify Order or Position](https://docs.algodeltafx.com/api/modify-order.md) | POST | `/modifyorderorposition` | Change the stop loss, take profit or price of an open position or pending order. |
| [Cancel Order](https://docs.algodeltafx.com/api/cancel-order.md) | POST | `/cancelorder` | Cancel a pending order by ticket, or all pending orders for a symbol and side. |
| [Close Position](https://docs.algodeltafx.com/api/close-position.md) | POST | `/squareoffposition` | Close an open position fully or partially by ticket, or close all positions on a symbol. |
| [Get Open Positions](https://docs.algodeltafx.com/api/get-open-positions.md) | GET | `/getopenpositions` | List every open position on the MT5 account. |
| [Get Pending Orders](https://docs.algodeltafx.com/api/get-pending-orders.md) | GET | `/getpendingorders` | List every pending (limit, stop, stop-limit) order on the MT5 account. |

### Account data

| Endpoint | Method | Path | Description |
| --- | --- | --- | --- |
| [Get Account Profile](https://docs.algodeltafx.com/api/get-profile.md) | GET | `/getprofile` | Read the MT5 account profile and details. |
| [Get Symbols](https://docs.algodeltafx.com/api/get-symbols.md) | GET | `/getsymbols` | List the tradable symbols on the account, with broker suffixes. |

### Trade history

| Endpoint | Method | Path | Description |
| --- | --- | --- | --- |
| [Position History](https://docs.algodeltafx.com/api/position-history.md) | POST | `/gethistorypositions` | Closed positions in a date range, with cursor pagination. |
| [Deal History](https://docs.algodeltafx.com/api/deal-history.md) | POST | `/gethistorydeals` | Executed deals (fills) in a date range, with cursor pagination. |
| [Order History](https://docs.algodeltafx.com/api/order-history.md) | POST | `/gethistoryorders` | Historical orders (filled, cancelled, expired) in a date range. |
| [Balance History](https://docs.algodeltafx.com/api/balance-history.md) | POST | `/gethistorybalance` | Balance operations (deposits, withdrawals, credits) in a date range. |
| [History Summary](https://docs.algodeltafx.com/api/history-summary.md) | POST | `/gethistorysummary` | Aggregated trading summary for a date range. |

## Master API (v1)

Manage many MT5 accounts: connect accounts, build copy trading groups, set lot sizing and pull daily profit.

Base URL: `https://api.algodeltafx.com/api/v1`

### Authentication

| Endpoint | Method | Path | Description |
| --- | --- | --- | --- |
| [Get Master Token](https://docs.algodeltafx.com/api/master-login.md) | POST | `/auth/userlogin` | Log in with your AlgoDeltaFX credentials to get a master token for the Master API. |

### MT5 accounts

| Endpoint | Method | Path | Description |
| --- | --- | --- | --- |
| [Add MT5 Account](https://docs.algodeltafx.com/api/add-account.md) | POST | `/users/broker/addfxbroker` | Connect a new MetaTrader 5 account to your AlgoDeltaFX user. |
| [Replace MT5 Account](https://docs.algodeltafx.com/api/replace-account.md) | POST | `/users/broker/replacebroker` | Update the login, password or server of an existing connected account. |
| [Delete MT5 Account](https://docs.algodeltafx.com/api/delete-account.md) | POST | `/users/broker/deletebroker` | Disconnect and remove an MT5 account. |
| [List MT5 Accounts](https://docs.algodeltafx.com/api/list-accounts.md) | GET | `/users/broker/getbrokers` | List every MT5 account connected to your AlgoDeltaFX user. |
| [Daily Profit](https://docs.algodeltafx.com/api/daily-profit.md) | POST | `/users/broker/getdailyprofit` | Daily profit for one account over a date range. |

### Copy trading groups

| Endpoint | Method | Path | Description |
| --- | --- | --- | --- |
| [List Copy Groups](https://docs.algodeltafx.com/api/list-groups.md) | GET | `/users/group/getgroups` | List your copy trading groups. |
| [List Group Accounts](https://docs.algodeltafx.com/api/list-group-accounts.md) | POST | `/users/group/getgroupbrokers` | List the accounts in a copy group with their lot settings. |
| [Add Account to Group](https://docs.algodeltafx.com/api/add-account-to-group.md) | POST | `/users/group/addgroupbroker` | Add an MT5 account to a copy group as a child, with its lot sizing rule. |
| [Update Group Account](https://docs.algodeltafx.com/api/update-group-account.md) | POST | `/users/group/updategroupbroker` | Change the lot sizing rule of an account in a copy group. |
| [Pause or Resume Copying](https://docs.algodeltafx.com/api/pause-copy-trading.md) | POST | `/users/group/updatechildtradingflag` | Pause or resume copying for one child account. |
| [Remove Account from Group](https://docs.algodeltafx.com/api/remove-account-from-group.md) | POST | `/users/group/removegroupbroker` | Remove a child account from a copy group. |


---
Source: https://docs.algodeltafx.com/api/
