When to use this endpoint

Use this to remove an invoice from active lists while retaining it for deletion polling and administrative restoration.

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.
pageIDStringCRM2 onlyPage identifier checked with the CRM2 delete permission after the tenant deletion setting is checked.

Example request

$result = FM_api('Invoice_delete', ['id' => 981, 'pageID' => 'pageInvoices']);

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":"Invoice deletion is disabled in CRM2 Invoice Settings"}A CRM2 request is made while disable-invoice-delete=1.
{"error":"no permission to access api"}The CRM2 page delete check or legacy access mask denies deletion.
{"error":"no such invoice"}The ID is missing, deleted, or belongs to another tenant.

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

Behaviour and edge cases

  • Deletion is logical: deleted=1, ddate, and last_edited are set. Repeating the call returns “no such invoice”.
  • The CRM2 disable setting is evaluated before pageID, so a disabled tenant receives that error even when the page ID is absent.

Side effects

  • Adds the invoice to the tenant deletion stream and deletes all scheduled cron notifications whose object type is invoice and object ID matches.

See it in Fieldmotion

CRM1

Customer Invoices and Asset Invoices expose Delete actions which call this route; the main invoice page does not contain a direct delete caller.

CRM2

From Invoices, delete a row and filter Network requests for Invoice_delete. The UI passes its current page ID.

Related endpoints

  • Invoice_restore restores a soft-deleted invoice from the Admin deletion console.