Tasks
Delete a task
/a/Task_delete
Soft-delete an active task and record it in the tenant deletion log for Admin recovery.
When to use this endpoint
Use Task_delete for the normal task removal action. The row remains recoverable through the Admin-only restore workflow.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. The handler checks for the tenant database prefix rather than calling the normal login guard.
It performs no additional task, page, role, ownership, or privacy-permission check. A caller that knows an active task ID in its tenant can address it regardless of the CRM screens’ visibility rules.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible string | Yes | Active task ID. It must begin with a positive integer; an already deleted or missing row is rejected. |
appId | Integer-compatible | Legacy only | Read only by the legacy mixed-ID branch when the accepted id string contains n. External callers should not use this branch. |
Example request
$deleted = FM_api('Task_delete', [
'id' => '318',
]);
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: id"} | ID is absent or does not begin with a positive integer. |
{"error":"no such task"} | No active task matches the resolved 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
- Sets
deleted=1, stores epoch seconds inddate, and refresheslast_edited. Subsequent normal task reads exclude the row. - The endpoint does not unlink related jobs, delete task files/notes, or validate who created or is assigned to the task.
Side effects
- Invalidates the task cache and inserts a tenant
deletesrow including best-effort subject/details metadata and the deleting route/user. - Does not emit mapped update notifications or task-assignment email.
See it in Fieldmotion
CRM1
On Tasks, choose the row delete action and confirm. CRM1 calls Task_delete and redraws the table.
CRM2
Use the Delete action from a Tasks list/Kanban row. The generic Task table action calls Task_delete; browser bulk-action coverage uses the same route.
Related endpoints
Task_restorerestores one deleted task from an Admin-console session.Task_getstops returning the task immediately after deletion.