{
  "openapi": "3.1.0",
  "info": {
    "title": "AlgoDeltaFX MT5 REST API",
    "version": "2.0.0",
    "summary": "REST API for MetaTrader 5 trading, account data, trade history and cross-broker copy trading.",
    "description": "Account API (v2) trades one MT5 account with a Bearer account token. Master API (v1) manages many accounts and copy trading groups with a master token sent as the raw Authorization header.\n\nOrder types (type): 0=Buy, 1=Sell, 2=Buy Limit, 3=Sell Limit, 4=Buy Stop, 5=Sell Stop, 6=Buy Stop Limit, 7=Sell Stop Limit.\nOrder states (state): 0=STARTED, 1=PLACED, 2=CANCELED, 3=PARTIAL, 4=FILLED, 5=REJECTED, 6=EXPIRED, 7=REQUEST_ADD.",
    "contact": {
      "name": "AlgoDeltaFX",
      "url": "https://www.algodeltafx.com/contact",
      "email": "contact@algodeltafx.com"
    },
    "termsOfService": "https://www.algodeltafx.com/terms-conditions"
  },
  "externalDocs": {
    "url": "https://docs.algodeltafx.com",
    "description": "Full documentation"
  },
  "servers": [
    {
      "url": "https://api.algodeltafx.com"
    }
  ],
  "tags": [
    {
      "name": "Orders & positions",
      "description": "Account API v2"
    },
    {
      "name": "Account data",
      "description": "Account API v2"
    },
    {
      "name": "Trade history",
      "description": "Account API v2"
    },
    {
      "name": "Authentication",
      "description": "Master API v1"
    },
    {
      "name": "MT5 accounts",
      "description": "Master API v1"
    },
    {
      "name": "Copy trading groups",
      "description": "Master API v1"
    }
  ],
  "paths": {
    "/api/v2/forexaccount/placeorder": {
      "post": {
        "operationId": "placeOrder",
        "summary": "Place Order",
        "description": "Send a market Buy or Sell, or a Buy Limit, Sell Limit, Buy Stop, Sell Stop, Buy Stop Limit or Sell Stop Limit pending order to a MetaTrader 5 account. Stop loss and take profit can be attached in the same request. The order goes from the AlgoDeltaFX cloud directly to your broker's MT5 server, with no terminal or VPS running.\n\nDocs: https://docs.algodeltafx.com/api/place-order/",
        "tags": [
          "Orders & positions"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string",
                    "description": "Symbol name exactly as your broker lists it, including any suffix (for example EURUSDm on Exness standard accounts). Use Get Symbols to look it up.",
                    "example": "EURUSD"
                  },
                  "type": {
                    "type": "integer",
                    "description": "MT5 order type, 0 to 7. See Order types.",
                    "enum": [
                      0,
                      1,
                      2,
                      3,
                      4,
                      5,
                      6,
                      7
                    ],
                    "example": 0
                  },
                  "volume": {
                    "type": "number",
                    "description": "Volume in lots, for example 0.01 (micro), 0.1 (mini), 1.0 (standard).",
                    "example": 0.5
                  },
                  "price": {
                    "type": "number",
                    "description": "Order price. Required for pending orders (types 2 to 7). For stop-limit orders this is the stop (trigger) price. Ignored for market orders."
                  },
                  "sl": {
                    "type": "number",
                    "description": "Stop loss price.",
                    "example": 1.082
                  },
                  "tp": {
                    "type": "number",
                    "description": "Take profit price.",
                    "example": 1.095
                  },
                  "stop_limit": {
                    "type": "number",
                    "description": "Limit price of the order placed once the stop price is reached. Required for Buy Stop Limit (6) and Sell Stop Limit (7)."
                  }
                },
                "required": [
                  "symbol",
                  "type",
                  "volume"
                ]
              },
              "example": {
                "symbol": "EURUSD",
                "type": 0,
                "volume": 0.5,
                "sl": 1.082,
                "tp": 1.095
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": true,
                  "msg": "Order placed",
                  "data": {
                    "ticket": 1093918439
                  }
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/place-order/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/modifyorderorposition": {
      "post": {
        "operationId": "modifyOrderOrPosition",
        "summary": "Modify Order or Position",
        "description": "Update the stop loss and take profit of an open MT5 position, or the price, SL, TP and stop-limit price of a pending order, by ticket. Use it for trailing stops, break-even moves and repricing pending orders from your own code.\n\nDocs: https://docs.algodeltafx.com/api/modify-order/",
        "tags": [
          "Orders & positions"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ticket": {
                    "type": "integer",
                    "description": "MT5 ticket of the position or pending order.",
                    "example": 1093918439
                  },
                  "price": {
                    "type": "number",
                    "description": "New order price. Pending orders only."
                  },
                  "sl": {
                    "type": "number",
                    "description": "New stop loss price.",
                    "example": 1.0856
                  },
                  "tp": {
                    "type": "number",
                    "description": "New take profit price.",
                    "example": 1.1589
                  },
                  "stop_limit": {
                    "type": "number",
                    "description": "New limit price for stop-limit pending orders."
                  }
                },
                "required": [
                  "ticket"
                ]
              },
              "example": {
                "ticket": 1093918439,
                "sl": 1.0856,
                "tp": 1.1589
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/modify-order/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/cancelorder": {
      "post": {
        "operationId": "cancelOrder",
        "summary": "Cancel Order",
        "description": "Delete pending MT5 orders (limit, stop and stop-limit). Cancel one order by its ticket, or cancel every pending order on a symbol for one side in a single call.\n\nDocs: https://docs.algodeltafx.com/api/cancel-order/",
        "tags": [
          "Orders & positions"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ticket": {
                    "type": "integer",
                    "description": "Ticket of the pending order to cancel. When set, symbol and side are not needed."
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Cancel pending orders on this symbol. Use instead of ticket.",
                    "example": "EURUSD"
                  },
                  "side": {
                    "type": "string",
                    "description": "BUY or SELL. Used together with symbol.",
                    "enum": [
                      "BUY",
                      "SELL"
                    ],
                    "example": "SELL"
                  }
                },
                "required": []
              },
              "example": {
                "symbol": "EURUSD",
                "side": "SELL"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/cancel-order/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/squareoffposition": {
      "post": {
        "operationId": "squareOffPosition",
        "summary": "Close Position",
        "description": "Square off open MetaTrader 5 positions. Close one position by ticket (optionally only part of its volume), or close every position on a symbol, optionally only the BUY or SELL side.\n\nDocs: https://docs.algodeltafx.com/api/close-position/",
        "tags": [
          "Orders & positions"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ticket": {
                    "type": "integer",
                    "description": "Ticket of the position to close."
                  },
                  "volume": {
                    "type": "number",
                    "description": "Lots to close for a partial close. Used with ticket. Omit to close the full position."
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Close positions on this symbol. Use instead of ticket.",
                    "example": "EURUSD"
                  },
                  "side": {
                    "type": "string",
                    "description": "Only close BUY or SELL positions on symbol. Omit to close both sides.",
                    "enum": [
                      "BUY",
                      "SELL"
                    ]
                  }
                },
                "required": []
              },
              "example": {
                "symbol": "EURUSD"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/close-position/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/getopenpositions": {
      "get": {
        "operationId": "getOpenPositions",
        "summary": "Get Open Positions",
        "description": "Return all currently open positions on the connected MetaTrader 5 account, with ticket, symbol, volume and floating profit. Use it to sync your app, show live P&L or check exposure before placing a new trade.\n\nDocs: https://docs.algodeltafx.com/api/get-open-positions/",
        "tags": [
          "Orders & positions"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "status": true,
                  "data": [
                    {
                      "ticket": 1093918439,
                      "symbol": "EURUSD",
                      "volume": 0.5,
                      "profit": 12.4
                    }
                  ]
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/get-open-positions/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/getpendingorders": {
      "get": {
        "operationId": "getPendingOrders",
        "summary": "Get Pending Orders",
        "description": "Return all pending orders waiting to trigger on the connected MetaTrader 5 account: Buy/Sell Limit, Buy/Sell Stop and Buy/Sell Stop Limit.\n\nDocs: https://docs.algodeltafx.com/api/get-pending-orders/",
        "tags": [
          "Orders & positions"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/get-pending-orders/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/getprofile": {
      "get": {
        "operationId": "getProfile",
        "summary": "Get Account Profile",
        "description": "Return the profile and details of the MT5 account that the token belongs to. Call it first to confirm your token works and that the account is connected.\n\nDocs: https://docs.algodeltafx.com/api/get-profile/",
        "tags": [
          "Account data"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/get-profile/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/getsymbols": {
      "get": {
        "operationId": "getSymbols",
        "summary": "Get Symbols",
        "description": "Return every symbol the connected MT5 account can trade, exactly as the broker names it. Brokers add suffixes such as EURUSDm, EURUSD.pro or XAUUSD+, so always read the name from here before calling Place Order.\n\nDocs: https://docs.algodeltafx.com/api/get-symbols/",
        "tags": [
          "Account data"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/get-symbols/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/gethistorypositions": {
      "post": {
        "operationId": "getHistoryPositions",
        "summary": "Position History",
        "description": "Return closed MetaTrader 5 positions between two dates, optionally filtered by symbol or position ID. Use it for trade journals, performance reports and investor statements.\n\nDocs: https://docs.algodeltafx.com/api/position-history/",
        "tags": [
          "Trade history"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_date": {
                    "type": "string",
                    "description": "Start of the range, YYYY-MM-DD.",
                    "example": "2026-10-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End of the range, YYYY-MM-DD.",
                    "example": "2026-11-01"
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Only return positions for this symbol (for example EURUSD). Leave empty for all symbols."
                  },
                  "position_id": {
                    "type": "string",
                    "description": "Only return positions that belong to this MT5 position ID. Leave empty for all."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum number of records per page.",
                    "default": 100,
                    "example": 100
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor returned by the previous page. Omit it on the first request. See Pagination."
                  }
                },
                "required": [
                  "start_date",
                  "end_date"
                ]
              },
              "example": {
                "start_date": "2026-10-01",
                "end_date": "2026-11-01",
                "symbol": "",
                "position_id": "",
                "limit": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/position-history/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/gethistorydeals": {
      "post": {
        "operationId": "getHistoryDeals",
        "summary": "Deal History",
        "description": "Return MT5 deals between two dates. In MetaTrader 5 a deal is one execution: each position has at least an entry deal and an exit deal, plus one deal per partial close. Use deals when you need exact fill prices, commissions and swaps.\n\nDocs: https://docs.algodeltafx.com/api/deal-history/",
        "tags": [
          "Trade history"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_date": {
                    "type": "string",
                    "description": "Start of the range, YYYY-MM-DD.",
                    "example": "2026-10-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End of the range, YYYY-MM-DD.",
                    "example": "2026-11-01"
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Only return deals for this symbol (for example EURUSD). Leave empty for all symbols."
                  },
                  "position_id": {
                    "type": "string",
                    "description": "Only return deals that belong to this MT5 position ID. Leave empty for all."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum number of records per page.",
                    "default": 100,
                    "example": 100
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor returned by the previous page. Omit it on the first request. See Pagination."
                  }
                },
                "required": [
                  "start_date",
                  "end_date"
                ]
              },
              "example": {
                "start_date": "2026-10-01",
                "end_date": "2026-11-01",
                "symbol": "",
                "position_id": "",
                "limit": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/deal-history/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/gethistoryorders": {
      "post": {
        "operationId": "getHistoryOrders",
        "summary": "Order History",
        "description": "Return MT5 orders that are no longer active, including filled, cancelled, rejected and expired orders, between two dates. See Order states for the meaning of the state field.\n\nDocs: https://docs.algodeltafx.com/api/order-history/",
        "tags": [
          "Trade history"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_date": {
                    "type": "string",
                    "description": "Start of the range, YYYY-MM-DD.",
                    "example": "2026-10-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End of the range, YYYY-MM-DD.",
                    "example": "2026-11-01"
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Only return orders for this symbol (for example EURUSD). Leave empty for all symbols."
                  },
                  "position_id": {
                    "type": "string",
                    "description": "Only return orders that belong to this MT5 position ID. Leave empty for all."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum number of records per page.",
                    "default": 100,
                    "example": 100
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor returned by the previous page. Omit it on the first request. See Pagination."
                  }
                },
                "required": [
                  "start_date",
                  "end_date"
                ]
              },
              "example": {
                "start_date": "2026-10-01",
                "end_date": "2026-11-01",
                "symbol": "",
                "position_id": "",
                "limit": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/order-history/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/gethistorybalance": {
      "post": {
        "operationId": "getHistoryBalance",
        "summary": "Balance History",
        "description": "Return balance operations recorded on the MT5 account between two dates, such as deposits, withdrawals and credits. Use it to separate trading profit from cash flows when you calculate returns.\n\nDocs: https://docs.algodeltafx.com/api/balance-history/",
        "tags": [
          "Trade history"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_date": {
                    "type": "string",
                    "description": "Start of the range, YYYY-MM-DD.",
                    "example": "2026-10-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End of the range, YYYY-MM-DD.",
                    "example": "2026-11-01"
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Only return balance records for this symbol (for example EURUSD). Leave empty for all symbols."
                  },
                  "position_id": {
                    "type": "string",
                    "description": "Only return balance records that belong to this MT5 position ID. Leave empty for all."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum number of records per page.",
                    "default": 100,
                    "example": 100
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor returned by the previous page. Omit it on the first request. See Pagination."
                  }
                },
                "required": [
                  "start_date",
                  "end_date"
                ]
              },
              "example": {
                "start_date": "2026-10-01",
                "end_date": "2026-11-01",
                "symbol": "",
                "position_id": "",
                "limit": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/balance-history/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v2/forexaccount/gethistorysummary": {
      "post": {
        "operationId": "getHistorySummary",
        "summary": "History Summary",
        "description": "Return an aggregated summary of the account's trading activity between two dates. Use it for dashboards and performance cards without downloading every deal.\n\nDocs: https://docs.algodeltafx.com/api/history-summary/",
        "tags": [
          "Trade history"
        ],
        "security": [
          {
            "accountToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start_date": {
                    "type": "string",
                    "description": "Start of the range, YYYY-MM-DD.",
                    "example": "2026-10-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End of the range, YYYY-MM-DD.",
                    "example": "2026-11-01"
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Only return summary data for this symbol (for example EURUSD). Leave empty for all symbols."
                  },
                  "position_id": {
                    "type": "string",
                    "description": "Only return summary data that belong to this MT5 position ID. Leave empty for all."
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum number of records per page.",
                    "default": 100,
                    "example": 100
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Pagination cursor returned by the previous page. Omit it on the first request. See Pagination."
                  }
                },
                "required": [
                  "start_date",
                  "end_date"
                ]
              },
              "example": {
                "start_date": "2026-10-01",
                "end_date": "2026-11-01",
                "symbol": "",
                "position_id": "",
                "limit": 100
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/history-summary/"
        },
        "x-api": "Account API v2"
      }
    },
    "/api/v1/auth/userlogin": {
      "post": {
        "operationId": "userLogin",
        "summary": "Get Master Token",
        "description": "Exchange your AlgoDeltaFX dashboard email and password for a master token (JWT). Every other Master API call sends this token in the Authorization header.\n\nDocs: https://docs.algodeltafx.com/api/master-login/",
        "tags": [
          "Authentication"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Your AlgoDeltaFX login email.",
                    "example": "you@example.com"
                  },
                  "password": {
                    "type": "string",
                    "description": "Your AlgoDeltaFX login password (not an MT5 password).",
                    "example": "YOUR_PASSWORD"
                  },
                  "domain": {
                    "type": "string",
                    "description": "Always https://algodeltafx.com. White-label platforms use their own domain.",
                    "example": "https://algodeltafx.com"
                  }
                },
                "required": [
                  "email",
                  "password",
                  "domain"
                ]
              },
              "example": {
                "email": "you@example.com",
                "password": "YOUR_PASSWORD",
                "domain": "https://algodeltafx.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/master-login/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/broker/addfxbroker": {
      "post": {
        "operationId": "addFxBroker",
        "summary": "Add MT5 Account",
        "description": "Connect a MetaTrader 5 account at any broker or prop firm by login, password and server. Once connected, the account can trade through the Account API and join copy trading groups. Use it to automate client onboarding.\n\nDocs: https://docs.algodeltafx.com/api/add-account/",
        "tags": [
          "MT5 accounts"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "nic_name": {
                    "type": "string",
                    "description": "Nickname shown for this account in the dashboard and API responses.",
                    "example": "Joe Max"
                  },
                  "fx_server": {
                    "type": "string",
                    "description": "MT5 broker server name exactly as it appears in the MetaTrader 5 login window, for example Exness-MT5Real29.",
                    "example": "Exness-MT5Real29"
                  },
                  "fx_login": {
                    "type": "integer",
                    "description": "MT5 account number (login ID).",
                    "example": 12345678
                  },
                  "fx_password": {
                    "type": "string",
                    "description": "MT5 trading (master) password of the account. The investor (read-only) password cannot place trades.",
                    "example": "MT5_PASSWORD"
                  },
                  "is_host_based": {
                    "type": "boolean",
                    "description": "false to connect by broker server name (fxserver). true to connect directly to an access-server IP and port (fxhost, fxport).",
                    "example": false
                  },
                  "fx_host": {
                    "type": "string",
                    "description": "Access-server IP address. Required when ishostbased is true.",
                    "example": "192.168.1.1"
                  },
                  "fx_port": {
                    "type": "integer",
                    "description": "Access-server port. Used when ishostbased is true.",
                    "default": 443,
                    "example": 443
                  }
                },
                "required": [
                  "nic_name",
                  "fx_server",
                  "fx_login",
                  "fx_password",
                  "is_host_based"
                ]
              },
              "example": {
                "nic_name": "Joe Max",
                "fx_server": "Exness-MT5Real29",
                "fx_login": 12345678,
                "fx_password": "MT5_PASSWORD",
                "is_host_based": false,
                "fx_host": "192.168.1.1",
                "fx_port": 443
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/add-account/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/broker/replacebroker": {
      "post": {
        "operationId": "replaceBroker",
        "summary": "Replace MT5 Account",
        "description": "Swap the MT5 credentials or server behind an existing account slot, for example after a password change, a server migration or when a prop firm issues a new funded account. The brokerid stays the same.\n\nDocs: https://docs.algodeltafx.com/api/replace-account/",
        "tags": [
          "MT5 accounts"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "broker_id": {
                    "type": "integer",
                    "description": "ID of the connected account to replace. Get it from List MT5 Accounts.",
                    "example": 101
                  },
                  "nic_name": {
                    "type": "string",
                    "description": "Nickname shown for this account in the dashboard and API responses.",
                    "example": "Joe Max"
                  },
                  "fx_server": {
                    "type": "string",
                    "description": "MT5 broker server name exactly as it appears in the MetaTrader 5 login window, for example Exness-MT5Real29.",
                    "example": "Exness-MT5Real29"
                  },
                  "fx_login": {
                    "type": "integer",
                    "description": "MT5 account number (login ID).",
                    "example": 12345678
                  },
                  "fx_password": {
                    "type": "string",
                    "description": "MT5 trading (master) password of the account. The investor (read-only) password cannot place trades.",
                    "example": "MT5_PASSWORD"
                  },
                  "is_host_based": {
                    "type": "boolean",
                    "description": "false to connect by broker server name (fxserver). true to connect directly to an access-server IP and port (fxhost, fxport).",
                    "example": false
                  },
                  "fx_host": {
                    "type": "string",
                    "description": "Access-server IP address. Required when ishostbased is true.",
                    "example": "192.168.1.1"
                  },
                  "fx_port": {
                    "type": "integer",
                    "description": "Access-server port. Used when ishostbased is true.",
                    "default": 443,
                    "example": 443
                  }
                },
                "required": [
                  "broker_id",
                  "nic_name",
                  "fx_server",
                  "fx_login",
                  "fx_password",
                  "is_host_based"
                ]
              },
              "example": {
                "broker_id": 101,
                "nic_name": "Joe Max",
                "fx_server": "Exness-MT5Real29",
                "fx_login": 12345678,
                "fx_password": "MT5_PASSWORD",
                "is_host_based": false,
                "fx_host": "192.168.1.1",
                "fx_port": 443
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/replace-account/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/broker/deletebroker": {
      "post": {
        "operationId": "deleteBroker",
        "summary": "Delete MT5 Account",
        "description": "Remove a connected MT5 account from your AlgoDeltaFX user. Trading through AlgoDeltaFX stops for that account. Funds and positions at the broker are not affected.\n\nDocs: https://docs.algodeltafx.com/api/delete-account/",
        "tags": [
          "MT5 accounts"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "broker_id": {
                    "type": "integer",
                    "description": "ID of the connected account to delete.",
                    "example": 101
                  }
                },
                "required": [
                  "broker_id"
                ]
              },
              "example": {
                "broker_id": 101
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/delete-account/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/broker/getbrokers": {
      "get": {
        "operationId": "getBrokers",
        "summary": "List MT5 Accounts",
        "description": "Return every MetaTrader 5 account connected to your AlgoDeltaFX user, including the brokerid used by the other Master API endpoints.\n\nDocs: https://docs.algodeltafx.com/api/list-accounts/",
        "tags": [
          "MT5 accounts"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/list-accounts/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/broker/getdailyprofit": {
      "post": {
        "operationId": "getDailyProfit",
        "summary": "Daily Profit",
        "description": "Return daily profit and loss for a connected MT5 account between two dates, with offset pagination. Use it for client reporting, fund dashboards and risk monitoring across many accounts.\n\nDocs: https://docs.algodeltafx.com/api/daily-profit/",
        "tags": [
          "MT5 accounts"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "broker_id": {
                    "type": "integer",
                    "description": "ID of the connected account.",
                    "example": 101
                  },
                  "offset": {
                    "type": "integer",
                    "description": "Number of records to skip.",
                    "default": 0,
                    "example": 0
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum number of records to return.",
                    "default": 10,
                    "example": 10
                  },
                  "start_date": {
                    "type": "string",
                    "description": "Start date, YYYY-MM-DD.",
                    "example": "2026-10-01"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "End date, YYYY-MM-DD.",
                    "example": "2026-10-31"
                  }
                },
                "required": [
                  "broker_id",
                  "start_date",
                  "end_date"
                ]
              },
              "example": {
                "broker_id": 101,
                "offset": 0,
                "limit": 10,
                "start_date": "2026-10-01",
                "end_date": "2026-10-31"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/daily-profit/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/group/getgroups": {
      "get": {
        "operationId": "getGroups",
        "summary": "List Copy Groups",
        "description": "Return every copy trading group on your AlgoDeltaFX user. A group links one master account to any number of child accounts that copy its trades.\n\nDocs: https://docs.algodeltafx.com/api/list-groups/",
        "tags": [
          "Copy trading groups"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/list-groups/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/group/getgroupbrokers": {
      "post": {
        "operationId": "getGroupBrokers",
        "summary": "List Group Accounts",
        "description": "Return the accounts in one copy trading group, with each account's groupbrokerid, lot sizing rule and copy status.\n\nDocs: https://docs.algodeltafx.com/api/list-group-accounts/",
        "tags": [
          "Copy trading groups"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "group_id": {
                    "type": "integer",
                    "description": "ID of the group from List Copy Groups.",
                    "example": 7
                  }
                },
                "required": [
                  "group_id"
                ]
              },
              "example": {
                "group_id": 7
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/list-group-accounts/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/group/addgroupbroker": {
      "post": {
        "operationId": "addGroupBroker",
        "summary": "Add Account to Group",
        "description": "Make a connected MT5 account copy a group's master account. Choose how volume is sized for this account: a multiplier of the master volume, a fixed lot or balance-based scaling.\n\nDocs: https://docs.algodeltafx.com/api/add-account-to-group/",
        "tags": [
          "Copy trading groups"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "group_id": {
                    "type": "integer",
                    "description": "ID of the copy group.",
                    "example": 7
                  },
                  "broker_id": {
                    "type": "integer",
                    "description": "ID of the connected MT5 account to add.",
                    "example": 101
                  },
                  "is_fix_lot": {
                    "type": "boolean",
                    "description": "true to open every copied trade with the fixed volume in fixlot, whatever the master volume.",
                    "default": false,
                    "example": false
                  },
                  "is_balance_based": {
                    "type": "boolean",
                    "description": "true to scale copied volume by the ratio of this account's balance to the master account's balance.",
                    "default": false,
                    "example": false
                  },
                  "fix_lot": {
                    "type": "number",
                    "description": "Lot size used when isfixlot is true.",
                    "default": 0.01,
                    "example": 0.01
                  },
                  "multiplier": {
                    "type": "number",
                    "description": "Multiplier applied to the master volume, for example 0.5 copies half size and 2 copies double.",
                    "default": 1,
                    "example": 1
                  }
                },
                "required": [
                  "group_id",
                  "broker_id"
                ]
              },
              "example": {
                "group_id": 7,
                "broker_id": 101,
                "is_fix_lot": false,
                "is_balance_based": false,
                "fix_lot": 0.01,
                "multiplier": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/add-account-to-group/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/group/updategroupbroker": {
      "post": {
        "operationId": "updateGroupBroker",
        "summary": "Update Group Account",
        "description": "Change how a child account sizes copied trades: switch between multiplier, fixed lot and balance-based sizing, or adjust the values.\n\nDocs: https://docs.algodeltafx.com/api/update-group-account/",
        "tags": [
          "Copy trading groups"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "group_broker_id": {
                    "type": "integer",
                    "description": "ID of the account's membership in the group, from List Group Accounts.",
                    "example": 55
                  },
                  "is_fix_lot": {
                    "type": "boolean",
                    "description": "true to open every copied trade with the fixed volume in fixlot, whatever the master volume.",
                    "default": false,
                    "example": false
                  },
                  "is_balance_based": {
                    "type": "boolean",
                    "description": "true to scale copied volume by the ratio of this account's balance to the master account's balance.",
                    "default": false,
                    "example": false
                  },
                  "fix_lot": {
                    "type": "number",
                    "description": "Lot size used when isfixlot is true.",
                    "default": 0.01,
                    "example": 0.01
                  },
                  "multiplier": {
                    "type": "number",
                    "description": "Multiplier applied to the master volume, for example 0.5 copies half size and 2 copies double.",
                    "default": 1,
                    "example": 1
                  }
                },
                "required": [
                  "group_broker_id"
                ]
              },
              "example": {
                "group_broker_id": 55,
                "is_fix_lot": false,
                "is_balance_based": false,
                "fix_lot": 0.01,
                "multiplier": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/update-group-account/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/group/updatechildtradingflag": {
      "post": {
        "operationId": "updateChildTradingFlag",
        "summary": "Pause or Resume Copying",
        "description": "Turn copying on or off for one child account without removing it from the group. Use it for risk controls, for example pausing an account that hit its daily drawdown limit or whose subscription expired.\n\nDocs: https://docs.algodeltafx.com/api/pause-copy-trading/",
        "tags": [
          "Copy trading groups"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "group_broker_id": {
                    "type": "integer",
                    "description": "ID of the account's membership in the group.",
                    "example": 55
                  },
                  "trading_flag": {
                    "type": "boolean",
                    "description": "true to copy trades to this account, false to pause.",
                    "example": true
                  }
                },
                "required": [
                  "group_broker_id",
                  "trading_flag"
                ]
              },
              "example": {
                "group_broker_id": 55,
                "trading_flag": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/pause-copy-trading/"
        },
        "x-api": "Master API v1"
      }
    },
    "/api/v1/users/group/removegroupbroker": {
      "post": {
        "operationId": "removeGroupBroker",
        "summary": "Remove Account from Group",
        "description": "Stop an account from copying a group and remove it from the group. The MT5 account stays connected to your AlgoDeltaFX user.\n\nDocs: https://docs.algodeltafx.com/api/remove-account-from-group/",
        "tags": [
          "Copy trading groups"
        ],
        "security": [
          {
            "masterToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "group_broker_id": {
                    "type": "integer",
                    "description": "ID of the account's membership in the group.",
                    "example": 55
                  }
                },
                "required": [
                  "group_broker_id"
                ]
              },
              "example": {
                "group_broker_id": 55
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Standard response envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        },
        "externalDocs": {
          "url": "https://docs.algodeltafx.com/api/remove-account-from-group/"
        },
        "x-api": "Master API v1"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "accountToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Per-account token from the AlgoDeltaFX dashboard."
      },
      "masterToken": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Master token from POST /api/v1/auth/userlogin, sent without a Bearer prefix."
      }
    },
    "schemas": {
      "Envelope": {
        "type": "object",
        "properties": {
          "status": {
            "type": "boolean"
          },
          "msg": {
            "type": "string"
          },
          "data": {
            "description": "Endpoint-specific result",
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "array"
              }
            ]
          }
        }
      }
    }
  }
}