# Tasks

Task management operations

## List all tasks

> Returns all tasks accessible to the authenticated user within their organization

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"TaskWithRelations":{"allOf":[{"$ref":"#/components/schemas/Task"},{"type":"object","properties":{"assignee":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"username":{"type":"string"},"fullName":{"type":"string"}}},"project":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"title":{"type":"string"}}},"milestone":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"title":{"type":"string"}}}}}]},"Task":{"type":"object","required":["id","title","status","priority","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique task identifier"},"title":{"type":"string","description":"Task title"},"description":{"type":"string","nullable":true,"description":"Task description"},"projectId":{"type":"integer","nullable":true,"description":"Associated project ID"},"organizationId":{"type":"integer","nullable":true,"description":"Associated organization ID"},"milestoneId":{"type":"integer","nullable":true,"description":"Associated milestone ID"},"phaseId":{"type":"integer","nullable":true,"description":"Associated phase ID"},"order":{"type":"integer","description":"Display order within the list"},"assigneeId":{"type":"integer","nullable":true,"description":"User ID of assignee"},"status":{"type":"string","enum":["todo","in_progress","review","completed"],"description":"Task status"},"priority":{"type":"string","enum":["low","medium","high"],"description":"Task priority"},"dueDate":{"type":"string","format":"date-time","nullable":true,"description":"Task due date"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/tasks":{"get":{"tags":["Tasks"],"summary":"List all tasks","description":"Returns all tasks accessible to the authenticated user within their organization","operationId":"listTasks","responses":{"200":{"description":"List of tasks","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaskWithRelations"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Access denied"},"500":{"description":"Server error"}}}}}}
```

## Create a new task

> Creates a new task within a project or organization

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"TaskCreate":{"type":"object","required":["title","status","priority"],"properties":{"title":{"type":"string","description":"Task title"},"description":{"type":"string","nullable":true,"description":"Task description"},"projectId":{"type":"integer","nullable":true,"description":"Project to associate with"},"organizationId":{"type":"integer","nullable":true,"description":"Organization to associate with"},"milestoneId":{"type":"integer","nullable":true,"description":"Milestone to associate with"},"phaseId":{"type":"integer","nullable":true,"description":"Phase to associate with"},"assigneeId":{"type":"integer","nullable":true,"description":"User to assign the task to"},"status":{"type":"string","enum":["todo","in_progress","review","completed"]},"priority":{"type":"string","enum":["low","medium","high"]},"dueDate":{"type":"string","format":"date-time","nullable":true,"description":"Due date (ISO 8601 format)"}}},"Task":{"type":"object","required":["id","title","status","priority","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique task identifier"},"title":{"type":"string","description":"Task title"},"description":{"type":"string","nullable":true,"description":"Task description"},"projectId":{"type":"integer","nullable":true,"description":"Associated project ID"},"organizationId":{"type":"integer","nullable":true,"description":"Associated organization ID"},"milestoneId":{"type":"integer","nullable":true,"description":"Associated milestone ID"},"phaseId":{"type":"integer","nullable":true,"description":"Associated phase ID"},"order":{"type":"integer","description":"Display order within the list"},"assigneeId":{"type":"integer","nullable":true,"description":"User ID of assignee"},"status":{"type":"string","enum":["todo","in_progress","review","completed"],"description":"Task status"},"priority":{"type":"string","enum":["low","medium","high"],"description":"Task priority"},"dueDate":{"type":"string","format":"date-time","nullable":true,"description":"Task due date"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/tasks":{"post":{"tags":["Tasks"],"summary":"Create a new task","description":"Creates a new task within a project or organization","operationId":"createTask","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskCreate"}}}},"responses":{"200":{"description":"Task created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"400":{"description":"Validation error"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"500":{"description":"Server error"}}}}}}
```

## Delete a task

> Deletes a task

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}}},"paths":{"/tasks/{id}":{"delete":{"tags":["Tasks"],"summary":"Delete a task","description":"Deletes a task","operationId":"deleteTask","parameters":[{"name":"id","in":"path","required":true,"description":"Task ID","schema":{"type":"integer"}}],"responses":{"204":{"description":"Task deleted successfully"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"404":{"description":"Task not found"},"500":{"description":"Server error"}}}}}}
```

## Update a task

> Updates an existing task

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"TaskUpdate":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string","nullable":true},"milestoneId":{"type":"integer","nullable":true},"phaseId":{"type":"integer","nullable":true},"assigneeId":{"type":"integer","nullable":true},"status":{"type":"string","enum":["todo","in_progress","review","completed"]},"priority":{"type":"string","enum":["low","medium","high"]},"dueDate":{"type":"string","format":"date-time","nullable":true},"order":{"type":"integer"}}},"Task":{"type":"object","required":["id","title","status","priority","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique task identifier"},"title":{"type":"string","description":"Task title"},"description":{"type":"string","nullable":true,"description":"Task description"},"projectId":{"type":"integer","nullable":true,"description":"Associated project ID"},"organizationId":{"type":"integer","nullable":true,"description":"Associated organization ID"},"milestoneId":{"type":"integer","nullable":true,"description":"Associated milestone ID"},"phaseId":{"type":"integer","nullable":true,"description":"Associated phase ID"},"order":{"type":"integer","description":"Display order within the list"},"assigneeId":{"type":"integer","nullable":true,"description":"User ID of assignee"},"status":{"type":"string","enum":["todo","in_progress","review","completed"],"description":"Task status"},"priority":{"type":"string","enum":["low","medium","high"],"description":"Task priority"},"dueDate":{"type":"string","format":"date-time","nullable":true,"description":"Task due date"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/tasks/{id}":{"patch":{"tags":["Tasks"],"summary":"Update a task","description":"Updates an existing task","operationId":"updateTask","parameters":[{"name":"id","in":"path","required":true,"description":"Task ID","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskUpdate"}}}},"responses":{"200":{"description":"Task updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"400":{"description":"Validation error"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"404":{"description":"Task not found"},"500":{"description":"Server error"}}}}}}
```

## Reorder tasks

> Updates the order of multiple tasks

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}}},"paths":{"/tasks/reorder":{"patch":{"tags":["Tasks"],"summary":"Reorder tasks","description":"Updates the order of multiple tasks","operationId":"reorderTasks","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tasks"],"properties":{"tasks":{"type":"array","items":{"type":"object","required":["id","order"],"properties":{"id":{"type":"integer"},"order":{"type":"integer"}}}}}}}}},"responses":{"200":{"description":"Tasks reordered successfully"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"500":{"description":"Server error"}}}}}}
```

## List tasks for a project

> Returns all tasks associated with a specific project

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"TaskWithRelations":{"allOf":[{"$ref":"#/components/schemas/Task"},{"type":"object","properties":{"assignee":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"username":{"type":"string"},"fullName":{"type":"string"}}},"project":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"title":{"type":"string"}}},"milestone":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"title":{"type":"string"}}}}}]},"Task":{"type":"object","required":["id","title","status","priority","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique task identifier"},"title":{"type":"string","description":"Task title"},"description":{"type":"string","nullable":true,"description":"Task description"},"projectId":{"type":"integer","nullable":true,"description":"Associated project ID"},"organizationId":{"type":"integer","nullable":true,"description":"Associated organization ID"},"milestoneId":{"type":"integer","nullable":true,"description":"Associated milestone ID"},"phaseId":{"type":"integer","nullable":true,"description":"Associated phase ID"},"order":{"type":"integer","description":"Display order within the list"},"assigneeId":{"type":"integer","nullable":true,"description":"User ID of assignee"},"status":{"type":"string","enum":["todo","in_progress","review","completed"],"description":"Task status"},"priority":{"type":"string","enum":["low","medium","high"],"description":"Task priority"},"dueDate":{"type":"string","format":"date-time","nullable":true,"description":"Task due date"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/projects/{projectId}/tasks":{"get":{"tags":["Tasks"],"summary":"List tasks for a project","description":"Returns all tasks associated with a specific project","operationId":"listProjectTasks","parameters":[{"name":"projectId","in":"path","required":true,"description":"Project ID","schema":{"type":"integer"}}],"responses":{"200":{"description":"List of project tasks","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaskWithRelations"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Access denied"},"404":{"description":"Project not found"},"500":{"description":"Server error"}}}}}}
```

## Update task phase

> Moves a task to a different phase

```json
{"openapi":"3.0.3","info":{"title":"Kaana Tasks API","version":"1.0.0"},"tags":[{"name":"Tasks","description":"Task management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}}},"paths":{"/tasks/{taskId}/phase":{"patch":{"tags":["Tasks"],"summary":"Update task phase","description":"Moves a task to a different phase","operationId":"updateTaskPhase","parameters":[{"name":"taskId","in":"path","required":true,"description":"Task ID","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phaseId":{"type":"integer","nullable":true,"description":"New phase ID (null to remove from phase)"}}}}}},"responses":{"200":{"description":"Task phase updated successfully"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"404":{"description":"Task not found"},"500":{"description":"Server error"}}}}}}
```
