When to use this endpoint

Use File_getFile when client code must consume bytes without navigating away, such as CRM2 bulk downloads. Prefer File_get for a single browser download.

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

ParameterTypeRequiredDescription
idInteger-compatibleConditionalPositive file ID. Either this or at least one nonblank paramName is required. ID takes precedence.
paramNameString or native arrayConditionalStored filename(s). Blank values are discarded; the first database match is returned with no explicit ordering.
oidInteger-compatibleNoCross-tenant Job-file access, subject to the same outsourcing-link guard as File_get.
returnAnyInternal onlyPresence returns before constructing the normal response and therefore yields no useful file payload.

Example request

$file = FM_api('File_getFile', ['id' => '4821']);

Example response

{
  "fileName": "service-photo.jpg",
  "fileData": "/9j/4AAQSkZJRg...",
  "cDate": "2026-09-20 10:15:00"
}

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"}Neither a positive ID nor a nonblank filename is supplied.
{"error":"no such file"}No non-deleted row matches.
{"error":"permission denied"}The shared read guard or outsourcing guard rejects access.

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

Behaviour and edge cases

  • The bytes are loaded from the current URL, with the same legacy URL/path fallbacks as File_get, then base64 encoded. Missing storage bytes become an empty encoded string.
  • There is no pagination. The entire file is held and encoded in memory.

See it in Fieldmotion

CRM1

No normal CRM1 caller was found; CRM1 generally navigates to File_get.

CRM2

Select multiple files for ZIP download, or open file/photo workflows that request content in JavaScript.

Related endpoints