Accounts and tax types
Permanently delete a nominal account
/a/Account_delete
Permanently remove one nominal account and detach its tax-type and stock links.
When to use this endpoint
Use Account_delete only for the CRM1 Chart of Accounts delete action. It is not a soft delete and has no restore counterpart.
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 |
|---|---|---|---|
id | Integer-compatible | Yes | Positive tenant account ID. Values are integer-converted. |
Example request
$result = FM_api('Account_delete', [
'id' => 331042,
]);
Example response
{"ok":1}
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: id"} | id is absent, zero, negative, or not integer-compatible. |
{"error":"account does not exist"} | No account has that ID in the authenticated tenant. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The account is selected only by ID within the authenticated tenant. No active/deleted state or ownership check applies.
- The nominal code is read before deletion so matching stock rows can be cleared. Other records that store the code as text are not rewritten.
- An unknown ID is rejected before deletion logging or stock cleanup.
Side effects
- Deletes the account row and every
manymanytax-type link withtype_num=1and this account asfrom_id. - Sets
stock.nominal_codetonullwherever it exactly matches the deleted code. - Writes an app-sync deletion row under the legacy object key
nominal_code, with user ID0.
See it in Fieldmotion
CRM1
Open Settings → Finance. CRM1 loads and edits the Chart of Accounts, Tax Types, and Tax Groups from this endpoint family; filter browser developer tools for the exact function name. Delete a row in Chart of Accounts to send Account_delete.
CRM2
CRM2 does not call this single-row route. Its Finance page sends the complete remaining account set to Account_updateData.
Related endpoints
Account_updateDatais CRM2’s destructive full-list save.Accounts_listreturns the remaining accounts.