When to use this endpoint

Use only as a compatibility maintenance helper around user lifecycle changes. It does not change licence allowances or activate/deactivate a user.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. Session requests use the dispatcher’s CSRF protection when configured.

Counts intentionally cover the whole current account under Users Edit authority, rather than only the operator’s visible team.

Explicit Users Edit is required, including for a direct maintenance call.

Parameters

This endpoint has no operation-specific parameters.

Example request

$result = FM_api('Users_updateCount', [
]);

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":"account does not exist"}The current account has no global employer row.

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

Behaviour and edge cases

  • Counts active tenant rows separately for non_login=0 and non_login=1, excluding rows where meta.is_tmp is not SQL NULL. It does not require parent=current-account in these tenant-table counts.
  • Updates the current global account’s user_accounts_used and non_login_accounts_used. Counts are independent of global identity active flags and can differ if the two stores are inconsistent.
  • Requires Users Edit, acquires the existing tenant-owner/user lock and supports nested caller savepoints. The global account must exist; counter update execution is checked. Tenant/global storage can be separate hosts, so this does not claim a distributed transaction. Failures never return ok.

Side effects

  • Writes two global employer counters and sets cached session employer information to false. No audit entry, user edit marker, quota allowance change or notification is produced.

See it in Fieldmotion

CRM1

No direct production UI caller was found. User activation/deactivation and related lifecycle handlers call Users_updateCount internally.

CRM2

No direct production UI caller was found. Generic User lifecycle changes refresh counters through their backend workflow.

Related endpoints