When to use this endpoint

Use Customer_emailsGetDataTable only for consumers that need the generic mail-field contract. Despite its namespace, it is tenant-wide unless customerID and usually customerType are supplied.

For the established CRM1 customer email-history rows and compatibility fallbacks, use Customer_emailsGetDT.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
fieldsForm arrayYesRequested aliases from id, cDate, cDateE, sentDate, sentDate_E, status, type, meta, customerID, customerType, userID, recipients, objType, objID, and qmID. Unknown names are ignored; id is always added. Send an actual form array, not a JSON string.
isTableInteger stringNoDefaults to 1. Set 0 for an unwrapped data result without DataTables counts or paging.
startInteger stringNoZero-based offset in table mode; defaults to 0.
lengthInteger stringNoPage size in table mode; defaults to 10.
drawInteger stringNoDataTables request counter; defaults to 0.
limitInteger stringNoPositive limit used only when isTable=0. Without it, non-table mode has no limit.
orderBy / orderDescStringNoNamed-field sort pair. orderBy is case-insensitively resolved to an allowed alias; use asc or desc for orderDesc. Both must be present to use this form.
order[0][column] / order[0][dir]Integer string / stringNoDataTables alternative. The implementation subtracts one from the column index before selecting from fields; missing values sort by the first allowed requested field ascending.
Field filtersScalar or form arrayNoAny allowed field alias can also be a filter. Text/date aliases use case-insensitive substring matching for scalar values; numeric aliases use exact integer matching. Arrays become IN filters.
searchValueStringNoCase-insensitive substring search over all mapped fields, or only searchField.
searchFieldString or form arrayNoOne or more exact aliases for searchValue; defaults to All.
referenceDateStringNoMapped date alias used by relative date/time controls, for example sentDate. Unknown aliases disable those controls.
dateFrom / dateToInteger stringsWith referenceDateRelative day offsets from today in the tenant timezone. Both must be present. Datetime fields use inclusive day start/end boundaries.
offsetFrom / offsetToForm objectsNoOptional hour and minute adjustments to the relative date boundaries.
timeRangeFrom / timeRangeToInteger stringsNoInclusive hours for the reference date in the tenant timezone; reversed endpoints are swapped. timeRangeFrom must be present to activate the range; timeRangeTo alone is ignored.
groupByForm arrayNoAllowed field aliases to group by. This changes SQL grouping but does not provide aggregate fields.

Example request

$emails = FM_api('Customer_emailsGetDataTable', [
	'fields' => ['id', 'sentDate', 'status', 'meta', 'recipients'],
	'customerID' => '1088',
	'customerType' => '0',
	'start' => '0',
	'length' => '25',
	'draw' => '9',
	'orderBy' => 'sentDate',
	'orderDesc' => 'desc',
]);

Example response

{
  "data": [
    {
      "id": "501",
      "sentDate": "2026-09-24 11:01:02",
      "status": "2",
      "meta": "{\"job_id\":7204}",
      "recipients": "[\"ops@example.test\"]",
      "jobReference": "JOB-7204"
    }
  ],
  "draw": 9,
  "recordsTotal": "320",
  "recordsFiltered": "1"
}

Response rows are objects keyed by requested aliases; stored JSON such as meta and recipients remains encoded text. jobReference is added by reading meta.job_id and looking up the job.

Include meta when job references are needed. The post-processing code reads it even when not selected, so omitting it can produce a warning and leaves jobReference blank.

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 is absent.
{"error":"error in database query"}The generic field, grouping, or ordering combination produces an invalid query.

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 mail table is not in the generic helper’s soft-delete allowlist, so no deletion predicate is added.
  • In table mode, recordsTotal is every tenant mail row and recordsFiltered applies supplied filters. In non-table mode only data is returned.
  • Unknown requested fields are silently ignored. An empty or all-unknown field array still selects id automatically.
  • This endpoint exposes generic advanced-search controls inherited from the shared data processor. They are an internal CRM contract and are intentionally not presented as a supported integration interface here.

See it in Fieldmotion

CRM1

A source search found no CRM1 production caller for Customer_emailsGetDataTable. The customer Email History page uses Customer_emailsGetDT instead.

CRM2

A source search found no CRM2 production caller for this endpoint.

Related endpoints