When to use this endpoint

Use this from a linked-jobs table after the user confirms removing the relationship. It does not delete either object.

Authentication and permissions

The request must use a logged-in CRM session or valid signed API credentials and is scoped to that tenant.

Users whose legacy crm_access mask contains bit 64 receive {"error":"no permission to access api"}. No record-owner check is made.

Parameters

ParameterTypeRequiredDescription
idPositive integerYesActive invoice ID.
job_idPositive integerYesActive job ID whose relation is removed.
type_numIntegerYesMust be 3 for a direct link or 4 for an ancillary link.

Example request

$result = FM_api('Invoice_unlinkJob', ['id' => 981, 'job_id' => 2204, 'type_num' => 4]);

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: type_num"}The relation type is not 3 or 4.
{"error":"invoice does not exist"}The invoice is absent or deleted.
{"error":"job does not exist"}The job is absent or deleted.
{"error":"invoice job link does not exist"}The exact invoice, job, and relation-type link is absent.

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 exact relation is deleted, then only the supplied invoice’s corresponding link-count metadata is recalculated. The misspelled jobs_linked_ancilliary key is the stored compatibility name.

Side effects

  • Deletes the selected manymany row, refreshes invoice link-count metadata, advances invoice edit metadata, and fires Invoice_edit.

See it in Fieldmotion

CRM1

No direct production CRM1 caller was found.

CRM2

The linked-job invoice widget calls this route for direct and ancillary unlink actions.

Related endpoints