When to use this endpoint

Use TaskType_delete only from task-type administration after confirming the type is no longer needed. This object has no soft-delete column or restore endpoint.

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 Settings-page, role, create, edit, or delete permission check.

All reads and writes use the authenticated tenant. CRM1 and CRM2 decide whether to show task-type controls, but these handlers do not repeat those client-side checks.

Parameters

ParameterTypeRequiredDescription
idPositive integer-compatibleYesTask-type ID. Integer values below 1 are rejected before the login guard.

Example request

$result = FM_api('TaskType_delete', [
	'id' => '3',
]);

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":"invalid or missing parameter: id"}The integer-converted ID is below 1.
{"ok":1}Also returned when no task-type row matches.

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 endpoint does not check whether tasks reference the type, whether the row exists, or how many rows were affected.
  • The response contains no task_id. CRM1’s settings code nevertheless tries to remove an option using ret.task_id, so its local select can remain stale until reload.

Side effects

  • Permanently deletes the row, invalidates the task-type cache, and adds a tenant deletion-log entry for table task_types. There is no corresponding restore path.

See it in Fieldmotion

CRM1

Open Settings → Task Types, select a type, and choose Delete. The row is deleted, but the current dropdown may not remove it because the response lacks the field CRM1 expects.

CRM2

Open Settings → Task Types and bulk-delete selected types. CRM2 calls TaskType_delete once per ID and refreshes the table afterward.

Related endpoints