Files
Get a stored filename
/a/File_getFilenameByEnumAndId
Return a file ID, expected type, and stored filename without loading the file bytes.
When to use this endpoint
Use File_getFilenameByEnumAndId when only a display filename is needed. The id parameter is the file ID despite the legacy function name.
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 |
|---|---|---|---|
id | Integer-compatible | Yes | Positive file ID. |
type_enum | Integer-compatible | Yes | Expected positive file type. |
Example request
$name = FM_api('File_getFilenameByEnumAndId', ['id' => '4821', 'type_enum' => '2']);
Example response
{
"id": "4821",
"type_enum": "2",
"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: id"} | ID is non-positive. |
{"error":"missing or invalid parameter: type_enum"} | Type is non-positive. |
{"error":"no such file"} | No row matches both values. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Soft-deleted rows are excluded. This is metadata-only: it does not touch object storage or refresh access time.
See it in Fieldmotion
CRM1
No current direct CRM1 caller was found.
CRM2
No current direct CRM2 caller was found.
Related endpoints
File_getFileDetailsByEnumAndIdalso returns the storage URL.