When to use this endpoint

Locations_list can supply the selected ID. Refresh the list after deletion; do not expect an ok object.

These records represent work areas and map locations, not live user GPS positions or geofence definitions. Read IDs before editing; the stored user column is distinct from user-to-area membership.

Authentication and permissions

Authenticate using signed API-key fields or a logged-in CRM session. All object queries use the authenticated tenant. The handler has no additional page, role or feature check unless stated below.

Sign numeric request values as strings, including nested native arrays; only JSON-encode parameters that explicitly accept JSON text. See Getting started.

Parameters

ParameterTypeRequiredDescription
idPositive integerYesOne positive integer ID of an active tenant-local record; arrays, negative numbers and SQL-like strings are rejected.

Example request

$result = FM_api('Location_delete', ['id'=>'1042']);

Example response

null

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"}Not one positive integer.
{"error":"inventory deletion could not be recorded"}Audit failure rolls back deletion.
{"error":"inventory write failed"}Row/link write failed and rolled back.

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

Behaviour and edge cases

  • Returns JSON null after a successful delete. An already deleted or unknown positive ID also returns null, without adding another audit entry.
  • Sets deleted=1, ddate to server Unix time and last_edited to server datetime. Records the original row in the tenant deletion log under locations.
  • Removes manymany type 7 user-to-area assignment links. Other business references are retained, not reassigned or cascaded.
  • Tenant row changes, membership repairs and required audit writes are checked within one transaction; a failure rolls them back and returns an error. Configured events run only after commit.
  • Only non-deleted work areas are read or changed. No department or ownership restriction is applied. CRM1/CRM2 hide Area Settings with feature bit 524288, but these APIs do not enforce that UI restriction.
  • The source search found no direct caller in the mobile JavaScript app or its m/www intermediary for this endpoint.

Side effects

  • Soft-deletes the row, records its deletion audit and removes user assignment links; invalidates locations cache. No configured event is fired.

See it in Fieldmotion

CRM1

Area Settings → open a location → Delete; filter for Location_delete. The callback refreshes the list without requiring an ok flag.

CRM2

Area Settings → select an area → Delete; filter for Location_delete. The caller accepts the null response.

Related endpoints