Marketing
Permanently delete a marketing expense
/a/MarketingExpense_delete
Permanently remove one marketing-spend row from the tenant.
When to use this endpoint
Use MarketingExpense_delete for the delete action on either Marketing Expenses screen. There is no bulk plural delete route.
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 expense-row ID, integer-converted. |
Example request
$result = FM_api('MarketingExpense_delete', ['id' => '7124']);
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 or converts below 1. |
{"error":"no such marketing expense"} | No tenant expense has the 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 row is checked for existence before deletion.
- Deleting an expense does not change its marketing source or any attributed customer/quote/opportunity data.
Side effects
- The legacy delete performs a physical SQL delete but does not write Core history, create a tenant deletion-log row, or request explicit cache invalidation.
See it in Fieldmotion
CRM1
Open Settings → Marketing → Expense in CRM1 and filter browser developer tools for the exact function name. Click [x] in the Action column.
CRM2
Open Marketing → Marketing Expenses in CRM2 and filter browser developer tools for the exact function name. Delete a row through the shared table action; the page derives this singular endpoint.
Related endpoints
MarketingExpenses_getDataTablesupplies CRM2’s row ID.MarketingExpense_createDatacreates a replacement row if deletion was intentional.