Tasks
Restore a deleted task
/a/Task_restore
Restore one soft-deleted task through the protected Admin recovery workflow.
When to use this endpoint
Use Task_restore only from the Admin console’s deleted-object tooling after confirming the task should return to normal CRM views. Normal CRM and integration sessions cannot use it.
Authentication and permissions
The request must have a logged-in tenant session whose login_source is exactly admin-console. A normal CRM session or signed API-key request is rejected even when it belongs to a client administrator.
The restored task is resolved only inside that Admin-selected tenant.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | ID of a row currently marked deleted=1. |
Example request
$restored = FM_api('Task_restore', [
'id' => '318',
]); // Requires an Admin-console session, not a normal API-key call.
Example response
{
"ok": 1,
"type": "task",
"id": 318,
"label": "Task #318 (Confirm access details)",
"summary": {
"type": "task",
"id": 318,
"name": "Confirm access details",
"subject": "Confirm access details",
"details": "Confirm the site access details with the customer."
}
}
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 below 1. |
{"error":"admin console login required"} | Authentication did not come from an Admin-console session. |
{"error":"deleted task not found"} | The task does not exist or is not currently soft-deleted. |
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=0andddate=0. It does not changelast_edited, assignment, status, privacy, or linked data. - The summary omits blank subject/details values. The human label uses subject first and details as a fallback.
Side effects
- Invalidates the task cache and marks the newest still-active matching tenant deletion-log entry with restored time, user, and
Task_restoreroute metadata. - Does not send task notifications or create ordinary field-history entries.
See it in Fieldmotion
CRM1
No CRM1 caller exists. Recovery is performed from the separate Admin console’s Deleted Objects tool.
CRM2
No CRM2 caller exists. The CRM2 UI deliberately has no direct undelete action.
Related endpoints
Task_deletecreates the recoverable soft-deleted state and deletion-log row.Task_getcan retrieve the row again after restoration.