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.
Authentication and permissions
Normal requests require signed API-key authentication or a logged-in CRM session and are scoped to that tenant. In CRM2, ordinary file types additionally require view permission on pageFiles; CRM1 does not apply that page permission.
File type 10 is always denied by the shared read guard. Types 6, 8, and 16 bypass that guard’s session/page-files checks, while types 6, 7, and 9 bypass only its CRM2 page check after login. Routes that explicitly call the login guard still require login, and download routes still need a resolvable tenant context. A separately established shareable-link context may also bypass the shared read guard.
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 email-template image. Other modules use later values; use the enum already emitted by the relevant CRM workflow. |
type_id | Integer-compatible | Yes | Positive linked resource 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.
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.