Flask Application API Documentation (Corrected Mandatory Params)

Auth & Login Routes

POST /login

Checks user credentials (master or investor) and returns a success/failure response.

FIELDTYPEDESCRIPTIONREQUIRED
user_id integer User’s numeric ID Yes
pwd string User’s password Yes
user_ip string User’s IP address Yes
device_name string Device name, e.g. “iPhone 12” Yes
device_id string Unique device ID Yes
fcm_token string FCM token for push notifications Optional
white_label_broker_name string Optional broker label check Optional
Sample Request POST /login { "user_id": 100001, "pwd": "my_password", "user_ip": "192.168.0.10", "device_name": "WindowsPC", "device_id": "deviceXYZ" }
Sample Response { "response": "Login Success", "code": 200, "user_type": 1 }

POST /userAuth

Quickly verifies if a user with user_id and pwd exists. Returns a simple JSON success/failure.

FIELDTYPEDESCRIPTIONREQUIRED
user_id integer User’s numeric ID Yes
pwd string User’s password Yes
Sample Request POST /userAuth { "user_id": 100001, "pwd": "my_password" }
Sample Response { "response": "Successfully Authenticated", "code": 200 }

User Management Routes

POST /createUser

Creates a new user account in USER_TABLE.

FIELDTYPEDESCRIPTIONREQUIRED
name string Full name of user Yes
state string State of user’s location Yes
city string City location Yes
company string Company name Yes
email string Email address Yes
phone string Contact phone Yes
country string Country name Yes
zip_code string Zip/Postal code Yes
address string Full address Yes
kyc_status string KYC verification status Yes
manager_id integer Manager ID (optional, default=0) Optional
admin_id integer Admin ID if no manager Yes (if manager_id=0)
Sample Request POST /createUser { "name": "John Doe", "state": "California", "city": "Los Angeles", "company": "MyCompany", "email": "[email protected]", "phone": "+1 234 5678", "country": "USA", "zip_code": "90001", "address": "123 Sunny St", "kyc_status": "PENDING", "manager_id": 0, "admin_id": 100001 }
Sample Response { "Status": "Query Pushed" }

POST /getAccounts

Retrieves multiple user accounts (filtered by date, group, user_id, etc.).

FIELDTYPEDESCRIPTIONREQUIRED
supervisor_id integer Manager/Admin ID making request Yes
supervisor_pwd string Password for that supervisor Yes
supervisor_type string “MANAGER” or “ADMIN” Yes
from_dt string Filter register_date >= from_dt Optional
to_dt string Filter register_date <= to_dt Optional
user_id integer Specific user ID to fetch Optional
group_id integer or array Filter by group(s) Optional
Sample Request POST /getAccounts { "supervisor_id": 100001, "supervisor_pwd": "admin_password", "supervisor_type": "ADMIN", "from_dt": "2023-01-01 00:00:00", "to_dt": "2023-12-31 23:59:59" }
Sample Response { "data": [ { "uid": 101002, "group_id": 100, "balance": 1500.0, "email": "[email protected]", ... } ], "code": 200 }

Manager & Admin Routes

POST /createManager

Creates a manager (and also an ACCOUNTS entry with type=MANAGER).

FIELDTYPEDESCRIPTIONREQUIRED
supervisor_id integer Admin creating this manager Yes
supervisor_pwd string Admin’s password Yes
supervisor_type string Must be “ADMIN” Yes
pwd string Manager’s login password. (auto-generated if missing) Optional
api_pwd string API password for manager. (optional) Optional
investor_pwd string Investor password for manager Optional
group_id list of integers One or more group IDs manager handles Yes
first_name string Manager’s first name Yes
email string Manager’s email Yes
Sample Request POST /createManager { "supervisor_id": 100000, "supervisor_pwd": "admin_pass", "supervisor_type": "ADMIN", "first_name": "Alice", "email": "[email protected]", "pwd": "Manager123!", "group_id": "100,101" }
Sample Response { "status": "Manager and User Created Successfully", "code": 200, "_id": 200001, "result": {...} }

POST /adminLogin

Admin login for the web console, returns admin’s basic stats (positions, online_cnt, etc.).

FIELDTYPEDESCRIPTIONREQUIRED
admin_id integer Admin ID Yes
pwd string Admin’s password Yes
Sample Request POST /adminLogin { "admin_id": 100001, "pwd": "admin_pass" }
Sample Response { "response": "Login Successful", "code": 200, "data": [ { "admin_id": 100001, "manager_cnt": 2, "account_cnt": 54, "position_cnt": 10, "online_cnt": 5, ... } ] }

Groups & Commissions

POST /createGroup

Creates a new group. This route has many parameters controlling margin, risk, etc. We only list the mandatory ones if no try/except usage is found for them.

FIELDTYPEDESCRIPTIONREQUIRED
gname string Name of the group Yes
company string Company name/brand Yes
groupSuffix string Group suffix string Yes
company_site string Company URL Yes
company_email string Company email Yes
Sample Request POST /createGroup { "gname": "VIP Group", "company": "MyBroker", "groupSuffix": "VIP", "company_site": "https://mybroker.com", "company_email": "[email protected]" ... }
Sample Response { "response": "Group Created Successfully", "group_id": 101, "code": 200 }

POST /createCommission

Creates/updates a commission rule for a group. The code shows no try/except around these parameters except for the method type. Thus these are mandatory if the route is POST.

FIELDTYPEDESCRIPTIONREQUIRED
supervisor_id integer Manager/Admin ID Yes
supervisor_pwd string Supervisor password Yes
supervisor_type string “MANAGER” or “ADMIN” Yes
commission_type string AGENT, STANDARD, etc. Yes
gid integer Group ID for commission Yes
symbols string Pair or “*” Yes
range string Range category e.g. “volume” Yes
charge string INSTANT or something else Yes
name string Commission rule name Yes
Sample Request POST /createCommission { "supervisor_id": 200001, "supervisor_pwd": "manager_pass", "supervisor_type": "MANAGER", "commission_type": "AGENT", "gid": 101, "symbols": "EURUSD", "range": "volume", "charge": "INSTANT", "name": "AgentCommission", "description": "Commission for agent" }
Sample Response { "response": "Commision Inserted", "code": 200, "_id": 301, "name": "AgentCommission" }

Trading & Positions

POST /openTrade

Opens a new trade (market order). The code shows the following are used with no try/except, so they are mandatory.

FIELDTYPEDESCRIPTIONREQUIRED
user_id integer ID of the user placing the trade Yes
pwd string User’s password Yes
pair string Symbol/pair, e.g. “EURUSD” Yes
volume float Lot size to open Yes
side string “BUY” or “SELL” Yes
reason string Reason for opening, e.g. “Manual entry” Yes
comment string Any textual comment Yes
tp float Take profit level Optional
sl float Stop loss level Optional
tsl float Trailing SL points Optional
break_even float Break-even points Optional
device_name string Trader’s device name Optional
device_id string Trader’s device ID Optional
hour_diff integer Offset hours from server time Optional
Sample Request POST /openTrade { "user_id": 101002, "pwd": "trader_pass", "pair": "EURUSD", "volume": 0.01, "side": "BUY", "reason": "Manual entry", "comment": "Testing openTrade", "tp": 1.0750, "sl": 1.0700 }
Sample Response { "status": "Trade Opened Successfully", "price": 1.0725, "code": 200, "_id": 500024 }

POST /closeTrade

Closes an existing open position partially or fully.

FIELDTYPEDESCRIPTIONREQUIRED
user_id integer ID of user owning the position Yes
pwd string User’s password Yes
position_id integer The ID of the open position Yes
pair string Symbol e.g. “EURUSD” Yes
side string Opposite side to close with (the code sets it automatically to “SELL” if buy, etc.) Yes
volume float Volume to close Yes
reason string Reason for close, e.g. “Manual close” Yes
comment string Close comment Yes
device_name string Trader’s device name (optional code block) Optional
device_id string Trader’s device ID (optional) Optional
Sample Request POST /closeTrade { "user_id": 101002, "pwd": "trader_pass", "position_id": 500024, "pair": "EURUSD", "side": "SELL", "volume": 0.01, "reason": "Manual close", "comment": "Testing partial close" }
Sample Response { "status": "Trade Volume 0.01 Closed Successfully", "price": 1.0731, "code": 200, "profit": 0.23 }

Deposits & Withdrawals

POST /deposit

Increments user account or bonus/credit if fund_type is set.

FIELDTYPEDESCRIPTIONREQUIRED
uid integer User ID to deposit into Yes
fund_amount float Amount to deposit Yes
supervisor_id integer Admin/Manager ID making deposit Yes
supervisor_pwd string Supervisor password Yes
supervisor_type string “MANAGER” or “ADMIN” Yes
fund_type string “BALANCE”, “BONUS”, “CREDIT” Optional (default “BALANCE”)
comment string Any deposit note Optional
dt string Date/time override Optional
Sample Request POST /deposit { "uid": 101002, "fund_amount": 500, "supervisor_id": 100001, "supervisor_pwd": "admin_pass", "supervisor_type": "ADMIN" }
Sample Response { "status": "Deposit of amount 500.0 was successful", "code": 200 }

POST /withdraw

Subtracts from user’s account or bonus/credit.

FIELDTYPEDESCRIPTIONREQUIRED
uid integer User ID to withdraw from Yes
fund_amount float Withdrawal amount Yes
supervisor_id integer Admin/Manager ID Yes
supervisor_pwd string Supervisor password Yes
supervisor_type string “MANAGER” or “ADMIN” Yes
fund_type string “BALANCE”, “BONUS”, or “CREDIT” Optional (default “BALANCE”)
comment string Withdrawal note Optional
dt string Date/time override Optional
Sample Request POST /withdraw { "uid": 101002, "fund_amount": 100, "supervisor_id": 100001, "supervisor_pwd": "admin_pass", "supervisor_type": "ADMIN" }
Sample Response { "status": "Withdraw of amount 100.0 was successful", "code": 200 }

Copy Trading Routes

POST /createMasterTrader

Registers the user as a “Master Trader.” The code shows these fields with no fallback, so they’re mandatory.

FIELDTYPEDESCRIPTIONREQUIRED
user_id integer Trader’s user ID Yes
pwd string Trader’s password Yes
strategy_name string Name of strategy Yes
strategy_desc string Strategy description Yes
percent_share float Profit share percentage 0-100 Yes
min_bal_required float Minimum balance to copy Yes
trading_pairs string (comma list) Pairs the master trades Yes
leverage integer Leverage used by master Yes
copy_trader_name string Display name for copy feed Yes
Sample Request POST /createMasterTrader { "user_id": 102000, "pwd": "trader_live", "strategy_name": "ScalpingMagic", "strategy_desc": "High-frequency scalping", "percent_share": 15.0, "min_bal_required": 1000, "trading_pairs": "EURUSD,GBPUSD", "leverage": 200, "copy_trader_name": "ProScalper" }
Sample Response { "response": "Master Trader Created", "user_id": 102000, "code": 200 }

POST /copyMasterTrader

Subscribes a user to copy trades from a master trader.

FIELDTYPEDESCRIPTIONREQUIRED
user_id integer ID of copying user Yes
pwd string Copying user’s password Yes
master_id integer Master trader’s user ID Yes
Sample Request POST /copyMasterTrader { "user_id": 101005, "pwd": "some_pwd", "master_id": 102000 }
Sample Response { "response": "Trader Successful Copied", "code": 200 }

Logs & Notifications

POST /getLogs

Retrieves logs with optional date or message filtering (admin-level only).

FIELDTYPEDESCRIPTIONREQUIRED
supervisor_id integer Admin ID Yes
supervisor_pwd string Admin’s password Yes
supervisor_type string Should be “ADMIN” for logs Yes
from_dt string Log date filter start Optional
to_dt string Log date filter end Optional
message string Substring match in logs Optional
Sample Request POST /getLogs { "supervisor_id": 100001, "supervisor_pwd": "admin_pwd", "supervisor_type": "ADMIN", "from_dt": "2023-01-01 00:00:00", "to_dt": "2023-07-01 23:59:59" }
Sample Response { "data": [ { "user_id": 101002, "message": "New position opened..", "dt": "2023-05-10 12:05:22", "ip": "10.0.0.5" } ], "code": 200 }

POST /updateToken

Inserts or deletes a user’s FCM token for push notifications. If token_type = “DELETE”, no fcm_token needed.

FIELDTYPEDESCRIPTIONREQUIRED
token_type string “DELETE” or otherwise to add Yes
device_id string Unique device ID Yes
user_id integer User ID for the token Yes
fcm_token string Token if adding Yes if token_type != "DELETE"
Sample Request POST /updateToken { "token_type": "DELETE", "device_id": "device123", "user_id": 101002 }
Sample Response { "response": "Token deleted Succesfully", "code": 200 }

Others / Misc

POST /sampleAPI

Basic sample endpoint for demonstration or testing parameters. Per code, param1 and param2 are mandatory.

FIELDTYPEDESCRIPTIONREQUIRED
param1 string Example parameter 1 Yes
param2 string Example parameter 2 Yes
Sample Request POST /sampleAPI { "param1": "Hello", "param2": "World" }
Sample Response { "code": 200, "response": "API SUCCESSFULLY RAN" }