When to use this endpoint

Use AccountCategory_updateData only after loading and submitting every Tax Type shown by CRM2. Missing existing IDs are permanently deleted.

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

ParameterTypeRequiredDescription
taxTypesNonempty native array of objectsYesAuthoritative complete category list.
taxTypes[].taxTypeIDInteger-compatibleYesExisting positive ID to retain/update, or 0 to insert a new category.
taxTypes[].taxTypeNameStringNoTrimmed name, maximum 64 characters. Omission becomes an empty name.
taxTypes[].taxTypeRateNumeric-compatibleNoConverted with floatval(); omission becomes 0.
taxTypes[].taxTypeGroupInteger-compatibleNoGroup ID, defaulting to 0. Group existence is not validated.

Example request

$result = FM_api('AccountCategory_updateData', [
	'taxTypes' => [
		[
			'taxTypeID' => 271006,
			'taxTypeName' => 'Standard VAT',
			'taxTypeRate' => '20',
			'taxTypeGroup' => 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: tax types"}The outer value is absent, not a native array, empty, or contains a non-object/non-array element.
{"error":"parameter too long: taxTypeName. max length 64 characters"}Any submitted name exceeds 64 characters; this validation occurs before deletion.

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

Behaviour and edge cases

  • Deletions occur before creates and updates. Each submitted ID 0 inserts; each positive ID is overwritten without checking that it exists.
  • Duplicate names and invalid group IDs are accepted.
  • The response contains no created IDs, counts, or per-row warnings.

Side effects

  • Deletes account/category links for removed tax types and advances last_edited on the affected accounts.
  • Writes app-sync deletion rows under the legacy key tax_rate for removed IDs.
  • Creates or updates category rows with current last_edited timestamps, but does not repair category IDs stored in invoices, quotes, customers, or other objects.

See it in Fieldmotion

CRM1

CRM1 does not call this snapshot route; it saves and deletes category rows individually.

CRM2

Open Settings → Finance. CRM2 loads the three finance tables and saves them as complete snapshots; filter browser developer tools for the exact function name. Save sends every nonblank Tax Type row here after the account snapshot succeeds.

Related endpoints