When to use this endpoint

Use JobType_delete only for a type that must be removed rather than hidden. Prefer JobType_setArchived when historical identity should remain intact.

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

ParameterTypeRequiredDescription
idInteger stringYesExisting job-type ID. Input is integer-converted before lookup.

Example request

$deleted = FM_api('JobType_delete', [
	'id' => '42',
]);

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":"no Job Type ID provided"}The id key is absent.
{"error":"Job Type does not exist"}The integer-converted ID is zero or no 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

  • Every non-deleted job using the type is changed to type ID 0, given current last_edited, and marked with edit source JobType_delete.
  • Already-deleted jobs are not detached, so their stored type ID can refer to the removed row.
  • The type row is hard-deleted rather than archived. The handler does not check a CRM page/role permission beyond authentication.

Side effects

  • Invalidates the jobs cache and records the type deletion in the tenant deletion log.
  • The type-delete query does not explicitly invalidate the job-type cache, and the affected jobs do not receive individual field-history entries.

See it in Fieldmotion

CRM1

Open Settings → Job Types, delete a row, and confirm the dialog warning that associated jobs will have their type unset.

CRM2

Open Settings → Job Types and delete a permitted row. CRM2 calls this route directly after confirmation.

Related endpoints