Invoices
Suggest the next invoice number
/a/Invoice_getNumberNext
Suggest the next invoice number under the tenant numbering policy.
When to use this endpoint
Use this to prefill a create form. Treat the result as a suggestion: it is not reserved and another writer may use it first.
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
This endpoint has no operation-specific parameters.
Example request
$number = FM_api('Invoice_getNumberNext');
Example response
"INV-0102"
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. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
acc-inv-num-method=1increments the greatest number by length and lexical order;2returns a blank string; other values increment the last-created active numbered invoice.- The helper keeps all non-digits as the prefix, increments the combined digits, and preserves their width. No lock or uniqueness reservation is taken.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found for this route.
CRM2
The Create Invoice dialogs in Invoices and Quotes request this value when the number input is present.
Related endpoints
Invoices_getDataTablesupplies paginated CRM2 invoice rows and IDs.Invoices_getDTis the CRM1 invoice-list counterpart.