Files
Delete matching files
/a/Files_delete
Delete files matching mapped filters through the complete per-file storage, audit, and parent-resource lifecycle.
When to use this endpoint
Use Files_delete only for the CRM2 table bulk action. It is not behaviorally equivalent to File_delete.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session and establish the tenant database context.
The handler performs no record-owner or resource-specific permission check. CRM screens may hide the action, but callers with tenant API/session access can target any matching file ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Mapped filters | Scalar or native array | Yes | At least one mapped filter from id, filename, typeId, description, cDate, notes, ownerID, meta, name, typeEnum, lastEdited, url, customerReadable, fileLast_Edited, deleted, ddate, storageType, storageInstance, data, filesize, metaUserID, metaDateExpiry, metaTags, metaIncludeInEmail, metaEditNotesInPortal, metaShareWithSites, metaShowInPortal, metaOutsourcing, and metaLinkForm. CRM2 normally supplies id as one ID or an array. Filters are AND-combined; text is exact, numeric input is integer-normalized. |
Example request
$result = FM_api('Files_delete', ['id' => ['4821', '4822']]);
Example response
{
"ok": 1
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"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 filter"} | No recognized mapped filter is supplied. |
{"error":"Could not read records for deletion. Please retry."} | The pre-delete query fails. |
{"error":"Could not delete records. Please retry."} | The soft-delete update fails. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Already deleted rows are excluded. Empty matches return success. Every matching live row is soft-deleted, its stored content is removed, its deletion is logged, and supported parent file lists are rebuilt.
- Because every mapped field is filterable, callers can select by URL, filename, metadata-derived value, type, or other internal field; use an explicit ID list for predictable bulk UI actions.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found.
CRM2
Select rows on a modern Files table and choose the generic Delete bulk action.
Related endpoints
File_deletecoordinates physical storage and parent state.