Invoices
Restore a deleted invoice
POST
/a/Invoice_restore
Restore one soft-deleted invoice from the Admin deletion console and mark its deletion-log entry restored.
When to use this endpoint
Use this only from the administrative deleted-object recovery workflow after reviewing the deletion record.
Authentication and permissions
Requires the Admin console login check used by shared restore routes; an ordinary CRM session or API key is insufficient. Tenant context still selects the invoice table.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer | Yes | ID of an invoice whose deleted flag is currently 1. |
Example request
$result = FM_api('Invoice_restore', ['id' => 981]);
Example response
{
"ok": 1,
"type": "invoice",
"id": 981,
"label": "INV-981",
"summary": {"type": "invoice", "id": 981, "num": "INV-981"}
}
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":"deleted invoice not found"} | The ID is absent or is not currently soft-deleted. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Restoration sets
deleted=0andddate=0. It does not restore deleted notifications, external sync queue entries, or other side effects of the original deletion.
Side effects
- Marks the newest active tenant deletion-log entry restored with timestamp, user, and restore-function metadata.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found for this route.
CRM2
No direct production CRM2 caller was found for this route.
Related endpoints
Invoices_getDataTablesupplies paginated CRM2 invoice rows and IDs.Invoices_getDTis the CRM1 invoice-list counterpart.