Files
List files for a resource
/a/Files_list
Return a compact, unpaginated list of files linked to one exact resource type and ID, optionally changed since a timestamp.
When to use this endpoint
Use Files_list for synchronization code that needs file identities/filenames rather than UI table rows.
Start a resource-based export here to obtain file-record IDs and filenames, then fetch each file with File_getFile. This list does not return URL or content even if they are requested in fields.
Authentication and permissions
Use signed API-key authentication or a logged-in CRM session on the account’s routed host. File IDs and stored URLs normally resolve within that tenant; they are not public or cross-tenant identifiers. Session CSRF applies where required by the dispatcher.
The shared content-read guard denies type 10. For ordinary file types it requires a user session; CRM2 sessions (crmVersion=2) additionally need Files View (pageFiles_view). CRM1 does not receive that CRM2 page permission check.
Types 6, 8 and 16 return before the shared guard’s login/Files-page checks. Types 7 and 9 bypass the CRM2 Files-page check only after a user is established; type 6 is also treated as an app asset. An internal shareable-file context can bypass the remaining ordinary checks. Explicit route login checks still apply, and these exceptions do not override the dispatcher’s configured record-scope guard.
When department/team or Assigned Jobs Only scope is configured for the actor, the dispatcher adds record-scope checks. This is selected by account features/actor flags, separately from the CRM2-only Files View check; the existing TeamAccess entry guard has no CRM-version condition. It requires a supported type_enum and visible type_id: 0 Customer, 2 Asset, 3 Job, 4 User, 13 Task or 14 Contract. Upload/deleteAll additionally require the owning object’s Edit grant.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type_enum | Integer-compatible | Yes | Non-negative relationship type; unlike several legacy routes, Customer type 0 is valid. Common verified values are 0 Customer, 1 Asset Type, 2 Asset, 3 Job, 4 User, 5 recurring Job, 6 User photo, 7 report-design image, 8 Job form photo, 9 report PDF background, 10 private/non-downloadable, 11 form file, 12 Quote, and 13 Task file. Other modules use later values; use the enum already emitted by the relevant CRM workflow. |
type_id | Integer-compatible | Yes | Positive linked resource ID. This is the linked object ID, never the file ID. |
last_edited | SQL date-time string | No | Exclusive lower bound; rows must also be earlier than the server’s current date-time. |
fields | Native array or JSON array string | No | Only the five already-default fields are accepted: id, type_id, type_enum, last_edited, and filename. Requests merely duplicate select expressions and do not add new output keys. |
Example request
$files = FM_api('Files_list', [
'type_enum' => '2',
'type_id' => '1042',
'last_edited' => '2026-09-01 00:00:00',
]);
Example response
[
{
"id": 4821,
"type_id": "1042",
"type_enum": "2",
"last_edited": "2026-09-20 10:15:00",
"filename": "asset-photo.jpg"
}
]
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 parameter: type_enum"} | Type is omitted or negative. |
{"error":"missing or invalid parameter: type_id"} | Resource ID is non-positive. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Only non-deleted rows are returned. IDs are converted to JSON integers; other database values remain strings. Results have no explicit order, pagination, or limit.
- The upper timestamp bound prevents future-dated rows from being returned. Timestamp comparison uses database/server values without tenant-timezone conversion.
Side effects
- Reads metadata only; no content download or access-time refresh.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found.
CRM2
No direct production CRM2 caller was found; mapped widgets use Files_getDataTable. This route is suitable for legacy synchronization clients.
Related endpoints
Files_getDataTableexcludes deleted rows and paginates.- File identifiers and downloads explains file ID, resource ID, type enum, stored URL and the different content response shapes.