openapi: 3.1.0
info:
  title: Taskie Public API
  version: 0.2.0
  description: |
    REST API for user-scoped Taskie tasks and notes automation.

    **Task placement:** create and update use `columnId` (board column id, preferred for
    custom columns) or `role` (`start` | `active` | `done`). When neither is set on create,
    the task lands on the workspace **start** column. Sending legacy `status`
    (`to-do` / `waiting` / `in-progress` / `completed`) returns `400 invalid_status`.

    Response `status` is a slug of the board column label (for example `drafting`), not a
    fixed enum. Responses also include `columnId`, `columnLabel`, and `columnRole`.

    **Optional client metadata** (audit only, not authorization):
    `X-Taskie-Client`, `X-Taskie-Client-Version`, `X-Taskie-Device-Id`.

    Notes and tasks both accept shared workspaces the key owner is an active member of.
servers:
  - url: https://app.gettaskie.com/api/v1
    description: Production
  - url: https://app-dev.gettaskie.com/api/v1
    description: Development
  - url: http://localhost:3000/api/v1
    description: Local development
security:
  - bearerApiKey: []
  - headerApiKey: []
tags:
  - name: Workspaces
  - name: Tasks
  - name: Notes
  - name: Notifications
paths:
  /workspaces:
    get:
      tags:
        - Workspaces
      summary: List owned and shared workspaces
      operationId: listWorkspaces
      parameters:
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Workspaces returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListWorkspacesResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
  /workspaces/{workspaceId}/members:
    get:
      tags:
        - Workspaces
      summary: List workspace members
      operationId: listWorkspaceMembers
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace id, slug, or name.
          schema:
            type: string
            example: default
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Workspace members returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListWorkspaceMembersResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /workspaces/{workspaceId}/columns:
    get:
      tags:
        - Workspaces
      summary: List board columns
      description: |
        Returns board columns for a workspace the API key owner owns or is a member of.
        Use `columns[].id` as `columnId` when creating or updating tasks.
      operationId: listWorkspaceColumns
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace id, slug, or name.
          schema:
            type: string
            example: default
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Board columns returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListWorkspaceColumnsResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /workspaces/{workspaceId}/projects:
    get:
      tags:
        - Workspaces
      summary: List workspace projects
      description: |
        Returns projects for a workspace the API key owner owns or is a member of.
        Use `projects[].id` as `projectId` when creating, updating, or filtering tasks.
      operationId: listWorkspaceProjects
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace id, slug, or name.
          schema:
            type: string
            example: default
        - name: includeArchived
          in: query
          required: false
          description: When `true`, include archived projects. Default is active only.
          schema:
            type: boolean
            default: false
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Workspace projects returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListWorkspaceProjectsResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Workspaces
      summary: Create a workspace project
      description: |
        Creates an active project. Names are unique among active projects in the
        workspace (name max 60 characters; optional description max 150;
        soft cap 50 active projects). Rename, edit description, and archive
        remain in the Taskie app.
      operationId: createWorkspaceProject
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace id, slug, or name.
          schema:
            type: string
            example: default
        - $ref: "#/components/parameters/IdempotencyKey"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWorkspaceProjectRequest"
      responses:
        "201":
          description: Project created.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateWorkspaceProjectResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          description: Active project name already exists.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "500":
          $ref: "#/components/responses/InternalError"
  /tasks:
    get:
      tags:
        - Tasks
      summary: List tasks
      operationId: listTasks
      parameters:
        - $ref: "#/components/parameters/Workspace"
        - $ref: "#/components/parameters/Query"
        - name: projectId
          in: query
          required: false
          description: |
            Filter to tasks in one project. Resolve ids via
            `GET /workspaces/{workspaceId}/projects`.
          schema:
            type: integer
            minimum: 1
            example: 1
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Tasks returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListTasksResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Tasks
      summary: Create a task
      description: |
        Place the task with optional `columnId` or `role` (defaults to start).
        Resolve real `columnId` values via `GET /workspaces/{workspaceId}/columns`.
        Do not send `status`; it returns `400 invalid_status`.
      operationId: createTask
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTaskRequest"
            examples:
              minimal:
                summary: Recommended (Swagger) — role only
                value:
                  workspace: default
                  title: Follow up with Acme
                  description: Send the updated proposal.
                  role: start
                  priority: medium
                  dueDate: "2026-09-30"
              byColumnId:
                summary: Place by real columnId (from a task response)
                value:
                  workspace: default
                  title: Draft proposal
                  columnId: bc_replace_with_real_column_id
                  priority: high
      responses:
        "201":
          description: Task created.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
  /tasks/counts:
    get:
      tags:
        - Tasks
      summary: Get task counts
      operationId: getTaskCounts
      parameters:
        - name: workspace
          in: query
          required: false
          description: Workspace id, slug, name, or `all`. Defaults to all workspaces.
          schema:
            type: string
            example: all
        - name: today
          in: query
          required: false
          description: Client-local date used for due-today and overdue counts.
          schema:
            type: string
            format: date
            example: "2026-09-14"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Task counts returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskCountsResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
  /tasks/{taskId}:
    get:
      tags:
        - Tasks
      summary: Get a task
      operationId: getTask
      parameters:
        - name: taskId
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
        - $ref: "#/components/parameters/Workspace"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Task returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
    patch:
      tags:
        - Tasks
      summary: Update a task
      description: |
        Move the task with optional `columnId` or `role`. Resolve real `columnId`
        values via `GET /workspaces/{workspaceId}/columns`. Do not send `status`;
        it returns `400 invalid_status`. Assignee cannot be changed via this endpoint.
      operationId: updateTask
      parameters:
        - name: taskId
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTaskRequest"
            examples:
              moveByRole:
                summary: Recommended (Swagger) — role only
                value:
                  workspace: default
                  role: active
                  priority: high
              moveByColumnId:
                summary: Move by real columnId (from a task response)
                value:
                  workspace: default
                  columnId: bc_replace_with_real_column_id
      responses:
        "200":
          description: Task updated.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /notifications:
    get:
      tags:
        - Notifications
      summary: List unread assignment notifications
      description: |
        Returns recent unread `task.assigned` notifications for the API-key owner.
        Read-only; consuming this list does not mark in-app notifications as read.
      operationId: listNotifications
      parameters:
        - name: sinceId
          in: query
          required: false
          description: Return matching notifications newer than this id.
          schema:
            type: integer
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Notifications returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListNotificationsResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
  /notes:
    get:
      tags:
        - Notes
      summary: List notes
      description: List notes in a workspace the key owner owns or is a member of.
      operationId: listNotes
      parameters:
        - $ref: "#/components/parameters/Workspace"
        - $ref: "#/components/parameters/Query"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Notes returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListNotesResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Notes
      summary: Create a note
      description: Create a note in a workspace the key owner owns or is a member of.
      operationId: createNote
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateNoteRequest"
      responses:
        "201":
          description: Note created.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NoteResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /notes/{noteId}:
    get:
      tags:
        - Notes
      summary: Get a note
      description: Get a note in a workspace the key owner owns or is a member of.
      operationId: getNote
      parameters:
        - name: noteId
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
        - $ref: "#/components/parameters/Workspace"
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      responses:
        "200":
          description: Note returned.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NoteResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
    patch:
      tags:
        - Notes
      summary: Update a note
      description: Update a note in a workspace the key owner owns or is a member of.
      operationId: updateNote
      parameters:
        - name: noteId
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
        - $ref: "#/components/parameters/TaskieClient"
        - $ref: "#/components/parameters/TaskieClientVersion"
        - $ref: "#/components/parameters/TaskieDeviceId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateNoteRequest"
      responses:
        "200":
          description: Note updated.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NoteResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
components:
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: Taskie API key
      description: "Send `Authorization: Bearer taskie_...`."
    headerApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: "Send `x-api-key: taskie_...`."
  parameters:
    Workspace:
      name: workspace
      in: query
      required: false
      description: Workspace id, slug, or name. Defaults to the user's oldest owned workspace.
      schema:
        type: string
        example: default
    Query:
      name: query
      in: query
      required: false
      description: Search text across title and description.
      schema:
        type: string
        example: acme
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum items to return. Default 50, max 100.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 50
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: Optional key to prevent duplicate creates when clients retry POST requests.
      schema:
        type: string
        maxLength: 128
        example: task-create-acme-2026-09-30
    TaskieClient:
      name: X-Taskie-Client
      in: header
      required: false
      description: Client identifier for audit (for example `desktop-mac`, `mobile-ios`, or `browser-extension`).
      schema:
        type: string
        example: desktop-mac
    TaskieClientVersion:
      name: X-Taskie-Client-Version
      in: header
      required: false
      description: Client app version for audit.
      schema:
        type: string
        example: "1.2.0"
    TaskieDeviceId:
      name: X-Taskie-Device-Id
      in: header
      required: false
      description: Client-generated stable device or install identifier for audit.
      schema:
        type: string
  responses:
    BadRequest:
      description: Invalid request (including `invalid_status` when legacy status is sent).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            invalidStatus:
              summary: Legacy status rejected
              value:
                error:
                  code: invalid_status
                  message: Use columnId or role to place the task; status is not accepted as input.
    Unauthorized:
      description: Missing, invalid, revoked, or insufficient API key.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Forbidden:
      description: Action not allowed for this workspace.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
  schemas:
    Workspace:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
        name:
          type: string
    WorkspaceListItem:
      allOf:
        - $ref: "#/components/schemas/Workspace"
        - type: object
          required:
            - isDefault
            - role
          properties:
            isDefault:
              type: boolean
            role:
              type: string
              enum:
                - owner
                - member
    ListWorkspacesResponse:
      type: object
      required:
        - count
        - defaultWorkspaceId
        - workspaces
      properties:
        count:
          type: integer
        defaultWorkspaceId:
          type:
            - string
            - "null"
        workspaces:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceListItem"
    WorkspaceMember:
      type: object
      required:
        - userId
        - name
        - role
        - image
      properties:
        userId:
          type: string
        name:
          type:
            - string
            - "null"
        role:
          type: string
        image:
          type:
            - string
            - "null"
    ListWorkspaceMembersResponse:
      type: object
      required:
        - workspace
        - members
      properties:
        workspace:
          $ref: "#/components/schemas/Workspace"
        members:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceMember"
    BoardColumn:
      type: object
      required:
        - id
        - key
        - label
        - role
        - position
      properties:
        id:
          type: string
          description: Board column id. Pass as `columnId` on create/update task.
          example: bc_01HXYZ
        key:
          type: string
          description: Stable per-workspace key (legacy status key or `col_…`).
        label:
          type: string
          description: Human-readable column label.
        role:
          $ref: "#/components/schemas/BoardColumnRole"
        position:
          type: integer
          minimum: 0
    ListWorkspaceColumnsResponse:
      type: object
      required:
        - workspace
        - count
        - columns
      properties:
        workspace:
          $ref: "#/components/schemas/Workspace"
        count:
          type: integer
        columns:
          type: array
          items:
            $ref: "#/components/schemas/BoardColumn"
    WorkspaceProject:
      type: object
      required:
        - id
        - name
        - description
        - archivedAt
        - createdAt
        - updatedAt
        - taskCount
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          maxLength: 60
          example: Website redesign
        description:
          type: string
          maxLength: 150
          description: Optional short blurb. Empty string when unset.
          example: Marketing site refresh for Q4.
        archivedAt:
          type:
            - string
            - "null"
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        taskCount:
          type: integer
          minimum: 0
          description: Active (non-deleted, non-archived) tasks in this project.
    ListWorkspaceProjectsResponse:
      type: object
      required:
        - workspace
        - count
        - projects
      properties:
        workspace:
          $ref: "#/components/schemas/Workspace"
        count:
          type: integer
        projects:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceProject"
    CreateWorkspaceProjectRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          maxLength: 60
          example: Website redesign
        description:
          type: string
          maxLength: 150
          description: Optional short blurb.
          example: Marketing site refresh for Q4.
    CreateWorkspaceProjectResponse:
      type: object
      required:
        - workspace
        - project
      properties:
        workspace:
          $ref: "#/components/schemas/Workspace"
        project:
          $ref: "#/components/schemas/WorkspaceProject"
    TaskStatus:
      type: string
      description: |
        Response-only slug of the board column label (for example `drafting` or `to-do`).
        Not a legacy enum. Do not send this field on create/update.
      example: drafting
    BoardColumnRole:
      type: string
      enum:
        - start
        - active
        - done
      description: Board column role used for placement shortcuts.
    TaskPriority:
      type: string
      enum:
        - low
        - medium
        - high
        - urgent
    TaskSource:
      type: string
      enum:
        - manual
        - ai
        - agent
        - api
        - slack
        - browser_extension
    NoteSource:
      type: string
      enum:
        - manual
        - agent
        - api
        - slack
        - browser_extension
    Task:
      type: object
      required:
        - id
        - title
        - description
        - status
        - columnId
        - columnLabel
        - columnRole
        - priority
        - source
        - startDate
        - dueDate
        - assigneeId
        - projectId
        - projectName
        - createdAt
        - updatedAt
        - workspace
      properties:
        id:
          type: integer
          example: 123
        title:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 1000
        status:
          $ref: "#/components/schemas/TaskStatus"
        columnId:
          type:
            - string
            - "null"
          description: Board column id (`bc_…`).
        columnLabel:
          type:
            - string
            - "null"
          description: Human-readable board column label.
        columnRole:
          oneOf:
            - $ref: "#/components/schemas/BoardColumnRole"
            - type: "null"
          description: Column role (`start`, `active`, or `done`).
        priority:
          $ref: "#/components/schemas/TaskPriority"
        source:
          $ref: "#/components/schemas/TaskSource"
        startDate:
          type:
            - string
            - "null"
          format: date
          description: Optional planned start. Must be on or before dueDate when both exist. Omit on PATCH to preserve; null clears it. Does not change task status.
        dueDate:
          type:
            - string
            - "null"
          format: date
        assigneeId:
          type:
            - string
            - "null"
        projectId:
          type:
            - integer
            - "null"
          description: Optional workspace project id.
          example: 1
        projectName:
          type:
            - string
            - "null"
          description: Project display name when `projectId` is set.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        workspace:
          $ref: "#/components/schemas/Workspace"
    Note:
      type: object
      required:
        - id
        - title
        - description
        - source
        - createdAt
        - updatedAt
        - workspace
      properties:
        id:
          type: integer
          example: 456
        title:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 5000
        source:
          $ref: "#/components/schemas/NoteSource"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        workspace:
          $ref: "#/components/schemas/Workspace"
    CreateTaskRequest:
      type: object
      required:
        - title
      description: |
        Create a task. Place with optional `columnId` or `role` (defaults to start).
        Do not send `status`; it returns `400 invalid_status`.
        In Swagger, prefer `role` and omit `columnId` / `assigneeId` unless you have real ids —
        placeholder values like `bc_...` or `user_...` return 400.
        Get real column ids from `GET /workspaces/{workspaceId}/columns`.
      properties:
        workspace:
          type: string
          description: Workspace id, slug, or name. Defaults to the user's oldest owned workspace.
          example: default
        workspaceId:
          type: string
          deprecated: true
          description: Alias for `workspace`.
        title:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 1000
        columnId:
          type: string
          description: |
            Real board column id (`bc_…`) from GET /workspaces/{workspaceId}/columns.
            Prefer over role for custom columns. Omit this field in Swagger unless you
            paste a real id — placeholder values cause `400 invalid_column_id`.
        role:
          $ref: "#/components/schemas/BoardColumnRole"
          description: Column role shortcut. Defaults to start when neither columnId nor role is set.
        priority:
          $ref: "#/components/schemas/TaskPriority"
        startDate:
          type:
            - string
            - "null"
          format: date
          description: Optional planned start. Must be on or before dueDate when both exist. Omit on PATCH to preserve; null clears it. Does not change task status.
        dueDate:
          type:
            - string
            - "null"
          format: date
        assigneeId:
          type:
            - string
            - "null"
          description: |
            Real user id of an active workspace member (from GET /workspaces/{id}/members).
            Shared workspaces only — solo workspaces return `400 assignee_not_supported`.
            Omit unless assigning — placeholders return `400 invalid_assignee`.
        projectId:
          type:
            - integer
            - "null"
          minimum: 1
          description: |
            Optional workspace project id from GET /workspaces/{workspaceId}/projects.
            Omit for no project.
    UpdateTaskRequest:
      type: object
      minProperties: 1
      description: |
        Update a task. Move with optional `columnId` or `role`.
        Do not send `status`; it returns `400 invalid_status`.
        `assigneeId` is not supported on update.
        In Swagger, prefer `role` and omit `columnId` unless you paste a real id from
        `GET /workspaces/{workspaceId}/columns`.
      properties:
        workspace:
          type: string
          description: Workspace id, slug, or name. Defaults to the user's oldest owned workspace.
          example: default
        workspaceId:
          type: string
          deprecated: true
          description: Alias for `workspace`.
        title:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 1000
        columnId:
          type: string
          description: |
            Real board column id (`bc_…`) from GET /workspaces/{workspaceId}/columns.
            Omit in Swagger unless you paste a real id — placeholders cause `400 invalid_column_id`.
        role:
          $ref: "#/components/schemas/BoardColumnRole"
          description: Move by column role.
        priority:
          $ref: "#/components/schemas/TaskPriority"
        startDate:
          type:
            - string
            - "null"
          format: date
          description: Optional planned start. Must be on or before dueDate when both exist. Omit on PATCH to preserve; null clears it. Does not change task status.
        dueDate:
          type:
            - string
            - "null"
          format: date
        projectId:
          type:
            - integer
            - "null"
          description: |
            Workspace project id from GET /workspaces/{workspaceId}/projects, or null to clear.
            Omit to leave unchanged.
    TaskResponse:
      type: object
      required:
        - task
      properties:
        task:
          $ref: "#/components/schemas/Task"
    ListTasksResponse:
      type: object
      required:
        - workspace
        - count
        - totalMatched
        - tasks
      properties:
        workspace:
          $ref: "#/components/schemas/Workspace"
        count:
          type: integer
        totalMatched:
          type: integer
        tasks:
          type: array
          items:
            $ref: "#/components/schemas/Task"
    TaskCounts:
      type: object
      required:
        - totalOpen
        - dueToday
        - overdue
        - attention
      properties:
        totalOpen:
          type: integer
          description: Open (incomplete) tasks in scope.
        dueToday:
          type: integer
          description: Open tasks due on `today`.
        overdue:
          type: integer
          description: Open tasks with a due date before `today`.
        attention:
          type: integer
          description: |
            Tasks that need attention now — `dueToday + overdue`.
            Desktop clients use this for the dock/taskbar count.
    TaskCountsResponse:
      type: object
      required:
        - today
        - scope
        - workspaceCount
        - counts
      properties:
        today:
          type: string
          format: date
        scope:
          type: string
          enum:
            - all
            - workspace
        workspaceCount:
          type: integer
        counts:
          $ref: "#/components/schemas/TaskCounts"
    NativeNotification:
      type: object
      required:
        - id
        - type
        - workspaceId
        - workspaceName
        - actorName
        - taskId
        - taskTitle
        - summary
        - createdAt
      properties:
        id:
          type: integer
        type:
          type: string
          enum:
            - task.assigned
        workspaceId:
          type: string
        workspaceName:
          type:
            - string
            - "null"
        actorName:
          type:
            - string
            - "null"
        taskId:
          type: integer
        taskTitle:
          type:
            - string
            - "null"
        summary:
          type: string
        createdAt:
          type: string
          format: date-time
    ListNotificationsResponse:
      type: object
      required:
        - count
        - notifications
      properties:
        count:
          type: integer
        notifications:
          type: array
          items:
            $ref: "#/components/schemas/NativeNotification"
    CreateNoteRequest:
      type: object
      required:
        - title
      properties:
        workspace:
          type: string
          description: Workspace id, slug, or name. Defaults to the user's oldest workspace.
          example: default
        workspaceId:
          type: string
          deprecated: true
          description: Alias for `workspace`.
        title:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 5000
    UpdateNoteRequest:
      type: object
      minProperties: 1
      properties:
        workspace:
          type: string
          description: Workspace id, slug, or name. Defaults to the user's oldest workspace.
          example: default
        workspaceId:
          type: string
          deprecated: true
          description: Alias for `workspace`.
        title:
          type: string
          maxLength: 120
        description:
          type: string
          maxLength: 5000
    NoteResponse:
      type: object
      required:
        - note
      properties:
        note:
          $ref: "#/components/schemas/Note"
    ListNotesResponse:
      type: object
      required:
        - workspace
        - count
        - totalMatched
        - notes
      properties:
        workspace:
          $ref: "#/components/schemas/Workspace"
        count:
          type: integer
        totalMatched:
          type: integer
        notes:
          type: array
          items:
            $ref: "#/components/schemas/Note"
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: invalid_body
            message:
              type: string
              example: Request body must be a JSON object.
