MngExportLeadsByFilter¶
Exports leads matching a filter to CSV or Excel. The export is not paginated: it covers every matching record.
The command is available through the manager command API only; there is no REST
path for it. The kind is fixed by the command name, so customer_kind is not
accepted on input. See
Clients and Leads Commands.
It replaces the deprecated MngExportCustomersByFilter.
Access Control¶
Allowed sessions:
SESSION_MANAGERSESSION_ADMINSESSION_DEALERSESSION_CRM_MANAGERSESSION_CRM_ADMIN
The caller must have CRM access and export_leads. Exported rows are limited by the
manager brand and desks unless the manager has see_all_leads or admin scope.
Full contact export, contacts: "full" or mask_contacts: 0, additionally
requires see_leads_contacts. Otherwise contact export must stay masked.
Every call is written to the journal, successful ones included.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
format |
string | Yes | csv or excel |
contacts |
string | No | masked or full, default masked |
mask_contacts |
int | No | Legacy form of the same flag: 1 masked, 0 full |
select |
array | No | Export columns. Empty or missing means default columns |
where, orWhere, whereNot, whereIn, whereNotIn, whereBetween, whereNotBetween |
array | No | Same filter format as the list commands |
orderBy |
array | No | Sort definition |
Request¶
{
"command": "MngExportLeadsByFilter",
"extID": "1",
"data": {
"format": "csv",
"contacts": "full",
"select": ["customer_id", "full_name", "email", "phone", "lifecycle_flags", "customer_kind"],
"where": [
["country_of_residence", "=", "CY"]
]
}
}
Response Data¶
{
"file_name": "b1a4d4c8-7a99-4f64-aef0-0d8d1f9db1b9.csv"
}
On failure the response carries error and message instead.
Exported Values¶
Statuses and types are exported as human-readable text rather than as numbers:
type:Individual,Businessstatus:Active,Blocked,Archivedlifecycle_flags: the raised flags as labels separated by commas, in a fixed order, for exampleRegistered, KYC approved, First deposit. An empty mask exports an empty stringcustomer_kind:Lead,Client- dictionary statuses such as
kyc_status,sales_status,risk_status,finance_status: the status name fromcustomer_statuses - compliance statuses such as
aml_status,risk_level,pep_status,sanctions_status: readable enum text
lifecycle_stage is not an allowed export field. Passing it in select refuses
the whole export with unsupported export field: lifecycle_stage.
Errors¶
| HTTP | Error | Description |
|---|---|---|
400 |
INVALID_DATA |
Request validation failed |
403 |
RET_NOT_ENOUGH_RIGHTS |
Missing permission, missing scope, or the record is outside the caller's visibility |
404 |
RET_NOT_FOUND |
No customer with that identifier exists |
Every error carries a message field with free-form text. Its contents are not
part of the contract; branch on error.