# Tasks

Find, assign, update, complete, and reopen tasks in ShelfCycle.

Canonical HTML: https://developer.shelfcycle.com/guides/tasks

Create follow-ups for yourself or teammates, track due dates, and complete work from a connected workflow.

| Endpoint | Scope | Use it for |
| --- | --- | --- |
| `GET /tasks` | `tasks:read` | Find tasks assigned to you or created by you. |
| `GET /tasks/{id}` | `tasks:read` or `tasks:write` | Read one task and its current `updatedAt`. |
| `POST /tasks` | `tasks:write` | Create a personal or record-linked task. |
| `PATCH /tasks/{id}` | `tasks:write` | Edit its details, due day, or assignee. |
| `POST /tasks/{id}/complete` | `tasks:write` | Mark the task complete. |
| `POST /tasks/{id}/reopen` | `tasks:write` | Return the task to open status. |

Task access follows the person associated with the API key. That person can read and maintain tasks they created or that are assigned to them. Approval tasks are outside these endpoints. An unavailable task returns `404 not_found` on detail and execution when the request meets the route's input requirements.

`GET /me` reports task capabilities in `data.effectiveCapabilities.tasks` and write availability in `data.effectiveCapabilities.writeReadiness.tasks`. Use `dryRun=true` to check a specific write. The task `view` capability can indicate detail access through a write-only key. Listing requires `tasks:read`. Full-access keys include both scopes.

## Find tasks

`scope=assignedToMe` is the default. Use `assignedByMe` for tasks you created or `mine` for either. `status` defaults to `open` and also accepts `completed` and `all`. Use `assignedToId` to narrow the visible tasks to one teammate and `query` to match title or description. To filter by a linked record, send `recordType` and `recordId` together. Read filters accept `customer`, `supplier`, `opportunity`, and `work_order`. An inaccessible customer, supplier, or opportunity filter returns `404 not_found`.

```bash
curl "$SHELFCYCLE_API_BASE_URL/tasks?scope=mine&status=open&overdue=true&limit=50" \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY"
```

`dueFrom` and `dueTo` are inclusive organization calendar days. `overdue=true` selects open tasks due before `meta.today` in the organization's time zone. Read `dueOn` for the calendar day and `dueAt` for the stored timestamp. `completedAt` is null while a task is open.

The default sort uses the due day. Use `sortBy=updatedAt` to order by the last update. The default `limit` is 50 and the maximum is 100. Send `meta.nextCursor` as `cursor` with the same filters, sort, and limit. Stop when it is null. `meta.total` covers all matching tasks visible to the key's user.

Use inclusive `changedFrom` and exclusive `changedTo` to find tasks by their own `updatedAt`. Send either bound or both, with ISO timestamps and an offset. Paired bounds can span up to 366 days. Use `scope=mine&status=all` when refreshing both visible task sets across all statuses. The window has a fixed `meta.snapshotAt` cutoff across pages. Follow the polling guidance in [Finders](/guides/finders). When a task is deleted in the app or leaves the user's view, it stops appearing. An omitted task does not establish deletion.

Task rows include the assignee, creator, and linked record when present. Customer, supplier, and opportunity names and links follow the reader's access to those records. A linked work order returns its type and ID.

## Create and assign a task

Send `title` and optionally `description`, `dueOn`, `assignee`, and `record`. `dueOn` is a calendar day in `YYYY-MM-DD` format. Omit `assignee` to assign the task to the key's user. Use `null` to leave it unassigned or send exactly one of `{userId}` and `{email}` to assign an eligible teammate. A linked `record` needs a visible customer, supplier, or opportunity and its ID. Creating a task on an archived customer or supplier returns `422 archived_record`. Omit `record` for a personal task.

```bash
curl "$SHELFCYCLE_API_BASE_URL/tasks?dryRun=true" \
  -X POST \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: customer-follow-up:2026-11-20" \
  -d '{
    "title": "Follow up on the sample request",
    "dueOn": "2026-11-20",
    "record": {"type": "customer", "id": "00000000-0000-4000-8000-000000000401"}
  }'
```

Replace the example ID with the selected customer's UUID. After a ready preview, repeat the request without `dryRun=true`. A successful creation returns `201` and `idempotencyStatus: "created"`. An identical request for an existing visible task returns `200` and `"replayed"`. A changed body with the same key returns `409 idempotency_key_reused`. If a task was deleted in the app, executing the original create again can create it again.

Assigned tasks appear in the assignee's Inbox. Assigning a task to someone else can notify them in the app. Task assignment sends no email.

## Update task details

Read `GET /tasks/{id}`, then use its `updatedAt` as `If-Match` on PATCH. Supply any of `title`, `description`, `dueOn`, and `assignee`. Omitted fields keep their values. Set `dueOn: null` to clear the due date or `assignee: null` to unassign the task. The linked record stays as created. Preview with `dryRun=true` and the intended body and timestamp.

A missing or stale version returns `409 stale_record` on execution. Read again before applying a changed request. An update with no actual changes returns `idempotencyStatus: "unchanged"`. If reassigning a task leaves you neither its assignee nor its creator, the write returns the updated task and subsequent reads lose access to it.

## Complete or reopen a task

Send POST to `/tasks/{id}/complete` or `/tasks/{id}/reopen` with no body or `{}`. Both support `dryRun=true` and take no `If-Match` or `Idempotency-Key`. Repeating the action when the task is already in the requested state returns `200` and `idempotencyStatus: "unchanged"`.
