MngExportAccountsByFilter¶
Description: Exports account records selected by the same filter model as MngGetAccountsByFilter into a file stored in the server storage directory.
The method does not return account rows in JSON. Instead, it creates a file and returns only its generated name.
The export always contains the full filtered result set.
Access Control¶
🛡️ Access Level Required:
SESSION_MANAGER,SESSION_ADMIN,SESSION_DEALER
Access Scope¶
The request groupFilter only narrows the export scope. The server also applies the current cached manager scope: access_backoffice, see_accounts, see_accounts_balance, groups, and brand. Export totals are calculated after this visibility scope. Token payload is used only to resolve the manager id and session type.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
groupFilter |
string | Yes | Group mask used to select accounts, for example STD-* or * |
format |
string | Yes | Output format: csv or excel |
where |
array | No | Additional filter rules |
orWhere |
array | No | OR comparison group in [[field, operator, value], ...] format; at least one condition must match |
whereNot |
array | No | Negated filter rules |
whereIn |
array | No | Inclusion filter rules in [[field, [value1, value2, ...]], ...] format |
whereNotIn |
array | No | Exclusion filter rules in [[field, [value1, value2, ...]], ...] format |
whereBetween |
array | No | Range filter rules in [[field, [from, to]], ...] format |
whereNotBetween |
array | No | Negative range filter rules in [[field, [from, to]], ...] format |
orderBy |
array | No | Sort instructions |
select |
array | No | List of fields to export. If omitted or empty, the default account export layout is used |
total |
array | No | List of numeric fields for the bottom Total: row. If omitted or empty, no total row is added |
dateTimeFormat |
string | No | Output mask for all exported datetime values (regdate, update_time), 1–64 bytes, for example YYYY.MM.DD HH:mm:ss. If omitted, the default format YYYY-MM-DD HH:mm:ss is used. See Datetime Format Mask |
The runtime field online is supported by where and orderBy. Use integer
1 for accounts with an active terminal WebSocket session and 0 for offline
accounts. A disconnected resumable session may remain online for up to 60
seconds.
Supported Filter Keys¶
where:[[field, operator, value], ...]whereNot:[[field, value], ...]whereIn:[[field, [value1, value2, ...]], ...]whereNotIn:[[field, [value1, value2, ...]], ...]whereBetween:[[field, [from, to]], ...]whereNotBetween:[[field, [from, to]], ...]
Supported where Operators¶
===!=><>=<=like
Supported select Fields¶
If select is passed, every item must be one of the fields below. Any unknown field causes 400 INVALID_DATA.
loginenableenable_read_onlyenable_change_passwordleveragecurrencygroupemailcountryphonecommentaddresscityzipcodenameregdateprevbalanceprevmonthbalancebalancecreditbonusprofitnet_profitstoragecommissionmarginmargin_freemargin_levelequityonlinemagiccustomer_idupdate_time
Aliases accepted in select:
status->enableread_only->enable_read_onlyfree_margin->margin_freeregistration_date->regdate
password is not supported and is never exported.
Supported total Fields¶
If total is passed and not empty, the export adds a bottom row with Total: in the first column. Totals are written only under columns that are both present in select and listed in total.
Supported fields:
balancecreditbonusprofitnet_profitstoragecommissionmarginmargin_freeequityprevbalanceprevmonthbalance
Datetime Format Mask¶
dateTimeFormat uses moment.js-style tokens. Tokens are case-sensitive.
| Token | Value | Example |
|---|---|---|
YYYY |
4-digit year | 2026 |
YY |
2-digit year | 26 |
MM |
Month, 01–12 | 10 |
DD |
Day of month, 01–31 | 13 |
HH |
Hour, 00–23 | 09 |
mm |
Minute, 00–59 | 30 |
ss |
Second, 00–59 | 41 |
- any character that is not a Latin letter (
.,-,/,:, space, and so on) is written as is - any other Latin letter or token, for example
T,Y,YYYYYorMMM, causes400 INVALID_DATAwith messageunsupported dateTimeFormat - a non-string value, an empty string or a value longer than 64 bytes causes
400 INVALID_DATAwith the request validation message - datetime values are always formatted in UTC; the mask changes only the representation
- empty datetime values (
0) are exported as an empty cell - the mask is applied to both
csvandexcelexports; in Excel the value is written as a text cell - the
Total:row is not affected
Example: regdate = 1791883841 with dateTimeFormat = "DD.MM.YYYY HH:mm" is exported as 13.10.2026 09:30.
Default Export Layout¶
If select is omitted or empty, the export contains the following columns in this exact order:
Login Name Group Email Country City Address Phone Status Read only Currency Balance Leverage Credit Bonus Margin Free margin Margin level Equity Registration date Comment
Export Formatting Notes¶
regdateandupdate_timeare exported as UTC datetime strings inYYYY-MM-DD HH:mm:ssformat, or in thedateTimeFormatmask when it is passedprofitis gross floating profitnet_profitis calculated asprofit + storage + commissionprevbalance,prevmonthbalance,balance,credit,bonus,profit,net_profit,storage,commission,margin,margin_free,margin_level, andequityare exported with 2 digits after the decimal pointtotalrow values use compact numeric formatting, for example12500instead of12500.00enableis exported asEnableorDisableenable_read_onlyis exported asYesorNoleverageis exported inx100format- exported values follow the same order as the selected columns
- exported column headers are human-readable, for example
Margin levelinstead ofmargin_level
Request Example¶
{
"groupFilter": "STD-*",
"format": "csv",
"select": ["login", "group", "currency", "balance", "equity", "online", "regdate"],
"total": ["balance", "equity"],
"dateTimeFormat": "YYYY.MM.DD HH:mm:ss",
"where": [
["enable", "=", 1]
],
"whereNot": [],
"orderBy": ["balance", "DESC"]
}
Response Parameters¶
| Name | Type | Description |
|---|---|---|
file_name |
string | Generated file name stored in storage/ |
Successful Response Example¶
{
"file_name": "550e8400-e29b-41d4-a716-446655440000.csv"
}
Notes¶
format = "csv"generates a.csvfileformat = "excel"generates a.xlsxfile- the response contains only the generated file name with extension
- the export always contains the full filtered result set
- password values are not included in account exports
limitandoffsetare not supported by this method
Errors¶
| Code | Description |
|---|---|
| 400 | Invalid request payload, unsupported field in select or total, or unsupported dateTimeFormat |
| 500 | Export directory creation or file write failed |