When to use this endpoint

Use Contract_delete for the normal reversible contract deletion path. Prefer marking a contract inactive when it must remain readily visible with its history.

An Admin-console operator can later recover the row through Contract_restore.

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 stringYesPositive contract ID. The endpoint does not verify that an active row exists before returning success and logging the deletion.

Example request

$result = FM_api('Contract_delete', [
	'id' => '720',
]);

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"}The ID is absent or converts to less than one. This validation occurs before authentication.

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 update applies only when deleted=0, but a positive nonexistent or already-deleted ID still returns ok and creates deletion/audit records.
  • The row is marked deleted=1 with a Unix ddate; it is not permanently removed.
  • The route has no page or role-permission check. The bulk delete wrapper adds a permissions-bit check.

Side effects

  • Cancels pending global type-104 contract-expiry status work, adds a tenant deletes row, and writes a contract audit entry.
  • It does not cancel the separate type-10/type-11 contract email schedule rows.

See it in Fieldmotion

CRM1

On the Contracts page, choose the delete action on a row and confirm. Filter Network requests for Contract_delete.

CRM2

On Contracts, delete one row or use the CRM2 bulk-delete dialog. CRM2 currently issues one Contract_delete request per selected ID.

Related endpoints