Export Accounts By Filter
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 |
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
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¶
regdateis exported as a UTC datetime stringprofitis 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"],
"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 or unsupported field in select |
| 500 | Export directory creation or file write failed |