When to use this endpoint

Use Files_getDataTable for modern Customer, Job, Asset, User, Asset Type, and generic Files tables.

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 supplied id/ids values are checked. Collection entry acceptance does not itself add a file-scope SQL predicate to these legacy mapped/table handlers; confirm the configured-scope collection contract before treating every returned row/count as authorized.

Parameters

ParameterTypeRequiredDescription
fieldsNative arrayYesMapped fields to return; unknown names are ignored. Common table fields are id, cDate, filename, notes, meta, customerReadable, typeEnum, and typeId.
typeEnum / typeIdInteger-compatibleNoExact mapped relationship filters. Both should be supplied by resource-specific tables to prevent same-numbered resources of another type from leaking into results.
expiryStatusNative arrayNoOnly the first value is used: 0 requires no meta.dateExpiry; 1 requires a date. A scalar is treated like zero.
jobDisplayFormFilesBoolean-compatibleNoWhen true with typeEnum=3, returns type 3 Job files and type 8 Job-form photos for the same typeId.
isTable / draw / start / length / limitInteger-compatibleNoTable mode defaults start=0, length=10, draw=0. isTable=0 still returns {data:[...]}, without draw/counts; a positive limit caps its unpaged rows. No route-owned positive bounds or maximum is imposed; callers should supply sane nonnegative offsets and positive page sizes.
orderBy / orderDesc or order[0]Mapped field / DataTables orderNoMapped ordering controls.
searchValue / searchFieldString / string or arrayNoCase-insensitive substring search across selected mapped fields; All searches every searchable mapped field.
referenceDate / dateFrom / dateToMapped date field / integer day offsetsNoTenant-timezone relative range, commonly cDate.
Mapped filters / advanceSearch / groupByMixedNoShared mapped-table filters. Available fields are id, filename, typeId, description, cDate, notes, ownerID, meta, name, typeEnum, lastEdited, url, customerReadable, fileLast_Edited, deleted, ddate, storageType, storageInstance, data, filesize, metaUserID, metaDateExpiry, metaTags, metaIncludeInEmail, metaEditNotesInPortal, metaShareWithSites, metaShowInPortal, metaOutsourcing, and metaLinkForm. Raw advanced where shapes are trusted-CRM-only.

Example request

$table = FM_api('Files_getDataTable', [
	'fields' => ['id', 'cDate', 'filename', 'notes', 'meta', 'customerReadable'],
	'typeEnum' => '2',
	'typeId' => '1042',
	'draw' => '3',
	'start' => '0',
	'length' => '25',
]);

Example response

{
  "data": [
    {
      "id": "4821",
      "cDate": "2026-09-20 10:15:00",
      "filename": "asset-photo.jpg",
      "notes": "Service evidence",
      "meta": "{\"user_id\":37,\"tags\":\"service\"}",
      "customerReadable": "0"
    }
  ],
  "draw": 3,
  "recordsTotal": "240",
  "recordsFiltered": "1"
}

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: fields"}Fields are absent.
{"error":"permission denied"}The requested type fails the read guard.

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 from data and counts. recordsTotal counts tenant-wide live files, while recordsFiltered applies relationship, expiry, search, and advanced filters.
  • Table results are paginated; non-table mode is unbounded unless limit is positive. The Job-form expansion removes the exact type filter but retains the resource ID.
  • CRM2 pageFiles_view is evaluated using the requested type before the Job/type-8 expansion.
  • Whole meta remains encoded JSON text. Mapped field names use typeEnum and typeId; snake-case type_enum affects the preliminary guard but is not a mapped relationship filter. Always send the correct camel-case filters.
  • The read guard is evaluated once against the requested type before the query, rather than separately for each returned row. Mixed-type requests do not have the per-row guard used by File_getRequestedDetails.

Side effects

  • Reads mapped database columns without content hydration. Selecting data includes only the saved database bytes and can greatly increase the response.

See it in Fieldmotion

CRM1

No production CRM1 caller was found; CRM1 uses Files_getDT.

CRM2

Open Files for a Customer, Job, Asset, User, or Asset Type; layout fields, search, filters, sorting, and paging feed this endpoint.

Related endpoints