# Get Tasks

Source: https://help.zira.us/developers/api-reference/get-tasks
Summary: List tasks the API key can see, a page at a time.
Updated: 2026-08-06

## `GET /tasks`

Use this endpoint to browse or sync tasks. Results are paged with a cursor, and you can narrow them by site, status, priority, assignee or type.

## Authentication

```http
x-api-key: <your-api-key>
```

See [API Authentication](/developers/api-reference/api-authentication) for how to create a key.

## Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | number | no | Page size. Always send it, so that a missing `lastValue` reliably means you have reached the end. |
| `lastValue` | string | no | Cursor for the next page. Pass the `lastValue` from the previous response back verbatim. |
| `textSearch` | string | no | Free-text search over task names. Keep sending the same `textSearch` while paging through its results. |
| `sortDesc` | boolean | no | Reverse the sort order. |
| `siteIds` | string | no | Comma-separated site IDs to filter by, e.g. `1512,1513`. |
| `statusIds` | string | no | Comma-separated status IDs to filter by, e.g. `5,15`. |
| `priorityIds` | string | no | Comma-separated priority IDs to filter by — `5` Low, `10` Medium, `15` High. |
| `assigneeIds` | string | no | Comma-separated user IDs to filter by assignee. |
| `typeIds` | string | no | Comma-separated task type IDs to filter by. |

## Response

`200 OK`

Returns a page of task objects in `data`, with an opaque `lastValue` cursor beside it. Each task carries its status, site, priority and assignee as small `{ id, name }` objects, and the assignee is expanded with their name, email and avatar URLs.

```json
{
  "data": [
    {
      "id": "9901",
      "name": "Replace inlet filter on Line 1",
      "description": "Differential pressure above threshold for two shifts.",
      "dueDate": "2026-01-20",
      "doneDate": null,
      "progressDate": null,
      "timeSpent": "@ 0",
      "formatedTimeSpent": "0h:0m",
      "timeToRespond": null,
      "timeToResolve": null,
      "timeToDueDate": "6d:0h:0m",
      "assignee": {
        "id": "318",
        "firstName": "Alex",
        "lastName": "Rivera",
        "name": "Alex Rivera",
        "image": {
          "id": "20514",
          "url": "https://prod-images-zira.s3.us-west-2.amazonaws.com/<hash>?X-Amz-Expires=604800&X-Amz-Signature=<signature>&x-id=GetObject",
          "thumbnailUrl": "https://prod-images-zira.s3.us-west-2.amazonaws.com/<hash>_thumbnail?X-Amz-Expires=604800&X-Amz-Signature=<signature>&x-id=GetObject"
        },
        "channelId": "3024",
        "username": "alex.rivera@example.com",
        "email": "alex.rivera@example.com"
      },
      "status": {
        "id": "5",
        "name": "To Do"
      },
      "site": {
        "id": "1512",
        "name": "Fresno Plant",
        "channelId": "45187"
      },
      "system": null,
      "device": null,
      "priority": {
        "id": "10",
        "name": "Medium"
      },
      "type": {
        "id": "1",
        "name": "Manual"
      },
      "auditInfo": {
        "createdBy": {
          "id": "318"
        },
        "createdDate": "2026-01-14T09:15:00.000000Z",
        "lastModifiedBy": {
          "id": "318"
        },
        "lastModifiedDate": "2026-01-14T09:15:00.000000Z"
      },
      "timeSpentMandatory": false,
      "resolution": null,
      "resolutionDescription": null,
      "cost": null,
      "estimatedTime": null,
      "postId": 240873,
      "hashtags": null
    }
  ],
  "lastValue": "eyJhdWRpdEluZm8uY3JlYXRlZERhdGUiOiIyMDI2LTAxLTE0VDA5OjE1OjAwWiIsImlkIjoiOTkwMSJ9"
}
```

| Field | Type | Description |
| --- | --- | --- |
| `data` | array (nullable) | A page of tasks. `null` — not an empty array — when nothing matched. |
| `data[].id` | string | Task ID, as a string. |
| `data[].name` | string | Task title. |
| `data[].description` | string (nullable) | Plain-text description. |
| `data[].dueDate` | string (nullable) | Due date, as `YYYY-MM-DD`. |
| `data[].doneDate` | string (nullable) | When the task was completed. `null` while it is still open. |
| `data[].timeSpent` | string | Raw accumulated time. `formatedTimeSpent` is the display form, e.g. `2h:15m`. |
| `data[].timeToResolve` | string (nullable) | How long the task took to close, e.g. `19d:8h:27m`. `null` until it is done. |
| `data[].assignee` | object (nullable) | The assigned user, expanded with `name`, `email`, `channelId` and an `image` holding ready-to-use `url` and `thumbnailUrl`. |
| `data[].status` | object | `{ id, name }`, e.g. `To Do`, `On Hold`, `Done`. |
| `data[].site` | object | `{ id, name, channelId }` for the site that owns the task. |
| `data[].priority` | object (nullable) | `{ id, name }` — `5` Low, `10` Medium, `15` High. |
| `data[].type` | object | `{ id, name }` — `1` Manual, `3` for a task tied to a data source. |
| `data[].device` | object (nullable) | The data source the task is about, when it has one. |
| `data[].auditInfo` | object | `createdBy`, `createdDate`, `lastModifiedBy`, `lastModifiedDate`. |
| `data[].postId` | number | ID of the feed post Zira created for this task. A number, while `id` is a string. |
| `lastValue` | string | Opaque cursor for the next page. Pass it back as `?lastValue=…`. |

### Good to know

- Tasks carry a long tail of optional fields that are `null` on most installations — `taskType2`, `department`, `workCenter`, `attr1`–`attr3`, `assignee2`–`assignee4`, `category`, `application`. They are omitted from the example above but do appear in the payload.
- New fields get added to tasks over time, so parse defensively rather than rejecting unknown keys.
- IDs are strings, except `postId`, which is a number. Convert before comparing.
- Image and file URLs are pre-signed and time-limited — fetch them soon after reading, and re-request the task rather than storing them.
- Do not treat the presence of `lastValue` as proof that more data exists. Keep paging until `data` comes back `null`, or until you receive fewer rows than the `limit` you asked for.
- An empty page is `{"data": null}`, not `{"data": []}`.

## Errors

Failures return a JSON body with a `message` and an `internalErrorCode`, at the status shown below. Whenever the underlying error carries structured detail — which every schema-validation failure does — the body is replaced with a generic `Internal server error.` / `02-001` pair while the real status code is kept. Branch on the HTTP status and on `internalErrorCode`; never parse the message text.

```json
{
  "message": "Internal server error.",
  "internalErrorCode": "02-001"
}
```

| Status | Meaning |
| --- | --- |
| `400` | The request failed validation — a missing required field, a field the schema does not allow, an unparseable body, a value out of range, or a malformed `lastValue`. |
| `401` | The API key resolved to a user context that is not allowed to read or write the record you asked for. |
| `403` | The `x-api-key` header is missing or is not a recognised key. API Gateway rejects the call before the endpoint runs, so the body is only `{"message":"Forbidden"}`. |
| `409` | The write conflicts with an existing record, or it references a record that does not exist. |
| `429` | The API key exceeded the rate limit or quota on its usage plan. Also returned by API Gateway rather than the endpoint. |
| `500` | Unexpected server error, or the database returned no result where one was required. |
