When to use this endpoint

Use TaskTypes_getById when IDs are already known and a caller needs a narrow raw projection. CRM1’s task-import email page uses it through the shared TaskType object cache.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional Settings-page, role, create, edit, or delete permission check.

All reads and writes use the authenticated tenant. CRM1 and CRM2 decide whether to show task-type controls, but these handlers do not repeat those client-side checks.

Parameters

ParameterTypeRequiredDescription
idsNative array, JSON array, or nonblank scalarYesTask-type IDs. A JSON array is decoded; another nonblank scalar is wrapped as one ID. Each value is integer-converted. Duplicates are not removed.
fieldsNative array or JSON arrayNoAllowed raw columns: id, name, cdate, and last_edited. Defaults to all. Unknown and duplicate names are ignored.

Example request

$types = FM_api('TaskTypes_getById', [
	'ids' => json_encode(['3', '7']),
	'fields' => json_encode(['id', 'name']),
]);

Example response

[
  {"id": "3", "name": "Customer follow-up"},
  {"id": "7", "name": "Internal review"}
]

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: ids"}ids is absent, blank, null, or cannot be normalized to an array.
{"error":"no fields selected"}fields is supplied but contains no allowed name.
[]The normalized ID array is empty or no row matches.

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

Behaviour and edge cases

  • There is no pagination, ordering, or deleted-state filter. Task types have no deleted column.
  • Rows not found are omitted; input duplicates do not guarantee duplicate output rows because SQL IN has set semantics.
  • Database-backed values remain JSON strings.

See it in Fieldmotion

CRM1

Open Imports → Tasks Email. CRM1’s TaskType.getInstance() batches ID lookups through TaskTypes_getById to display type names.

CRM2

No direct production CRM2 caller was found.

Related endpoints