When to use this endpoint

Use File_get for normal download links. Use File_getFile when JavaScript needs base64 content instead.

For a server integration that needs both the original filename and bytes, use File_getFile: its response includes fileName and base64 fileData. Alternatively combine a narrow metadata lookup with this byte stream.

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. Explicit id/ids values are checked against visible file records. Other filename-only selections or mapped-filter-only bulk mutations can be rejected for lacking an explicit scoped selection.

Parameters

ParameterTypeRequiredDescription
idInteger-compatibleYesPositive file ID. Soft-deleted rows are rejected. Use the tenant file-record ID returned by upload/list/detail calls. This is separate from type_id/typeId (the linked resource ID), and from the random token in a storage URL.
oidInteger-compatibleNoRead from another tenant only for a Job file that is linked back to the current tenant through verified outsourcing metadata. Other types or unlinked jobs are denied.
returnAnyInternal onlyPresence suppresses the final exit; it is used by internal calls and is not part of the browser-download contract.

Example request

// Navigate a browser to:
/a/File_get/id=4821

Example response

Raw file bytes. The response is not JSON on success.

The route sends X-Content-Type-Options: nosniff. Known image/PDF extensions receive a browser MIME type; unknown types are application/octet-stream. Downloads use a sanitized stored filename.

Legacy rows with a blank URL fall back to customers/<type_id>/<filename>, then to the older numeric storage path if needed.

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: id"}ID is absent or non-positive.
{"error":"not logged in"}No tenant context can be resolved.
{"error":"no such file"}No non-deleted file row matches.
{"error":"permission denied"}The file type, CRM2 Files permission, or cross-tenant outsourcing guard rejects the read.

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

Behaviour and edge cases

  • Reading archived/object-backed content may restore bytes into the tenant database and refresh last_accessed when it is more than seven days old. A missing storage object produces an empty successful body.
  • The endpoint exits after streaming, so API wrappers expecting JSON must not use it as an ordinary data call.
  • The download filename is in Content-Disposition, not a JSON field. The helper removes path prefixes, CR/LF and unsafe quotes. Unknown extensions use application/octet-stream; SVG adds a restrictive content-security policy.
  • A selected type-6 CSS stylesheet is a compatibility exception: when styles-css.selected matches its linked resource ID, the response is inline text/css. Ordinary files retain attachment disposition.

Side effects

  • Storage reads can update access/size metadata, restore archived bytes and clear archive linkage, or hydrate missing database bytes from a configured backend. File content reads are not guaranteed read-only. No email or user notification is sent by the ordinary successful download path.

See it in Fieldmotion

CRM1

Click a filename on Customer, Job, Asset, User, recurring-Job, Task, or shared file tables.

CRM2

Click a filename or photo download link. CRM2 disables ordinary links when the user lacks pageFiles_view.

Related endpoints