When to use this endpoint

Use Task_setStatus for a legacy Task Main/dialog status edit. CRM2’s list, layout, and Kanban flows use mapped updates instead.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional task, page, role, ownership, or privacy-permission check.

All reads and writes use the authenticated tenant. CRM1 and CRM2 apply task visibility and editing permissions in their interfaces, but these handlers do not repeat those client-side rules.

Parameters

ParameterTypeRequiredDescription
idInteger-compatibleYesTask ID. Row existence and active state are not checked.
statusInteger-compatibleNo in implementationCRM values are 0 New, 1 Open, 2 Closed, and 3 Archived. Missing input becomes 0; values outside the UI list are accepted.

Example request

$changed = FM_api('Task_setStatus', [
	'id' => '318',
	'status' => '2',
]);

Example response

{
  "ok": 1
}

Errors and unusual responses

ResponseCondition
{"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.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Writes the integer-coerced status and refreshes last_edited. Omitting status silently resets it to New.
  • There is no row-existence, deleted=0, transition, ownership, or permission check. Deleted/nonexistent targets still return success.

Side effects

  • Invalidates the task cache. It does not fire Workflow, completion logic, audit history, email, or generic notifications.

See it in Fieldmotion

CRM1

Change Status in a task dialog or Task Main. CRM1 calls Task_setStatus; the Tasks table’s inline status control instead calls Task_update.

CRM2

No literal production CRM2 call was found. Task layouts/Kanban derive Task_updateData from their Task mapping.

Related endpoints

  • Task_update is CRM1’s inline status route.
  • Task_updateData is CRM2’s mapped status update with audit and notification side effects.