Marketing
Permanently delete lead sources
/a/MarketingSources_delete
Permanently delete all lead-source rows matching one or more mapped filters.
When to use this endpoint
Use MarketingSources_delete for CRM2 bulk deletion. Prefer an explicit id array so the affected rows are unambiguous.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Marketing-page, create, edit, delete, or role-permission check.
All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 hide some controls through client-side permissions; these routes do not repeat those UI checks.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible or native array | Recommended | One or more source IDs. A scalar uses equality and a native array uses IN. |
name | String or native array | Conditional | Exact case-sensitive-at-SQL-collation filter for one or more names. |
createDate, lastEdited | Integer-compatible or native array | Conditional | Stored Unix timestamp filters. At least one usable mapped filter is required across all parameters. |
Example request
$result = FM_api('MarketingSources_delete', [
'id' => ['30124', '30125'],
]);
Example response
{"ok":1}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid filter"} | No mapped filter is supplied. |
{"ok":1} | The filter is valid but matches no row. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- All supplied filters are AND-combined. Arrays use SQL
IN. - An empty numeric array deliberately matches no rows and returns success.
- There is no restore counterpart for the removed source rows.
Side effects
- Matched rows are physically removed, written to the tenant deletion log, recorded in Core history, and evicted from the marketing-source cache.
See it in Fieldmotion
CRM1
CRM1 deletes one row at a time with MarketingSource_delete.
CRM2
Open Marketing → Marketing Lead Source in CRM2 and filter browser developer tools for the exact function name. Select rows and run the page’s Delete Lead Source bulk action; the shared widget derives this plural route.
Related endpoints
MarketingSource_deletevalidates and deletes one ID without deletion-log history.MarketingSources_getDataTablesupplies the selected rows.