When to use this endpoint

Use this for the legacy invoice header relationship. Job-mediated quote relationships are stored separately in relation rows.

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
idIntegerYesActive invoice ID.
quote_idIntegerYesPositive active quote ID, or zero to clear.

Example request

$result = FM_api('Invoice_setQuoteId', ['id' => 981, 'quote_id' => 611]);

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":"quote does not exist"}A positive quote ID is absent or deleted.
{"error":"cannot edit invoices that are marked Paid"}The invoice is Paid.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • An unchanged value returns warning: no change needed. This does not create or remove job/quote manymany links.

Side effects

  • Updates quote_id, last_edited, and edited_uuid; it does not fire Invoice_edit.

See it in Fieldmotion

CRM1

The main invoice editor exposes this relationship control.

CRM2

No direct production CRM2 caller was found for this route.

Related endpoints