Invoices
Retrieve one invoice
/a/Invoice_get
Retrieve one active invoice with its raw header fields, historical customer snapshot, and normalized line-item JSON.
When to use this endpoint
Use this when a workflow already has an invoice ID and needs the complete legacy invoice record rather than selected mapped fields.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer | Yes | Invoice ID in the authenticated tenant. |
Example request
$invoice = FM_api('Invoice_get', ['id' => 981]);
Example response
{
"id": "981",
"appointment_id": "0",
"customer_id": "1042",
"total": "120.00",
"paid": "0.00",
"num": "INV-981",
"status": "1",
"rows": "[{\"description\":\"Service\",\"qty\":1}]",
"customer_details": "{\"name\":\"Example Ltd\"}"
}
Most database scalars are returned as strings. rows, customer_details, form_fields, form_tables, and meta remain JSON-encoded strings. The exact legacy job-link field is appointment_id.
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":"invoice does not exist"} | The invoice is absent or 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
- Table-backed and legacy embedded line items are normalized into the same JSON-encoded
rowsresponse. - A missing or invalid cached customer snapshot is rebuilt using address history at the invoice date and persisted before returning.
Side effects
- May repair and persist
customer_detailswhen the stored historical snapshot is missing or malformed.
See it in Fieldmotion
CRM1
Opening or editing an invoice, preparing invoice mail, and several invoice widgets call this endpoint.
CRM2
The Send Email widget loads the invoice through this route; configurable edit layouts generally use Invoice_getLayoutDetails.
Related endpoints
Invoices_getDataTablesupplies paginated CRM2 invoice rows and IDs.Invoices_getDTis the CRM1 invoice-list counterpart.