When to use this endpoint

Use Customers_delete for the CRM customer-list bulk Delete action after the operator has confirmed the exact selected IDs.

If the intended action is reversible day-to-day archiving, use Customers_disable. Deletion removes customers from normal reads and integration queues.

Authentication and permissions

The request must be logged in. In CRM1, the user permissions bitmask must include bit 1; in CRM2, isAllow("delete", "pageCustomers") must pass.

The outer handler performs the same permission check before calling the one-customer route, which checks it again for each ID.

Parameters

ParameterTypeRequiredDescription
idsJSON array stringYesNonempty JSON string of customer IDs, for example [1042,1088]. A native request array is not accepted by the handler’s json_decode path.

Example request

$result = FM_api('Customers_delete', [
	'ids' => json_encode([1042, 1088]),
]);

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 parameter: ids"}ids is absent or blank.
{"error":"invalid parameter: ids"}The value is not JSON for a nonempty array.
{"error":"You do not have the correct permissions to delete a customer."}The current CRM1/CRM2 permission check fails. CRM1 also returns the numeric permissions value.

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

Behaviour and edge cases

  • IDs are passed one at a time to Customer_delete; the batch is not prevalidated or transactional.
  • Each successful child call soft-deletes its active customer. Historical rows remain in the tenant database.
  • There is no pagination or maximum batch size in the handler. Use bounded batches to limit recurrence and integration-queue work.

Side effects

  • For each successful customer, records a deletion-log row with the customer name, disables active recurrences, removes future incomplete recurring jobs, and sets deleted=1, ddate, and last_edited.
  • Removes customer sync mappings/upload-queue entries and queued uploads for associated invoices, and invalidates customer caches.
  • Removes generated daily-archive customer-name cache files so they can be rebuilt.

See it in Fieldmotion

CRM1

Select rows on Customers, choose the bulk delete action, and filter Network requests for Customers_delete. Other CRM1 utilities also use this route for multi-selection deletion.

CRM2

The Customers page calls this route after its archive-first deletion flow. The UI sends selected IDs as JSON and checks only the top-level response.

Related endpoints