Tasks
Retrieve selected tasks by ID
/a/Tasks_getById
Fetch selected columns for a batch of active task IDs without applying UI visibility rules.
When to use this endpoint
Use Tasks_getById when IDs are already known and a caller needs a narrow set of raw task columns. Use Task_getRequestedDetails for mapped field names and linked-job information.
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 task, page, role, ownership, or privacy-permission check.
All rows come from the authenticated tenant. Unless the page says otherwise, IDs, creator, assignee, and privacy do not restrict the result at handler level.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Native array or JSON array | Yes | Task IDs. Values are integer-coerced and deduplicated. Supply a nonempty array; a scalar string is not a supported shorthand. |
fields | Native array or JSON array | No | Selected raw columns. Defaults to every allowed field: appId, assigned_date, assigned_to, cdate, client_id, created_by, details, due_date, edited_uuid, id, last_edited, meta, privacy, resolution, status, subject, time_spent, and type. Unknown and duplicate names are ignored. |
Example request
$tasks = FM_api('Tasks_getById', [
'ids' => json_encode(['318', '319']),
'fields' => json_encode(['id', 'subject', 'status', 'last_edited']),
]);
Example response
[
{
"id": "318",
"subject": "Confirm access details",
"status": "1",
"last_edited": "2026-09-28 10:42:16"
}
]
Rows that are missing, soft-deleted, or outside the tenant are omitted. Database-backed values remain JSON strings.
Errors and unusual responses
| Response | Condition |
|---|---|
{"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. |
{"error":"no fields selected"} | fields is supplied but does not contain an allowed name. |
[] | No active task matches the normalized IDs. |
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 query has no pagination and no
ORDER BY; do not assume request order or database order. - Privacy, creator, and assignee are not checked. Soft-deleted tasks are excluded.
- A malformed scalar or empty ID collection is not cleanly validated and can lead to warnings or a database-query error; send a nonempty array.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found; CRM1 batches editor lookups through Tasks_getDetails.
CRM2
The shared CRM2 Task object uses Tasks_getById to batch raw task lookups by ID.
Related endpoints
Tasks_getDetailsreturns CRM1’s fixed legacy detail projection.Task_getRequestedDetailsuses mapped field names and can append linked jobs.