Marketing
Permanently delete one lead source
/a/MarketingSource_delete
Permanently remove one lead-source option from the tenant’s selectable source list.
When to use this endpoint
Use MarketingSource_delete for the single-row delete actions on the CRM1 and CRM2 Marketing Lead Source screens.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks for the tenant database prefix rather than calling the normal login guard.
It performs no additional Marketing-page, create, edit, delete, or role-permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive marketing-source ID. The value is integer-converted. |
Example request
$result = FM_api('MarketingSource_delete', ['id' => '30124']);
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":"invalid or missing parameter: id"} | The ID is absent, zero, negative, or nonnumeric. |
{"error":"no such marketing source"} | No source has the integer-converted ID. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The source row is hard-deleted; there is no soft-delete state or restore endpoint.
- No dependency check prevents deleting a source already used by other records.
Side effects
- This legacy route does not write Core history or a tenant deletion-log entry and does not request explicit cache invalidation.
See it in Fieldmotion
CRM1
Open Settings → Marketing → Source in CRM1 and filter browser developer tools for the exact function name. Click [x] beside a row; CRM1 calls this endpoint directly.
CRM2
Open Marketing → Marketing Lead Source in CRM2 and filter browser developer tools for the exact function name. Delete one row through the shared action menu; CRM2 derives this route from the singular API prefix.
Related endpoints
MarketingSources_deletesupports filtered/bulk deletion and records deletion history.MarketingExpenses_listcan reveal expenses retaining the old source ID.