When to use this endpoint

Use Asset_emailsGetDT for the CRM1 asset Emails table and its resend workflow.

This is a display feed, not a general mail search: candidate owner mail is fetched and then retained only when its linked job belongs directly to the asset.

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
startInteger stringYesZero-based offset. The handler checks this before its explicit login call.
cidInteger stringYesPositive asset ID, despite the customer-like wire name. The asset is read without a deleted filter.
lengthInteger stringNoPage size; defaults to 10. An explicit zero remains zero.
drawInteger stringNoDataTables token; defaults to 0.
dateFromDate stringNoShape YYYY-MM-DD; invalid or omitted values become the server’s current date. Calendar validity is not checked.
dateToDate stringNoSame shape/default as dateFrom. The handler adds one day and uses an inclusive <= comparison.
search[value]StringNoSubstring matched against stored recipients, raw metadata, or mail ID.
order[0][column]Integer stringNo0 ID, 1 created, 2 sent, 3 status, 7 type, or 9 user; defaults to sent date.
order[0][dir]StringNoExact desc selects descending; otherwise ascending.

Example request

$page = FM_api('Asset_emailsGetDT', [
	'cid' => '4821',
	'draw' => '1',
	'start' => '0',
	'length' => '25',
	'dateFrom' => '2026-09-01',
	'dateTo' => '2026-09-24',
	'order' => [['column' => '2', 'dir' => 'desc']],
]);

Example response

{
  "draw": 1,
  "recordsTotal": "320",
  "recordsFiltered": "2",
  "data": [
    [8821, "2026-09-24 10:15:00", "2026-09-24 10:16:00", "1", "Service report", "JOB-7719", 43, "Job Report", "[\"ops@example.test\"]", "37", 7719, "Job completed", "37", "Triggered by completion"]
  ]
}

Rows are [mailId, createdAt, sentAt, status, subject, jobRef, templateId, typeLabel, recipientsJson, userId, jobId, triggerLabel, triggerUserId, triggerHeader]. recipientsJson is a JSON-encoded array inside the outer JSON response.

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: start"}start is absent.
{"error":"missing or invalid parameter: cid"}cid is absent, zero, or otherwise not positive.
{"error":"asset does not exist"}No asset row exists for cid. A soft-deleted row still counts as existing.

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

Behaviour and edge cases

  • When the asset has an owner, candidate mail may target either the owner ID or the asset ID; otherwise it must target the asset ID. In all cases the stored mail customer type must be Asset.
  • The upper date boundary includes the next day at exactly midnight because the incremented date is compared with <=. Dates use server date parsing rather than the tenant timezone helper.
  • recordsTotal counts every mail row in the tenant, not only asset mail.
  • Legacy rows may derive a recipient from a linked job when no recipient list was stored. Subject and creation metadata variables are not reset at the start of each loop, so malformed consecutive rows can inherit values from the preceding row.
  • Mail and job lookups do not exclude deleted rows. This endpoint does not resend or otherwise mutate mail.

See it in Fieldmotion

CRM1

Open an asset’s Emails tab and filter Network requests for Asset_emailsGetDT. The Resend button makes a separate Email_resend call.

CRM2

No direct production CRM2 caller was found.

Related endpoints

  • Asset_listJobs returns only direct, non-deleted job IDs for an asset.