> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go.aiinsurance.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

The Tasks API lets you manage company tasks — simple to-do items with a deadline, a status, optional assignees, and an optional link to another entity (such as a claim or policy).

**Key Concepts:**

* **Status**: Each task has a `status` of either `Not Complete` or `Complete`. New tasks default to `Not Complete`.
* **Deadline**: The `deadline` is an ISO 8601 date-time string and is required when creating a task.
* **Assignees**: `assignees` is a flat list of company user IDs. Every assignee must be a member of the same company — supplying a non-member ID returns a `400` error.
* **Linked entity**: A task may optionally reference another entity via `entity` (`{ type, id, name }`). This is a denormalized snapshot captured at link time. When a task is not linked to anything, `entity` is `null`.
* **Partial updates**: `PATCH` accepts any subset of the mutable fields — only the fields you send are changed. Unknown fields are rejected.
* **Soft delete**: `DELETE` soft deletes the task; it no longer appears in list or get responses.

***

## API Endpoints

The five Tasks endpoints are listed in the left navigation:

* **List Tasks** (`GET /tasks`) - Paginated list with optional filters
* **Create Task** (`POST /tasks`) - Create a new task
* **Get Task** (`GET /tasks/{taskId}`) - Retrieve a task by ID
* **Update Task** (`PATCH /tasks/{taskId}`, `PUT` alias) - Partial update
* **Delete Task** (`DELETE /tasks/{taskId}`) - Soft delete a task

***

## Permissions

| Operation   | Method                   | Required Permission   |
| ----------- | ------------------------ | --------------------- |
| List Tasks  | `GET /tasks`             | `company.task:read`   |
| Get Task    | `GET /tasks/{taskId}`    | `company.task:read`   |
| Create Task | `POST /tasks`            | `company.task:create` |
| Update Task | `PATCH /tasks/{taskId}`  | `company.task:update` |
| Delete Task | `DELETE /tasks/{taskId}` | `company.task:delete` |

***

## Filtering (List Tasks)

| Query Param  | Description                                          |
| ------------ | ---------------------------------------------------- |
| `status`     | Filter by task status (`Not Complete` or `Complete`) |
| `assigneeId` | Filter by assigned company user ID                   |
| `entityType` | Filter by the linked entity's type                   |
| `entityId`   | Filter by the linked entity's ID                     |

***

## Pagination

The list endpoint uses 1-based pagination: `page=1` is the first page. Use `pageSize` to control the number of records per page (default 50).
