Opportunities
Delete multiple opportunities
/a/Opportunities_delete
Normalize and soft-delete a selection of opportunities, logging each row that actually existed.
When to use this endpoint
Use Opportunities_delete for CRM2’s selection delete action or integrations that need one request for several IDs.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.
The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Native array, JSON array string, or comma-separated string | Yes | IDs are integer-converted, deduplicated, and zero/blank values removed. Negative integers remain but normally match nothing. |
Example request
$result = FM_api('Opportunities_delete', [
'ids' => [481, 482],
]);
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 parameter: ids"} | ids is omitted or supplied as a non-array/non-string type. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- An empty normalized list returns success without a query. Unknown/already-deleted IDs are silent no-ops.
- Only currently non-deleted rows are changed. The route checks no Opportunities feature or delete/page permission beyond login.
Side effects
- Creates one deletion-log entry containing the stored ID/notes for every matched row, then sets
deleted=1/ddateand invalidates the opportunities cache. - Does not send the CRM2 opportunity notification emitted by the single-delete route.
See it in Fieldmotion
CRM1
CRM1 deletes one row at a time through Opportunity_delete.
CRM2
Select opportunities, choose the bulk delete action, and confirm; the table passes its native ID array here.
Related endpoints
Opportunity_deletedeletes one ID and may emit a CRM2 notification.Opportunity_restoreis the Admin-console recovery route.