Invoices
Retrieve one credit note
/a/CreditNote_get
Retrieve one active credit note with decoded line items, metadata, customer/invoice display names, and ordered allocations.
When to use this endpoint
Use this to populate the Credit Notes editor or the Send Email widget after obtaining an ID from the list endpoint.
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 tenant setting accounting_credit_notes must equal 1. Otherwise the handler returns {"error":"Credit Notes are not enabled for this account"}.
Users whose legacy crm_access mask contains bit 64 are denied. The handler does not enforce the CRM2 pageCreditNotes role permission, ownership, or department scope.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer-compatible | Yes | Active credit-note ID. |
Example request
$credit = FM_api('CreditNote_get', ['id' => 311]);
Example response
{
"id": "311",
"num": "CN-1042",
"status": "1",
"total": "40",
"remaining": "15",
"rows": [{"description":"Returned part","qty":1,"gross":40}],
"meta": [],
"customer_name": "Example Ltd",
"credited_invoice_num": "INV-981",
"allocations": [{"id":"72","invoice_id":"981","amt":"25","type":"allocation","meta":{"note":"Applied"},"invoice_num":"INV-981","note":"Applied"}]
}
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":"no such credit note"} | The ID 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
- Top-level database scalars remain strings.
rowsandmetaare decoded to arrays; malformed stored JSON becomes an empty array. - Allocations are ordered by allocation ID. Each allocation’s
metais decoded and its metadata note is also copied to top-levelnote. - Customer name is joined only for customer type
0. Joined customer and credited-invoice names are not filtered for soft deletion.
See it in Fieldmotion
CRM1
No CRM1 credit-note editor was found.
CRM2
Open a Credit Note editor or its Send Email dialog and filter Network requests for CreditNote_get.
Related endpoints
CreditNote_getreturns a credit note together with its allocations.CreditNotes_getDataTablesupplies the CRM2 list.