When to use this endpoint

Use this legacy setter only when the caller already has a valid tenant tax-type ID.

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.
tax_code_idInteger-compatibleYesStored as an integer; account existence and nominal compatibility are not checked.

Example request

$result = FM_api('Invoice_setTaxCodeId', ['id' => 981, 'tax_code_id' => 7]);

Example response

{
  "ok": 1,
  "tax_code_id": "7"
}

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":"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 the normal success shape. The supplied scalar is compared before integer normalization, so response typing can follow the request.

Side effects

  • Updates the tax ID and edit metadata and fires Invoice_edit.

See it in Fieldmotion

CRM1

The main invoice editor calls this route from the tax-code control.

CRM2

No direct production CRM2 caller was found for this route.

Related endpoints