API Overview

Tasks

Create, read, update, delete, and restore tasks.

Endpoints

MethodPathDescription
GET/api/tasksList all tasks
POST/api/tasksCreate a task
GET/api/tasks/tagsList all unique tags
GET/api/tasks/:idGet a single task
PUT/api/tasks/:idUpdate a task
DELETE/api/tasks/:idSoft-delete a task
POST/api/tasks/:id/restoreRestore a deleted task

All endpoints require authentication.


List Tasks

GET /api/tasks

Return all tasks, ordered by creation date (newest first). Includes related project and creator data.

Query Parameters:

ParameterTypeDescription
includeDeletedbooleanInclude soft-deleted tasks. Default: false
statusstring or stringFilter by status: todo, in_progress, done, blocked. Pass multiple times for OR filtering
projectIdstringFilter by project ID
searchstringSearch title and description (case-insensitive, partial match)

Response: 200 OK

{
  "data": [
    {
      "id": "abc-123",
      "title": "Review PR",
      "status": "todo",
      "priority": 2,
      "tags": ["code-review"],
      "project": { "id": "proj-1", "name": "Backend", "color": "#3b82f6" },
      "creator": { "id": "user-1", "name": "Tony" },
      "createdAt": "2025-01-07T10:00:00.000Z"
    }
  ]
}

Create Task

POST /api/tasks

Create a new task. The authenticated user is recorded as the creator.

Request Body:

FieldTypeRequiredDescription
titlestringYesTask title (trimmed)
descriptionstringNoTask description
statusstringNoOne of todo, in_progress, done, blocked. Default: todo
prioritynumberNo1 (Low), 2 (Medium), 3 (High). Default: 2
projectIdstringNoAssociated project ID
dueDatestringNoISO 8601 date string
tagsstringNoArray of tag strings. Default: []

Response: 200 OK

{
  "data": {
    "id": "abc-123",
    "title": "Review PR",
    "status": "todo",
    "priority": 2,
    "tags": [],
    "project": null,
    "createdAt": "2025-01-07T10:00:00.000Z"
  }
}

List Tags

GET /api/tasks/tags

Return all unique tags used across non-deleted tasks, sorted alphabetically.

Response: 200 OK

{
  "data": ["bug", "code-review", "feature", "urgent"]
}

Get Task

GET /api/tasks/:id

Return a single task with its related project and creator.

Response: 200 OK

{
  "data": {
    "id": "abc-123",
    "title": "Review PR",
    "status": "todo",
    "priority": 2,
    "project": { "id": "proj-1", "name": "Backend", "color": "#3b82f6" },
    "creator": { "id": "user-1", "name": "Tony" }
  }
}

Returns 404 if the task does not exist.


Update Task

PUT /api/tasks/:id

Update one or more fields on a task. Only provided fields are changed.

Request Body:

FieldTypeRequiredDescription
titlestringNoNew title
descriptionstringNoNew description (set null to clear)
statusstringNoNew status
prioritynumberNo1, 2, or 3
projectIdstring or nullNoNew project ID or null to unset
dueDatestring or nullNoISO date or null to clear
tagsstringNoReplace all tags

When status is changed to done, the server automatically sets completedAt. When changed away from done, completedAt is cleared.

Response: 200 OK

{
  "data": {
    "id": "abc-123",
    "title": "Review PR",
    "status": "done",
    "completedAt": "2025-01-07T15:30:00.000Z"
  }
}

Delete Task

DELETE /api/tasks/:id

Soft-delete a task by setting deletedAt. The task is excluded from list results unless ?includeDeleted=true is passed.

Response: 200 OK

{
  "data": {
    "id": "abc-123",
    "title": "Review PR",
    "deletedAt": "2025-01-07T16:00:00.000Z"
  }
}

Restore Task

POST /api/tasks/:id/restore

Restore a soft-deleted task by clearing deletedAt.

Returns 400 if the task is not currently deleted.

Response: 200 OK

{
  "data": {
    "id": "abc-123",
    "title": "Review PR",
    "deletedAt": null
  }
}