When to use this endpoint

Use Assets_delete for a bulk asset deletion workflow. Normal UI callers archive first; force exists for legacy internal cleanup paths.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login or an established tenant database context and performs no additional Asset-page or role-permission check unless the page says otherwise.

Every query and write uses the authenticated tenant’s tables. CRM1 and CRM2 may hide actions through client-side permissions that these collection routes do not repeat.

Parameters

ParameterTypeRequiredDescription
idsJSON array stringYesAsset IDs. Values are integer-converted, nonpositive values are omitted from the result, and duplicate IDs are processed repeatedly in the response.
forceInteger-compatibleNoDefault 0 refuses non-archived assets. Any nonzero integer bypasses that safeguard; external integrations should not use it as a normal deletion path.

Example request

$result = FM_api('Assets_delete', [
	'ids' => json_encode(['4821', '4822']),
]);

Example response

{
  "results": [
    {"ok": 1},
    {"error": "cannot delete asset as it is not archived: 4822"}
  ]
}

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: ids"}The key is absent. Malformed JSON or a non-array value can fail at runtime when the handler maps the IDs.

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

Behaviour and edge cases

  • A missing or already deleted positive ID returns {"ok":1,"warning":"asset already deleted: ID"}. Nonpositive IDs produce no result entry.
  • The delete is a soft delete. Related jobs, movements, tables, files, and financial records are not removed.

Side effects

  • Accepted rows receive deleted=1, a Unix ddate, and a refreshed last_edited. The route writes a deletion-log row and Asset delete history entry before the bulk update.

See it in Fieldmotion

CRM1

The Assets screen calls this route after an explicit delete confirmation. Some CRM1 data-migration tooling supplies force=1.

CRM2

The Assets screen uses Assets_deleteMultiple, which is an exact wrapper around this handler, for archived-row deletion.

Related endpoints