When to use this endpoint

Use File_getFileDetailsByEnumAndId for legacy Asset-file widgets that validate a stored file reference before showing it. Despite the name, id is the file ID, not the resource ID.

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. 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.
type_enumInteger-compatibleYesExpected positive file type; type zero is rejected. This is a file relationship category, not a second record ID. For Job files use 3, for Asset files 2; Customer 0 is rejected by these legacy handlers. Use File_getRequestedDetails or File_getFile for Customer attachments.

Example request

$details = FM_api('File_getFileDetailsByEnumAndId', ['id' => '4821', 'type_enum' => '2']);

Example response

{
  "id": "4821",
  "type_enum": "2",
  "filename": "asset-photo.jpg",
  "url": "files/2/1042/abc123"
}

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 non-positive.
{"error":"missing or invalid parameter: type_enum"}Type is non-positive.
{"error":"no such file"}The ID/type pair does not match.

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. There is no pagination or storage read. The response contains database strings.
  • Neither endpoint returns content. Their SQL id is the file-record ID; they do not search by the resource’s type_id. File_getByEnumAndId has the opposite selection contract: type_id is the resource ID and the newest matching file is streamed.

Side effects

  • No content read, storage hydration, mail or record mutation.

See it in Fieldmotion

CRM1

In Asset details or the Customer Assets editor, upload an Asset custom-field image. The caller uses the uploaded file id and type_enum=18, then saves the returned URL in the Asset field. Ordinary Asset attachments use type 2.

CRM2

No direct production CRM2 caller was found.

Related endpoints