When to use this endpoint

Use AccountCategory_save for CRM1’s legacy row save: ID 0 inserts, while a positive ID updates.

Authentication and permissions

The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks for the tenant database prefix rather than calling the normal login guard.

It performs no additional Finance-page, client-admin, role, create, edit, or delete permission check.

Parameters

ParameterTypeRequiredDescription
idInteger-compatibleYes0 creates a row; a positive value updates that ID. Negative values are rejected.
nameStringYesStored without trimming. Presence is required, but an empty string is accepted and no 64-character application limit is checked.
tax_rateNumeric-compatibleYesConverted with floatval().
group_idInteger-compatibleYesConverted to an integer; group existence is not checked.

Example request

$result = FM_api('AccountCategory_save', [
	'id' => 271006,
	'name' => 'Standard VAT',
	'tax_rate' => '20',
	'group_id' => 151003,
]);

Example response

{"ok":1}

Errors and unusual responses

ResponseCondition
{"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"}The ID is absent or negative.
{"error":"missing or invalid parameter: name"}The name parameter is absent.
{"error":"missing or invalid parameter: tax_rate"}The tax-rate parameter is absent.
{"error":"missing or invalid parameter: group_id"}The group parameter is absent.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Create mode returns no new ID, only {"ok":1}.
  • Update mode overwrites all three editable columns. An unknown positive ID is a silent no-op that returns success.
  • Duplicate names are allowed and the referenced group is not validated.

Side effects

  • Create mode sets cdate and last_edited; update mode advances last_edited. Both clear the category cache.

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. Editing an existing Tax Type row, or completing the blank row, calls AccountCategory_save.

CRM2

CRM2 does not call this route; it uses the create modal and the full-list AccountCategory_updateData save.

Related endpoints