Accounts and tax types
Resolve account details by nominal code
/a/Account_getDetails
Resolve a nominal code to its account display fields and linked tax-type names.
When to use this endpoint
Use Account_getDetails when a stored nominal code needs its account name and linked tax-type context, as CRM1 does while editing stock.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional Finance-page, client-admin, role, create, edit, or delete permission check.
All reads and writes use the authenticated tenant. CRM1 and CRM2 decide whether to show finance controls, but these handlers do not repeat those client-side checks.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
nominal_code | String | Yes | Exact stored nominal code. The handler does not trim it; omitted, empty, and the exact string 0 are rejected. |
Example request
$account = FM_api('Account_getDetails', [
'nominal_code' => '4000',
]);
Example response
{
"id": "331042",
"name": "Sales",
"display_name": "Sales",
"is_default": "1",
"category_details": [
{"to_id":"271006","catname":"Standard VAT","groupname":"Income"}
]
}
category_details is omitted when no link rows are found. Database-backed scalars are returned as JSON strings.
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: nominal_code"} | The code is absent or PHP treats it as empty. |
false | No account has the exact code. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- There is no pagination or explicit ordering. If duplicate account codes exist, the selected row is not deterministic.
- Linked category rows are de-duplicated after the query. A missing category or group can produce
nulljoined names. - The response deliberately does not repeat
nominal_code.
See it in Fieldmotion
CRM1
Edit a stock item and choose its nominal/tax settings. CRM1’s stock widget calls Account_getDetails to infer a tax type when exactly one category is linked.
CRM2
No direct CRM2 caller was found. CRM2 normally loads Accounts_list and Accounts_getCategories instead.
Related endpoints
Account_listCategoriesreturns the linked tax types directly.Accounts_listlists all account codes.