When to use this endpoint

Use Contract_removeJob inside a job mutation that is clearing or changing the contract.

The normal job save and delete implementations call it after handling the job row itself.

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 used only for the audit entry and dirty flag. It is not used to scope the link deletion.
aidInteger stringYesPositive job ID. Every type-6 link from this ID is deleted.

Example request

$result = FM_api('Contract_removeJob', [
	'id' => '720',
	'aid' => '2039001',
]);

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 supplied contract ID is absent or not positive.
{"error":"missing or invalid parameter: aid"}The supplied job ID is absent or not positive.

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 handler does not verify the contract, job, or link. Missing rows return ok.
  • It does not clear meetings.contract_id; the caller must maintain that direct relationship.
  • The operation provides no filtering or pagination and is not transactional with the audit/cache changes.

Side effects

  • Deletes all type-6 relationship rows for the job, writes a contract audit entry, and sets customersDirty on the supplied contract when that row exists.

See it in Fieldmotion

CRM1

Remove or change the Contract while saving/deleting a job. The surrounding job route calls Contract_removeJob internally; the browser does not normally issue it separately.

CRM2

CRM2 job saves reach this route indirectly through the job API when a contract assignment changes.

Related endpoints