Invoices
Delete an invoice recurrence
POST
/a/InvoiceRecurring_delete
Archive an invoice recurrence and detach its generated invoices.
When to use this endpoint
Use this when deleting a recurring-invoice definition. The recurrence is retained as a soft-deleted audit record and hidden from normal reads.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session and is scoped to the authenticated tenant.
The handler performs no additional invoice page, record-owner, or department permission check unless stated below.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer | Yes | Tenant invoice-recurrence ID. |
Example request
$result = FM_api('InvoiceRecurring_delete', ['id' => '42']);
Example response
{
"ok": 1
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"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"} | ID is absent, zero, or negative. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- A positive nonexistent or already-deleted ID still returns success.
- Generated invoices remain present but their
recurring_idis reset to zero. The archived recurrence cannot be read, edited, exported, listed, or run by the recurrence worker.
Side effects
- Detaches every invoice linked to the recurrence, sets
deleted=1with a deletion timestamp, disables the schedule, clears its next-run time, advanceslast_edited, and records a deletion-log entry.
See it in Fieldmotion
CRM1
The recurring-invoices page calls this endpoint when a recurrence is deleted.
CRM2
The recurring-invoices page calls this endpoint after its delete confirmation.
Related endpoints
InvoiceRecurring_getreads a recurrence.InvoiceRecurring_savecreates or edits one.