openapi: 3.1.0
info:
  title: Sprout API for Muse
  version: "2026-10-13"
  description: |
    The part of the Sprout API that an API key may use. Muse (the owner's phone app) can read the board
    and create and change work. It can never delete or archive anything: every DELETE request made with
    a key is refused with `403 forbidden_for_api_key`, on every route.

    Authenticate with `Authorization: Bearer {{API_KEY}}`. Keys are created by the owner in Sprout under
    Settings, API access. Each key has scopes; the scope each operation needs is written on the operation.
    Per key the limit is 60 requests a minute with a burst of 20 (`429` and a `Retry-After` header).
    Keys can also have a daily write cap and an allowlist of project IDs.

    Names, not ids, are used for columns, projects, areas and tags. Get the valid names from
    `GET /assistant/context`.

    Text vocabulary: `description` is the task's own text (what the task is); comments
    (`POST /assistant/tasks/{id}/comments`, field `body`) hold progress updates and remarks. Never invent other
    fields. A deprecated `notes` input is still accepted as an alias for `description` and is never returned;
    sending both with different text is refused with 422 `validation_failed`.
    `tags` replaces ALL tags; to add a tag use `addTags`. A task with open subtasks cannot be completed;
    complete the subtasks first or send `completeSubtasks: true`.
servers:
  - url: "{{SPROUT_BASE_URL}}/api/v1"
    description: Replace the placeholder with the Sprout address (local network while testing, HTTPS in production).
security:
  - bearerKey: []
tags:
  - name: Context
  - name: Tasks
  - name: Planning
  - name: Subtasks and comments
  - name: Organize
  - name: Recurrence
  - name: Reminders
  - name: Journal
  - name: Sticky seeds
  - name: Undo
paths:
  /assistant/context:
    get:
      tags: [Context]
      operationId: getContext
      summary: Today's date, time zone, board names, overview and briefing
      description: Call this first in every session. Required scope `board:read`.
      x-required-scope: board:read
      responses:
        "200":
          description: The board context.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Context" }
              example:
                today: "2026-10-11"
                timezone: Asia/Kolkata
                columns:
                  - { id: c1, name: To do, kind: open, position: 0, openTaskCount: 4 }
                  - { id: c2, name: Done, kind: done, position: 1, openTaskCount: 0 }
                projects: [{ id: p1, name: Website launch }]
                areas: [{ id: a1, name: Personal }]
                tags: [{ id: t1, name: admin }]
                priorities: [none, low, medium, high]
                recurrence: []
                recentOperations: []
                recentlyArchived: []
                overview: { totals: { open: 4, overdue: 0, dueToday: 1 } }
                briefing: "Board overview for 2026-10-11 (Asia/Kolkata): 4 open tasks. ..."
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/selftest:
    get:
      tags: [Context]
      operationId: assistantSelftest
      summary: Check key scopes, expiry, timezone, limits and clock
      description: Required scope `board:read`. Send `X-Client-Time` with an ISO timestamp to detect client clock skew.
      x-required-scope: board:read
      parameters:
        - { name: X-Client-Time, in: header, required: false, schema: { type: string, format: date-time } }
      responses:
        "200":
          description: Current authentication and API health information.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Selftest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/changelog:
    get:
      tags: [Context]
      operationId: assistantChangelog
      summary: Read dated assistant API changes
      description: Required scope `board:read`. `format=markdown` returns raw Markdown.
      x-required-scope: board:read
      parameters:
        - { name: format, in: query, required: false, schema: { type: string, enum: [markdown] } }
      responses:
        "200":
          description: The current dated API changelog and version.
          content:
            application/json:
              schema:
                type: object
                required: [name, apiVersion, content, version]
                properties:
                  name: { type: string, const: CHANGELOG.md }
                  apiVersion: { type: string }
                  content: { type: string }
                  version: { type: string }
            text/markdown:
              schema: { type: string }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/template:
    get:
      tags: [Context]
      operationId: getTemplate
      summary: The task template (example task, batch example, field reference)
      description: Required scope `board:read`.
      x-required-scope: board:read
      responses:
        "200":
          description: The contents of task-template.json.
          content:
            application/json:
              schema: { type: object, additionalProperties: true }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/guide:
    get:
      tags: [Context]
      operationId: getAgentGuide
      summary: AGENT.md, the model-neutral guide every agent reads first
      description: Required scope `board:read`. Golden rules, workflow, style, dates and reminders, error handling and playbooks. Re-read when `context.guideVersion` changes.
      x-required-scope: board:read
      parameters:
        - name: format
          in: query
          required: false
          description: "`markdown` returns the raw text instead of JSON."
          schema: { type: string, enum: [markdown] }
      responses:
        "200":
          description: The guide.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/AgentGuide" }
            text/markdown:
              schema: { type: string }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/profile:
    get:
      tags: [Context]
      operationId: getAgentProfile
      summary: The owner's PROFILE.md (read-only for keys)
      description: Required scope `board:read`. Only the logged-in owner edits the profile, in Sprout Settings. There is no write route for API keys.
      x-required-scope: board:read
      parameters:
        - name: format
          in: query
          required: false
          description: "`markdown` returns the raw text instead of JSON."
          schema: { type: string, enum: [markdown] }
      responses:
        "200":
          description: The profile document. `version` is 0 until the owner saves it.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/AgentDoc"
                  - type: object
                    properties:
                      editable: { type: boolean, description: false for API keys }
            text/markdown:
              schema: { type: string }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/memory:
    get:
      tags: [Context]
      operationId: getAgentMemory
      summary: The owner's MEMORY.md plus the built-in assistant's saved facts
      description: Required scope `board:read`.
      x-required-scope: board:read
      responses:
        "200":
          description: The memory document and the read-only built-in facts.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/AgentMemory" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
    put:
      tags: [Context]
      operationId: updateAgentMemory
      summary: Append to or replace MEMORY.md
      description: |
        Required scope `tasks:write`. Write only when the owner explicitly asks to remember something.
        `append` (default) adds the content on a new line. `replace` overwrites the document and requires `expectedVersion`.
        A stale `expectedVersion` returns 409. Content that looks like a secret is refused. There is no delete.
      x-required-scope: tasks:write
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/AgentMemoryUpdate" }
            example: { mode: append, content: "- Home airport: BUH" }
      responses:
        "200":
          description: The updated memory document.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/AgentDoc"
                  - type: object
                    properties:
                      mode: { type: string, enum: [append, replace] }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "409": { $ref: "#/components/responses/VersionConflict" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/journal:
    get:
      tags: [Journal]
      operationId: searchJournal
      summary: Search past journal entries
      description: Required scope `tasks:read`. Non-empty entries, newest first, each with an `excerpt` around the match.
      x-required-scope: tasks:read
      parameters:
        - { name: q, in: query, required: false, schema: { type: string }, description: Words to look for. }
        - { name: from, in: query, required: false, schema: { type: string, format: date }, description: Earliest day (YYYY-MM-DD). }
        - { name: to, in: query, required: false, schema: { type: string, format: date }, description: Latest day (YYYY-MM-DD). }
        - { name: limit, in: query, required: false, schema: { type: integer, minimum: 1, maximum: 100, default: 30 } }
      responses:
        "200":
          description: Matching entries.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/JournalSearchResult" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/journal/{date}:
    parameters:
      - name: date
        in: path
        required: true
        schema: { type: string }
        description: The day as `YYYY-MM-DD`, or `today` (the owner's local date).
    get:
      tags: [Journal]
      operationId: getJournalEntry
      summary: Read one day's journal entry
      description: Required scope `tasks:read`. An empty `body` means nothing is written for that day yet.
      x-required-scope: tasks:read
      responses:
        "200":
          description: The entry.
          content:
            application/json:
              schema:
                type: object
                properties:
                  entry: { $ref: "#/components/schemas/JournalEntry" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
    post:
      tags: [Journal]
      operationId: appendJournalEntry
      summary: Add text to the end of a day's entry
      description: |
        Required scope `tasks:write`. Appends a paragraph without touching what is already written, so it is the safe way for an assistant
        to record "how the day went". Prefer it over PUT. The whole entry may not exceed 20,000 characters.
      x-required-scope: tasks:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [text]
              additionalProperties: false
              properties:
                text: { type: string, minLength: 1, maxLength: 4000 }
            example: { text: "Afternoon: lunch with Priya, felt good." }
      responses:
        "200":
          description: The updated entry.
          content:
            application/json:
              schema:
                type: object
                properties:
                  entry: { $ref: "#/components/schemas/JournalEntry" }
                  changed: { type: string, example: journal_updated }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
    put:
      tags: [Journal]
      operationId: replaceJournalEntry
      summary: Replace the whole entry for a day
      description: Required scope `tasks:write`. Overwrites the entire day. Only use it when the owner asks to rewrite or correct an entry, and read it first.
      x-required-scope: tasks:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [body]
              additionalProperties: false
              properties:
                body: { type: string, maxLength: 20000 }
            example: { body: "Finished the draft. Next: [[#12]]." }
      responses:
        "200":
          description: The saved entry.
          content:
            application/json:
              schema:
                type: object
                properties:
                  entry: { $ref: "#/components/schemas/JournalEntry" }
                  changed: { type: string, example: journal_updated }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /workflow/columns:
    get:
      tags: [Context]
      operationId: listColumns
      summary: Board columns in order
      description: Required scope `board:read`. The context call already includes this.
      x-required-scope: board:read
      responses:
        "200":
          description: Columns.
          content:
            application/json:
              schema:
                type: object
                properties:
                  columns:
                    type: array
                    items: { $ref: "#/components/schemas/Column" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /board:
    get:
      tags: [Context]
      operationId: getBoard
      summary: The daily board grouped by column
      description: Required scope `board:read`. The `area`, `project` and `tag` filters take ids.
      x-required-scope: board:read
      parameters:
        - { name: date, in: query, schema: { type: string, pattern: '^\d{4}-\d{2}-\d{2}$' }, description: YYYY-MM-DD, default is today }
        - { name: status, in: query, schema: { type: string, enum: [open, active, done] } }
        - { name: priority, in: query, schema: { $ref: "#/components/schemas/Priority" } }
        - { name: dateCondition, in: query, schema: { type: string, enum: [overdue, has_due, tentative, unplanned] } }
        - { name: area, in: query, schema: { type: string }, description: Area id }
        - { name: project, in: query, schema: { type: string }, description: Project id }
        - { name: tag, in: query, schema: { type: string }, description: Tag id }
      responses:
        "200":
          description: The board and the columns.
          content:
            application/json:
              schema:
                type: object
                properties:
                  board: { type: object, additionalProperties: true }
                  columns:
                    type: array
                    items: { $ref: "#/components/schemas/Column" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks:
    get:
      tags: [Tasks]
      operationId: findTasks
      summary: Find and count tasks in a compact form
      description: |
        Required scope `tasks:read`. Archived tasks never appear. All filters are optional and combine with AND.
        `total` is the number of matches before `limit`/`offset`, so counting questions need one call with `limit=1`.
      x-required-scope: tasks:read
      parameters:
        - { name: q, in: query, schema: { type: string, maxLength: 200 }, description: "Ranks exact title, title prefix, token and description matches; numeric 12 or #12 matches the short id. Matching results include score." }
        - { name: column, in: query, schema: { type: string }, description: Exact column name }
        - { name: project, in: query, schema: { type: string }, description: Exact project name }
        - { name: area, in: query, schema: { type: string }, description: Exact area name }
        - { name: tag, in: query, schema: { type: string }, description: Exact tag name }
        - { name: priority, in: query, schema: { type: string, example: "high,medium" }, description: "One or more of none, low, medium, high, comma separated" }
        - { name: dueFrom, in: query, schema: { type: string, pattern: '^\d{4}-\d{2}-\d{2}$' }, description: Inclusive. Tasks without a due date are excluded. Old name dueAfter is still accepted. }
        - { name: dueTo, in: query, schema: { type: string, pattern: '^\d{4}-\d{2}-\d{2}$' }, description: Inclusive. Tasks without a due date are excluded. Old name dueBefore is still accepted. }
        - { name: plannedFrom, in: query, schema: { type: string, pattern: '^\d{4}-\d{2}-\d{2}$' }, description: Inclusive. Tasks without a planned day are excluded. }
        - { name: plannedTo, in: query, schema: { type: string, pattern: '^\d{4}-\d{2}-\d{2}$' }, description: Inclusive. Tasks without a planned day are excluded. }
        - { name: overdue, in: query, schema: { type: boolean }, description: "true = only open tasks due before today (owner's time zone); false = all others" }
        - { name: waiting, in: query, schema: { type: boolean }, description: "true = only tasks with waitingFor set; false = only tasks without" }
        - { name: completed, in: query, schema: { type: boolean }, description: "true = only finished tasks; false = only open tasks. Overrides includeDone." }
        - { name: includeDone, in: query, schema: { type: boolean, default: false }, description: Include finished tasks next to open ones }
        - { name: parent, in: query, schema: { type: string }, description: "Id or short number (12 or #12) of a task: only its subtasks" }
        - { name: sort, in: query, schema: { type: string, enum: [board, due, planned, updated], default: board } }
        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 25 } }
        - { name: offset, in: query, schema: { type: integer, minimum: 0, default: 0 } }
      responses:
        "200":
          description: Matching tasks and the total number of matches.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tasks:
                    type: array
                    items:
                      allOf:
                        - { $ref: "#/components/schemas/TaskSummary" }
                        - type: object
                          properties:
                            score: { type: number, minimum: 0, maximum: 1, description: Present when q is supplied. }
                  total: { type: integer, description: Number of matching tasks before limit and offset }
                  limit: { type: integer }
                  offset: { type: integer }
                  hasMore: { type: boolean }
                  today: { $ref: "#/components/schemas/LocalDate" }
              example:
                tasks:
                  - { id: 6f1c2d9e-3b0a-4c55-9d4e-1a2b3c4d5e6f, shortId: 12, title: Call the bank, description: null, column: To do, priority: medium, dueOn: "2026-10-15", plannedFor: null, availableFrom: "2026-10-11", tentativeStart: null, tentativeEnd: null, waitingFor: null, project: null, area: Personal, tags: [admin], parentTaskId: null, completedAt: null, version: 1, score: 1 }
                total: 1
                limit: 25
                offset: 0
                hasMore: false
                today: "2026-10-11"
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
    post:
      tags: [Tasks]
      operationId: createTasks
      summary: Create one task, or a batch of up to 25
      description: |
        Required scope `tasks:write`. Send an `Idempotency-Key` header so a retry never makes a duplicate.
        Unless `allowDuplicate: true`, create refuses a likely duplicate with 409 `possible_duplicate` and matching task suggestions.
        A body with a `tasks` array is a batch; every entry succeeds or fails on its own, including duplicate errors.
        Use `dryRun=true` or `X-Dry-Run: 1` to validate and resolve names without saving.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/IdempotencyKey" }
        - { $ref: "#/components/parameters/DryRunQuery" }
        - { $ref: "#/components/parameters/DryRunHeader" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - { $ref: "#/components/schemas/TaskInput" }
                - { $ref: "#/components/schemas/TaskBatch" }
            examples:
              single:
                summary: One task
                value:
                  title: Renew the car insurance
                  column: To do
                  tags: [admin]
                  priority: high
                  dueOn: "2026-10-20"
                  tentativeStart: "2026-10-16"
                  tentativeEnd: "2026-10-18"
                  subtasks: [Get quote from Insurer A, Get quote from Insurer B]
              batch:
                summary: Three tasks at once
                value:
                  tasks:
                    - { title: Buy milk }
                    - { title: Book the dentist, priority: medium }
                    - { title: Email the landlord, dueOn: "2026-10-14" }
      responses:
        "201":
          description: Single task created.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/TaskCreated" }
        "200":
          description: A batch result (one entry per task), or a replay of an earlier single create with the same Idempotency-Key.
          content:
            application/json:
              schema:
                oneOf:
                  - { $ref: "#/components/schemas/TaskCreated" }
                  - { $ref: "#/components/schemas/BatchResult" }
              example:
                results:
                  - { ok: true, task: { id: 6f1c2d9e-3b0a-4c55-9d4e-1a2b3c4d5e6f, shortId: 14, title: Buy milk }, error: null }
                  - { ok: false, task: null, error: { code: invalid_operation, message: "Unknown tag “health”. Valid tag names: admin" } }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "409":
          description: A likely duplicate exists; matching task suggestions are included. Reuse the matching task or retry with allowDuplicate true only when a separate task is intended.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
              example:
                error:
                  code: possible_duplicate
                  message: One or more open tasks may already match this task
                  tasks:
                    - { id: task-uuid, shortId: 12, title: Book dentist appointment, column: To do, dueOn: "2026-10-15", similarity: 0.8 }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/resolve:
    get:
      tags: [Tasks]
      operationId: resolveAssistantText
      summary: Resolve natural-language text to matching tasks and organization names
      description: Read-only. Required scope `tasks:read`. Returns up to five ranked tasks, projects, tags and areas with confidence scores. Short task ids such as 12 and #12 resolve exactly.
      x-required-scope: tasks:read
      parameters:
        - { name: text, in: query, required: true, schema: { type: string, minLength: 1, maxLength: 200 } }
      responses:
        "200":
          description: Ranked matches for the text.
          content:
            application/json:
              schema:
                type: object
                required: [text, today, tasks, projects, tags, areas]
                properties:
                  text: { type: string }
                  today: { $ref: "#/components/schemas/LocalDate" }
                  tasks:
                    type: array
                    items:
                      allOf:
                        - { $ref: "#/components/schemas/TaskSummary" }
                        - type: object
                          properties:
                            score: { type: number, minimum: 0, maximum: 1 }
                            confidence: { type: number, minimum: 0, maximum: 1 }
                  projects: { type: array, items: { $ref: "#/components/schemas/ConfidenceNamed" } }
                  tags: { type: array, items: { $ref: "#/components/schemas/ConfidenceNamed" } }
                  areas: { type: array, items: { $ref: "#/components/schemas/ConfidenceNamed" } }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/digest:
    get:
      tags: [Planning]
      operationId: getDailyDigest
      summary: Daily read-only task digest with risk reasons and suggested focus
      description: Required scope `tasks:read`. Date defaults to the owner's today. The response includes due/planned work, waiting tasks, pending reminders, at-risk reasons, up to three focus suggestions, and counts.
      x-required-scope: tasks:read
      parameters:
        - { name: date, in: query, schema: { $ref: "#/components/schemas/LocalDate" } }
      responses:
        "200":
          description: The daily digest.
          content:
            application/json:
              schema: { type: object, required: [today, overdue, dueToday, plannedToday, upcoming7Days, waitingForYou, pendingReminders, atRisk, suggestedFocus, counts], properties: { today: { $ref: "#/components/schemas/LocalDate" }, overdue: { type: array, items: { $ref: "#/components/schemas/TaskSummary" } }, dueToday: { type: array, items: { $ref: "#/components/schemas/TaskSummary" } }, plannedToday: { type: array, items: { $ref: "#/components/schemas/TaskSummary" } }, upcoming7Days: { type: array, items: { $ref: "#/components/schemas/TaskSummary" } }, waitingForYou: { type: array, items: { $ref: "#/components/schemas/TaskSummary" } }, pendingReminders: { type: array, items: { $ref: "#/components/schemas/Reminder" } }, atRisk: { type: array, items: { type: object, required: [task, reason], properties: { task: { $ref: "#/components/schemas/TaskSummary" }, reason: { type: string, enum: ["overdue 3+ days", "due within 48h with no planned date", "many tasks due the same day", "waiting 7+ days"] } } } }, suggestedFocus: { type: array, maxItems: 3, items: { type: object, required: [task, reason], properties: { task: { $ref: "#/components/schemas/TaskSummary" }, reason: { type: string } } } }, counts: { type: object, additionalProperties: { type: integer } } } }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/calendar:
    get:
      tags: [Planning]
      operationId: getCalendar
      summary: Day-by-day tasks and recurring occurrences for a date range (read-only)
      description: |
        Required scope `board:read`. For each day: tasks due, planned or inside their tentative window that day
        (`reasons`), recurring-rule occurrences (`taskId` set when the occurrence already exists as a task), and the
        carry-forward counts the Sprout calendar shows. At most 92 days per request.
      x-required-scope: board:read
      parameters:
        - { name: from, in: query, required: true, schema: { $ref: "#/components/schemas/LocalDate" } }
        - { name: to, in: query, schema: { $ref: "#/components/schemas/LocalDate" }, description: Inclusive; defaults to from }
        - { name: includeDone, in: query, schema: { type: boolean, default: false } }
      responses:
        "200":
          description: The calendar.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Calendar" }
              example:
                from: "2026-10-13"
                to: "2026-10-17"
                today: "2026-10-11"
                timezone: Asia/Kolkata
                days:
                  - date: "2026-10-15"
                    weekday: Thursday
                    mode: future
                    tasks:
                      - { id: 6f1c2d9e-3b0a-4c55-9d4e-1a2b3c4d5e6f, shortId: 12, title: Call the bank, description: null, column: To do, priority: medium, dueOn: "2026-10-15", plannedFor: null, availableFrom: "2026-10-11", tentativeStart: null, tentativeEnd: null, waitingFor: null, project: null, area: Personal, tags: [admin], parentTaskId: null, completedAt: null, version: 1, done: false, overdue: false, reasons: [due] }
                    recurrence:
                      - { ruleId: r1, title: Water the plants, status: active, taskId: null, shortId: null }
                    counts: { onBoard: 7, completed: 0 }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/stats:
    get:
      tags: [Planning]
      operationId: getStats
      summary: Board counts (read-only)
      description: |
        Required scope `board:read`. Same rules as the context briefing: top-level tasks, open = not finished and not
        in a Done column. `dueToday` counts tasks due or planned today; `dueIn7Days` includes today.
      x-required-scope: board:read
      responses:
        "200":
          description: The counts.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Stats" }
              example:
                today: "2026-10-11"
                timezone: Asia/Kolkata
                open: 9
                perColumn:
                  - { name: To do, kind: open, open: 6, total: 6 }
                  - { name: Done, kind: done, open: 0, total: 14 }
                overdue: 2
                dueToday: 1
                dueIn7Days: 4
                waiting: 1
                noDate: 3
                completedToday: 2
                subtasks: { open: 5, total: 8 }
                overdueTasks: [{ number: "#7", title: Renew passport, due: "2026-10-02" }]
                todayTasks: [{ number: "#12", title: Call the bank, due: "2026-10-11" }]
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/activity:
    get:
      tags: [Planning]
      operationId: getActivity
      summary: Recent changes with the API key that made them (read-only)
      description: |
        Required scope `board:read`. Newest first. `via` is the API key name for API changes; `byThisKey` marks changes
        made with the calling key (only those can be undone with `POST /assistant/undo`).
      x-required-scope: board:read
      parameters:
        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 20 } }
        - { name: source, in: query, schema: { type: string, enum: [manual, ai, system, api] } }
      responses:
        "200":
          description: Recent activity.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items: { $ref: "#/components/schemas/ActivityEntry" }
              example:
                items:
                  - { id: act1, operationId: op1, kind: task_created, summary: "Created “Call the bank”", source: api, via: Muse phone, byThisKey: true, undone: false, createdAt: "2026-10-11T08:12:00.000Z" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks/{id}:
    get:
      tags: [Tasks]
      operationId: getAssistantTask
      summary: One task with every field, by name
      description: |
        Required scope `tasks:read`. Returns every task field with names instead of ids (column, project, area, tags),
        the description, the parent and active child tasks, and a comments summary (count and the 5 newest).
        Child tasks are nested in the parent detail/progress UI rather than listed as board-column cards.
        Archived tasks are returned with `archivedAt` set.
      x-required-scope: tasks:read
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
      responses:
        "200":
          description: The task.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task: { $ref: "#/components/schemas/TaskDetail" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    patch:
      tags: [Tasks]
      operationId: updateTask
      summary: Update, move, complete or reopen a task
      description: |
        Required scope `tasks:write`. Send only what changes (at least one field). `column` moves the task,
        `complete: true` finishes it, `complete: false` reopens it. `parent` attaches an existing task by UUID,
        short id or exact title; null detaches it. A task with open subtasks cannot be completed: it returns 409 `open_subtasks`
        and lists those children. Complete the subtasks first or send `completeSubtasks: true`, which completes them
        in the same undoable operation.
        Every user-editable field can be set or cleared, including `description`, `area`, `availableFrom`,
        `tentativeStart`, `tentativeEnd` and `waitingFor`.
        A tentative window that would start after it ends (counting values already on the task) is refused with 400.
        There is no delete and no archive. `dryRun=true` or `X-Dry-Run: 1` validates and resolves names without saving.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
        - { $ref: "#/components/parameters/IdempotencyKey" }
        - { $ref: "#/components/parameters/DryRunQuery" }
        - { $ref: "#/components/parameters/DryRunHeader" }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/TaskPatch" }
            examples:
              move:
                value: { column: In progress, priority: high }
              complete:
                value: { complete: true }
              completeWithChildren:
                value: { complete: true, completeSubtasks: true }
              schedule:
                value: { tentativeStart: "2026-10-13", tentativeEnd: "2026-10-14", area: Personal, waitingFor: Reply from the bank }
              clear:
                value: { tentativeStart: null, tentativeEnd: null, area: "", waitingFor: null, description: null }
      responses:
        "200":
          description: The updated task and the operation ids created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task: { $ref: "#/components/schemas/Task" }
                  operations:
                    type: array
                    items: { type: string }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "409":
          description: The task version is stale, or an open subtask prevents parent completion.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
              examples:
                versionConflict:
                  value: { error: { code: version_conflict, message: The task changed since it was read } }
                openSubtasks:
                  value: { error: { code: open_subtasks, message: Complete or detach the open subtasks before completing this task, subtasks: [{ id: child-uuid, shortId: 13, title: Find account number }] } }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /tasks:
    get:
      tags: [Tasks]
      operationId: listAllTasks
      summary: All active tasks, paged
      description: Required scope `tasks:read`.
      x-required-scope: tasks:read
      parameters:
        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 2000, default: 200 } }
        - { name: offset, in: query, schema: { type: integer, minimum: 0, default: 0 } }
      responses:
        "200":
          description: A page of tasks.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tasks:
                    type: array
                    items: { $ref: "#/components/schemas/Task" }
                  total: { type: integer }
                  limit: { type: integer }
                  offset: { type: integer }
                  hasMore: { type: boolean }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /tasks/{id}:
    get:
      tags: [Tasks]
      operationId: getTask
      summary: One task in full
      description: Required scope `tasks:read`. Returns the task with its `description`.
      x-required-scope: tasks:read
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
      responses:
        "200":
          description: The task.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task: { $ref: "#/components/schemas/Task" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    delete:
      tags: [Tasks]
      operationId: deleteTaskRefused
      summary: Always refused for API keys
      description: |
        Documented only so the refusal is explicit. With an API key every DELETE request, on this route and on
        every other route, is answered with `403 forbidden_for_api_key`. Deleting is done by the owner inside Sprout.
      responses:
        "403": { $ref: "#/components/responses/Forbidden" }
  /search:
    get:
      tags: [Tasks]
      operationId: searchWorkspace
      summary: Forgiving search over tasks and projects
      description: Required scope `tasks:read`.
      x-required-scope: tasks:read
      parameters:
        - { name: q, in: query, required: true, schema: { type: string, maxLength: 200 } }
      responses:
        "200":
          description: Matches.
          content:
            application/json:
              schema:
                type: object
                properties:
                  query: { type: string }
                  tasks:
                    type: array
                    items: { $ref: "#/components/schemas/Task" }
                  projects:
                    type: array
                    items: { $ref: "#/components/schemas/Project" }
                  taskMatches: { type: array, items: { type: object, additionalProperties: true } }
                  closest: { type: array, items: { type: object, additionalProperties: true } }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks/{id}/description:
    put:
      tags: [Tasks]
      operationId: replaceDescription
      summary: Replace a task's description
      description: Required scope `tasks:write`. Replaces the task's own text (what the task is). Progress updates and remarks belong in comments.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
        - { $ref: "#/components/parameters/IdempotencyKey" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [description]
              properties:
                description: { type: [string, "null"], maxLength: 10000, description: The full new description, or null to clear. }
                expectedVersion: { type: integer, minimum: 1 }
            example: { description: Ask for the new card to be sent to the office. }
      responses:
        "200":
          description: Description replaced.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task: { $ref: "#/components/schemas/Task" }
                  operation: { type: string }
                  changed: { type: string, const: description_replaced }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "409": { $ref: "#/components/responses/VersionConflict" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks/{id}/notes:
    put:
      tags: [Tasks]
      operationId: replaceDescriptionDeprecatedAlias
      deprecated: true
      summary: Deprecated alias of PUT /assistant/tasks/{id}/description
      description: Required scope `tasks:write`. Same behaviour, body and response as `/assistant/tasks/{id}/description`. Use that route instead.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
        - { $ref: "#/components/parameters/IdempotencyKey" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [description]
              properties:
                description: { type: [string, "null"], maxLength: 10000, description: The full new description, or null to clear. }
                expectedVersion: { type: integer, minimum: 1 }
            example: { description: Ask for the new card to be sent to the office. }
      responses:
        "200":
          description: Description replaced.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task: { $ref: "#/components/schemas/Task" }
                  operation: { type: string }
                  changed: { type: string, const: description_replaced }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "409": { $ref: "#/components/responses/VersionConflict" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks/{id}/restore:
    post:
      tags: [Tasks]
      operationId: restoreTask
      summary: Bring an archived task back to the board
      description: Required scope `tasks:write`. No body. Take the id from `context.recentlyArchived`. Cannot be undone with the undo call.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
      responses:
        "200":
          description: Task restored.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task: { $ref: "#/components/schemas/Task" }
                  changed: { type: string, const: task_restored }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "409": { $ref: "#/components/responses/VersionConflict" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks/{id}/comments:
    get:
      tags: [Subtasks and comments]
      operationId: listComments
      summary: Comments on a task, oldest first
      description: Required scope `tasks:read`.
      x-required-scope: tasks:read
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
      responses:
        "200":
          description: Comments.
          content:
            application/json:
              schema:
                type: object
                properties:
                  comments:
                    type: array
                    items: { $ref: "#/components/schemas/Comment" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    post:
      tags: [Subtasks and comments]
      operationId: addComment
      summary: Add a comment (progress updates and remarks)
      description: Required scope `tasks:write`. The body field is `body`. Does not use the Idempotency-Key header and cannot be undone. Comments cannot be edited or removed through the API.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [body]
              properties:
                body: { type: string, minLength: 1, maxLength: 4000 }
            example: { body: Waiting on legal }
      responses:
        "201":
          description: Comment added.
          content:
            application/json:
              schema:
                type: object
                properties:
                  comment: { $ref: "#/components/schemas/Comment" }
                  changed: { type: string, const: comment_added }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tasks/{id}/subtasks:
    get:
      tags: [Subtasks and comments]
      operationId: listSubtasks
      summary: Subtasks of a task
      description: Required scope `tasks:read`.
      x-required-scope: tasks:read
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
      responses:
        "200":
          description: Subtasks (each is a task).
          content:
            application/json:
              schema:
                type: object
                properties:
                  subtasks:
                    type: array
                    items: { $ref: "#/components/schemas/Task" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    post:
      tags: [Subtasks and comments]
      operationId: addSubtask
      summary: Add a checklist item to a task
      description: Required scope `tasks:write`.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
        - { $ref: "#/components/parameters/IdempotencyKey" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [title]
              properties:
                title: { type: string, minLength: 1, maxLength: 200 }
            example: { title: Attach the receipt }
      responses:
        "201":
          description: Subtask added (200 on a replay).
          content:
            application/json:
              schema:
                type: object
                properties:
                  subtask: { $ref: "#/components/schemas/Task" }
                  operation: { type: string }
                  changed: { type: string, const: subtask_added }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    patch:
      tags: [Subtasks and comments]
      operationId: updateSubtask
      summary: Rename, check off or reopen one subtask
      description: Required scope `tasks:write`. Give either `title` or `complete`, never both. There is no way to remove a subtask.
      x-required-scope: tasks:write
      parameters:
        - { $ref: "#/components/parameters/TaskId" }
        - { $ref: "#/components/parameters/IdempotencyKey" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [subtask]
              properties:
                subtask: { type: string, description: The subtask's id or its exact title. }
                title: { type: string, minLength: 1, maxLength: 200 }
                complete: { type: boolean }
                expectedVersion: { type: integer, minimum: 1 }
            example: { subtask: Attach the receipt, complete: true }
      responses:
        "200":
          description: Subtask changed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  subtask: { $ref: "#/components/schemas/Task" }
                  operation: { type: string }
                  changed: { type: string, enum: [subtask_renamed, subtask_completed, subtask_reopened] }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "409": { $ref: "#/components/responses/VersionConflict" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/projects:
    post:
      tags: [Organize]
      operationId: createProject
      summary: Create a project
      description: Required scope `organize:write`. A name that already exists gives `400 validation_failed`.
      x-required-scope: organize:write
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ProjectCreate" }
            example: { name: Website launch, description: Everything for the October launch }
      responses:
        "201":
          description: Project created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  project: { $ref: "#/components/schemas/Project" }
                  changed: { type: string, const: project_created }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/projects/{target}:
    patch:
      tags: [Organize]
      operationId: updateProject
      summary: Rename or recolor a project
      description: Required scope `organize:write`. Projects cannot be archived through the API.
      x-required-scope: organize:write
      parameters:
        - { $ref: "#/components/parameters/Target" }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ProjectPatch" }
            example: { name: Website redesign }
      responses:
        "200":
          description: Project updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  project: { $ref: "#/components/schemas/Project" }
                  changed: { type: string, const: project_updated }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/areas:
    post:
      tags: [Organize]
      operationId: createArea
      summary: Create an area
      description: Required scope `organize:write`. If an area with that name exists it is returned instead of a copy.
      x-required-scope: organize:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [name]
              properties:
                name: { type: string, minLength: 1, maxLength: 80 }
                colorToken: { type: string, pattern: '^[a-z0-9-]+$' }
            example: { name: Personal }
      responses:
        "201":
          description: Area created or existing area returned.
          content:
            application/json:
              schema:
                type: object
                properties:
                  area: { $ref: "#/components/schemas/Area" }
                  changed: { type: string, const: area_created }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/areas/{target}:
    patch:
      tags: [Organize]
      operationId: updateArea
      summary: Rename or recolor an area
      description: Required scope `organize:write`.
      x-required-scope: organize:write
      parameters:
        - { $ref: "#/components/parameters/Target" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              minProperties: 1
              properties:
                name: { type: string, minLength: 1, maxLength: 80 }
                colorToken: { type: string, pattern: '^[a-z0-9-]+$' }
            example: { name: Career }
      responses:
        "200":
          description: Area updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  area: { $ref: "#/components/schemas/Area" }
                  changed: { type: string, const: area_updated }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tags:
    post:
      tags: [Organize]
      operationId: createTag
      summary: Create a tag
      description: Required scope `organize:write`. If a tag with that name exists (any capitals) it is returned instead of a copy.
      x-required-scope: organize:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [name]
              properties:
                name: { type: string, minLength: 1, maxLength: 40 }
                colorToken: { type: string, pattern: '^[a-z0-9-]+$' }
            example: { name: admin, colorToken: info }
      responses:
        "201":
          description: Tag created or existing tag returned.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tag: { $ref: "#/components/schemas/Tag" }
                  changed: { type: string, const: tag_created }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/tags/{target}:
    patch:
      tags: [Organize]
      operationId: updateTag
      summary: Rename or recolor a tag
      description: Required scope `organize:write`. Tags cannot be deleted through the API.
      x-required-scope: organize:write
      parameters:
        - { $ref: "#/components/parameters/Target" }
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              minProperties: 1
              properties:
                name: { type: string, minLength: 1, maxLength: 40 }
                colorToken: { type: string, pattern: '^[a-z0-9-]+$' }
            example: { name: paperwork, colorToken: warning }
      responses:
        "200":
          description: Tag updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tag: { $ref: "#/components/schemas/Tag" }
                  changed: { type: string, const: tag_updated }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/recurrence:
    post:
      tags: [Recurrence]
      operationId: createRecurrence
      summary: Create a recurring task
      description: Required scope `recurrence:write`. Tags, priority and column are not copied to the repeated tasks.
      x-required-scope: recurrence:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required: [title, frequency, startsOn]
              properties:
                title: { type: string, minLength: 1, maxLength: 200 }
                frequency: { type: string, enum: [daily, weekly, monthly] }
                interval: { type: integer, minimum: 1, maximum: 365, default: 1 }
                weekdays:
                  type: array
                  maxItems: 7
                  items: { type: integer, minimum: 1, maximum: 7 }
                  description: Weekly rules only. 1 is Monday, 7 is Sunday.
                startsOn: { type: string, pattern: '^\d{4}-\d{2}-\d{2}$' }
                endsOn: { type: [string, "null"], pattern: '^\d{4}-\d{2}-\d{2}$' }
            example: { title: Review the board, frequency: weekly, interval: 1, weekdays: [1], startsOn: "2026-10-12" }
      responses:
        "201":
          description: Rule created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule: { $ref: "#/components/schemas/RecurrenceRule" }
                  nextOccurrencesCreated: { type: integer }
                  changed: { type: string, const: recurrence_created }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/recurrence/{id}/pause:
    post:
      tags: [Recurrence]
      operationId: pauseRecurrence
      summary: Pause a recurring task
      description: Required scope `recurrence:write`. The rule id is in `context.recurrence[].id`. Cancelling a rule is not available to keys.
      x-required-scope: recurrence:write
      parameters:
        - { name: id, in: path, required: true, schema: { type: string } }
      responses:
        "200":
          description: Rule paused.
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule: { $ref: "#/components/schemas/RecurrenceRule" }
                  changed: { type: string, const: recurrence_paused }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/recurrence/{id}/resume:
    post:
      tags: [Recurrence]
      operationId: resumeRecurrence
      summary: Resume a paused recurring task
      description: Required scope `recurrence:write`.
      x-required-scope: recurrence:write
      parameters:
        - { name: id, in: path, required: true, schema: { type: string } }
      responses:
        "200":
          description: Rule resumed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule: { $ref: "#/components/schemas/RecurrenceRule" }
                  changed: { type: string, const: recurrence_resumed }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/sticky:
    get:
      tags: [Sticky seeds]
      operationId: listStickyNotes
      summary: List sticky notes
      description: |
        Required scope `tasks:read`. The live wall, or the bin with `binned=1` (binned notes are purged after 7 days). Vault notes appear with `secretLabels` and `hasSecret` only; secrets, ciphertext and hints are never returned to a key.
      x-required-scope: tasks:read
      parameters:
        - { name: binned, in: query, schema: { type: string, enum: ["1"] } }
      responses:
        "200":
          description: Notes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  notes:
                    type: array
                    items: { $ref: "#/components/schemas/StickyNote" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    post:
      tags: [Sticky seeds]
      operationId: createStickyNote
      summary: Add a sticky note
      description: |
        Required scope `tasks:write`. Sprout picks the colour (rotating), a free spot near the middle of the wall, a small tilt, and puts the note on top. `source` becomes `agent:<key name>`. Points may be plain strings. If `kind` is omitted, agent-created notes default to `checklist` when points are supplied and `text` otherwise. `body` and `points` may coexist; `kind` is the primary layout.

        **Vault note.** Send `vault: true` and/or `secretLabels` to create a vault note for a secret (API key, password). Give the public details in `fields` and the secret names in `secretLabels`; each becomes a placeholder the owner fills in by hand, and you can never read or set the value. A vault note takes only `title`, `vault`, `fields`, `secretLabels`, `tags`, `colour`, `x`, `y`, `rotation`. A body containing `secrets` returns 403 `forbidden_for_api_key`.
      x-required-scope: tasks:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                title: { type: string, maxLength: 80 }
                kind: { $ref: "#/components/schemas/StickyKind" }
                points:
                  type: array
                  maxItems: 12
                  items:
                    oneOf:
                      - { type: string, minLength: 1, maxLength: 140 }
                      - { $ref: "#/components/schemas/StickyPoint" }
                tags: { type: array, maxItems: 6, items: { type: string, minLength: 1, maxLength: 40 } }
                body: { type: string, maxLength: 1000, description: "Free text; may coexist with points. Kind is the primary layout." }
                dueOn: { type: [string, "null"], pattern: "^\\d{4}-\\d{2}-\\d{2}$", description: "Optional due date YYYY-MM-DD; null clears it." }
                colour: { $ref: "#/components/schemas/StickyColour" }
                x: { type: number }
                y: { type: number }
                rotation: { type: number }
                vault: { type: boolean, description: "true makes a vault note (also implied by secretLabels)." }
                locked: { type: boolean, description: "true makes a locked note: plain details kept for good, never binned, not encrypted. Not with vault." }
                fields: { type: array, maxItems: 12, items: { $ref: "#/components/schemas/StickyField" }, description: "Public label and value pairs; vault notes only. Never a secret." }
                secretLabels: { type: array, maxItems: 6, items: { type: string, minLength: 1, maxLength: 40 }, description: "Names of the secrets the owner will paste. Stored as placeholders." }
      responses:
        "201":
          description: The new note.
          content:
            application/json:
              schema:
                type: object
                properties:
                    note: { $ref: "#/components/schemas/StickyNote" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/sticky/{id}:
    parameters:
      - { name: id, in: path, required: true, schema: { type: string, format: uuid } }
    get:
      tags: [Sticky seeds]
      operationId: getStickyNote
      summary: Read one sticky note
      x-required-scope: tasks:read
      responses:
        "200":
          description: The note (live or binned).
          content:
            application/json:
              schema:
                type: object
                properties:
                    note: { $ref: "#/components/schemas/StickyNote" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    patch:
      tags: [Sticky seeds]
      operationId: updateStickyNote
      summary: Edit a sticky note
      description: |
        Required scope `tasks:write`. Send only the fields that change; at least one is required. `points` is a full replacement. A binned note cannot be edited. On a vault note only `title`, `fields`, `tags`, `colour`, `x`, `y`, `z` and `rotation` can change; any other key, and any body containing `secrets`, `vault` or `secretLabels`, returns 403 `forbidden_for_api_key`.
      x-required-scope: tasks:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              minProperties: 1
              properties:
                title: { type: string, maxLength: 80 }
                kind: { $ref: "#/components/schemas/StickyKind" }
                points: { type: array, maxItems: 12, items: { $ref: "#/components/schemas/StickyPoint" } }
                tags: { type: array, maxItems: 6, items: { type: string, minLength: 1, maxLength: 40 } }
                body: { type: string, maxLength: 1000, description: "Free text; may coexist with points. Kind is the primary layout." }
                dueOn: { type: [string, "null"], pattern: "^\\d{4}-\\d{2}-\\d{2}$", description: "Optional due date YYYY-MM-DD; null clears it." }
                colour: { $ref: "#/components/schemas/StickyColour" }
                x: { type: number }
                y: { type: number }
                z: { type: integer, minimum: 0 }
                rotation: { type: number }
                fields: { type: array, maxItems: 12, items: { $ref: "#/components/schemas/StickyField" }, description: "Replaces the public fields (vault notes)." }
      responses:
        "200":
          description: The updated note.
          content:
            application/json:
              schema:
                type: object
                properties:
                    note: { $ref: "#/components/schemas/StickyNote" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/sticky/{id}/bin:
    parameters:
      - { name: id, in: path, required: true, schema: { type: string, format: uuid } }
    post:
      tags: [Sticky seeds]
      operationId: binStickyNote
      summary: Delete a sticky note (move it to the bin)
      description: |
        Required scope `tasks:write`. This is the delete for notes: keys cannot use HTTP DELETE, and nothing is destroyed. The note stays restorable for 7 days. Bin only a note the owner asked you to bin. A vault note or a locked note cannot be binned by a key: 403 `forbidden_for_api_key`.
      x-required-scope: tasks:write
      responses:
        "200":
          description: The note with `binnedAt` set.
          content:
            application/json:
              schema:
                type: object
                properties:
                    note: { $ref: "#/components/schemas/StickyNote" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/sticky/{id}/restore:
    parameters:
      - { name: id, in: path, required: true, schema: { type: string, format: uuid } }
    post:
      tags: [Sticky seeds]
      operationId: restoreStickyNote
      summary: Restore a binned sticky note
      x-required-scope: tasks:write
      responses:
        "200":
          description: The note back on the wall.
          content:
            application/json:
              schema:
                type: object
                properties:
                    note: { $ref: "#/components/schemas/StickyNote" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/reminders:
    get:
      tags: [Reminders]
      operationId: listReminders
      summary: List native reminders
      description: |
        Required scope `tasks:read`. Reminders are native: Sprout stores them and notifies the owner at the exact
        time. Soonest first. `from` and `to` filter on the time the reminder is next due (its time, or the snooze
        time when later). A time without an offset is read in the owner's time zone.
      x-required-scope: tasks:read
      parameters:
        - { name: status, in: query, schema: { type: string, enum: [pending, fired, dismissed] } }
        - { name: from, in: query, schema: { type: string }, description: "ISO 8601 date-time." }
        - { name: to, in: query, schema: { type: string }, description: "ISO 8601 date-time." }
        - { name: task, in: query, schema: { type: string }, description: "Task id, short id such as #12, or exact title." }
        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 200, default: 50 } }
      responses:
        "200":
          description: Matching reminders.
          content:
            application/json:
              schema:
                type: object
                properties:
                  reminders:
                    type: array
                    items: { $ref: "#/components/schemas/Reminder" }
                  timezone: { type: string }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
    post:
      tags: [Reminders]
      operationId: createReminder
      summary: Set a reminder on a task
      description: |
        Required scope `reminders:write` (`tasks:write` also works). The task is a task id, a short id (`#12`) or an
        exact title. Give the time as `remindAt` (ISO 8601 with offset, or a local date-time without offset in the
        owner's time zone) or as local `date` plus `time`. It must be in the future. The same task and time twice
        returns the existing reminder with `replayed: true`. A task can hold 20 pending reminders. Reminders cannot
        be added to completed or archived tasks. Reminders on a task that is later completed or archived never fire.
        `dryRun=true` or `X-Dry-Run: 1` validates and resolves the task without saving.
      x-required-scope: reminders:write
      parameters:
        - { $ref: "#/components/parameters/DryRunQuery" }
        - { $ref: "#/components/parameters/DryRunHeader" }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ReminderInput" }
            example: { task: "#12", remindAt: "2026-10-14T08:00:00+01:00", message: Call the bank }
      responses:
        "201":
          description: Reminder created.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/ReminderResult" }
        "200":
          description: The same reminder already existed (`replayed` is true).
          content:
            application/json:
              schema: { $ref: "#/components/schemas/ReminderResult" }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/reminders/{id}:
    get:
      tags: [Reminders]
      operationId: getReminder
      summary: Read one reminder
      description: Required scope `tasks:read`.
      x-required-scope: tasks:read
      parameters:
        - { name: id, in: path, required: true, schema: { type: string } }
      responses:
        "200":
          description: The reminder.
          content:
            application/json:
              schema:
                type: object
                properties:
                  reminder: { $ref: "#/components/schemas/Reminder" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "429": { $ref: "#/components/responses/RateLimited" }
    patch:
      tags: [Reminders]
      operationId: updateReminder
      summary: Change, snooze or dismiss a reminder
      description: |
        Required scope `reminders:write` (`tasks:write` also works). Send a new time (`remindAt` or `date` + `time`,
        which re-arms the reminder), a new `message`, `snoozeUntil`, or `dismiss: true`. A dismissed reminder cannot
        be changed. There is no DELETE: dismissing is how a reminder is removed, and `DELETE` is refused with `403`.
        `dryRun=true` or `X-Dry-Run: 1` validates the change without saving.
      x-required-scope: reminders:write
      parameters:
        - { name: id, in: path, required: true, schema: { type: string } }
        - { $ref: "#/components/parameters/DryRunQuery" }
        - { $ref: "#/components/parameters/DryRunHeader" }
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ReminderPatch" }
            example: { snoozeUntil: "2026-10-14T09:00:00+01:00" }
      responses:
        "200":
          description: The updated reminder.
          content:
            application/json:
              schema:
                type: object
                properties:
                  reminder: { $ref: "#/components/schemas/Reminder" }
                  timezone: { type: string }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
  /assistant/undo:
    post:
      tags: [Undo]
      operationId: undo
      summary: Undo an operation made through this same key
      description: |
        Required scope `history:undo`. With no `operationId` the most recent undoable operation made by this key
        is undone. Operations made by other keys or in the Sprout screens are refused with `403`.
        Comments and restores are not operations and cannot be undone.
      x-required-scope: history:undo
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                operationId: { type: string }
            example: {}
      responses:
        "200":
          description: Operation undone (or already undone, with replayed true).
          content:
            application/json:
              schema:
                type: object
                properties:
                  operation: { type: object, additionalProperties: true }
                  reversedOperationId: { type: string }
                  replayed: { type: boolean }
                  changed: { type: string, const: operation_undone }
        "400": { $ref: "#/components/responses/ValidationFailed" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { $ref: "#/components/responses/NotFound" }
        "422": { $ref: "#/components/responses/InvalidOperation" }
        "429": { $ref: "#/components/responses/RateLimited" }
components:
  securitySchemes:
    bearerKey:
      type: http
      scheme: bearer
      bearerFormat: spk_live_<8 hex>_<64 hex>
      description: |
        A Sprout API key, created once by the owner in Settings, API access. Scopes: `board:read`, `tasks:read`,
        `tasks:write`, `organize:write`, `recurrence:write`, `reminders:write`, `history:undo`. `tasks:write` is also
        enough for reminders, so existing keys keep working. There is no delete scope.
        Keys last 90 days by default. Never log the key or put it in a URL.
  parameters:
    TaskId:
      name: id
      in: path
      required: true
      description: The task's long id (a UUID), not the short number.
      schema: { type: string }
    Target:
      name: target
      in: path
      required: true
      description: The item's id or its exact name (URL-encode names).
      schema: { type: string }
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: A new random value for each new action. Reuse the same value only to retry the same request after a timeout.
      schema: { type: string }
    DryRunQuery:
      name: dryRun
      in: query
      required: false
      description: "`true` previews and validates the write without persisting it."
      schema: { type: boolean }
    DryRunHeader:
      name: X-Dry-Run
      in: header
      required: false
      description: Set to `1` to preview and validate the write without persisting it.
      schema: { type: string, enum: ["1"] }
  responses:
    ValidationFailed:
      description: A field is wrong or unknown, or the body is not valid JSON.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example: { error: { code: validation_failed, message: Provide at least one change } }
    Unauthorized:
      description: The key is missing, malformed, expired or revoked. The owner must create a new key in Sprout settings.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example: { error: { code: unauthorized, message: Invalid or expired API key } }
    Forbidden:
      description: |
        Refused for API keys: any DELETE request, a route keys cannot use, or a missing scope.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          examples:
            delete:
              value: { error: { code: forbidden_for_api_key, message: DELETE requests are not allowed for API keys } }
            scope:
              value: { error: { code: forbidden_for_api_key, message: "Missing required scope: tasks:write" } }
    NotFound:
      description: No such task or item.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example: { error: { code: not_found, message: Task not found } }
    VersionConflict:
      description: The task changed since it was read. Read it again and retry once.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example: { error: { code: version_conflict, message: The task was changed by someone else } }
    InvalidOperation:
      description: A name was not found (column, project, area, tag, subtask) or the action does not make sense. The message lists valid names.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example: { error: { code: invalid_operation, message: "Unknown column “Doing”. Valid column names: To do, In progress, Done" } }
    RateLimited:
      description: The request bucket is empty or the key reached its local-midnight daily write limit. Wait `Retry-After` for bucket limits.
      headers:
        Retry-After:
          description: Seconds to wait before the next request.
          schema: { type: integer }
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example: { error: { code: rate_limited, message: Daily write limit reached } }
  schemas:
    Error:
      type: object
      required: [error]
      properties:
        error:
          type: object
          required: [code, message]
          properties:
            code:
              type: string
              enum: [unauthorized, validation_failed, not_found, version_conflict, open_subtasks, possible_duplicate, invalid_operation, internal_error, forbidden_for_api_key, rate_limited]
            message: { type: string }
            tasks:
              type: array
              description: Present for possible_duplicate; likely matching open tasks.
              items:
                type: object
                required: [id, shortId, title, column, dueOn, similarity]
                properties:
                  id: { type: string }
                  shortId: { type: integer }
                  title: { type: string }
                  column: { type: string }
                  dueOn: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
                  similarity: { type: number, minimum: 0, maximum: 1 }
            subtasks:
              type: array
              description: Present for open_subtasks; the active children blocking completion.
              items:
                type: object
                required: [id, shortId, title]
                properties:
                  id: { type: string }
                  shortId: { type: integer }
                  title: { type: string }
    Priority:
      type: string
      enum: [none, low, medium, high]
    LocalDate:
      type: string
      pattern: '^\d{4}-\d{2}-\d{2}$'
      description: A calendar date, YYYY-MM-DD, in the owner's time zone.
    Column:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        kind: { type: string, enum: [open, active, done] }
        position: { type: integer }
        openTaskCount: { type: integer, description: Only in the context response. }
    Named:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
    ConfidenceNamed:
      allOf:
        - { $ref: "#/components/schemas/Named" }
        - type: object
          required: [confidence]
          properties:
            confidence: { type: number, minimum: 0, maximum: 1 }
    Context:
      type: object
      properties:
        apiVersion: { type: string, example: "2026-10-12" }
        today: { $ref: "#/components/schemas/LocalDate" }
        timezone: { type: string }
        docsUrl: { type: string }
        guideVersion: { type: string, description: Hash of AGENT.md. Re-read the guide when it changes. }
        profileVersion: { type: integer, description: Version of PROFILE.md, 0 if never saved. }
        memoryVersion: { type: integer, description: Version of MEMORY.md, 0 if never saved. }
        docs:
          type: object
          description: Pointers to the agent files and the API reference.
          properties:
            guide: { $ref: "#/components/schemas/DocPointer" }
            api: { $ref: "#/components/schemas/DocPointer" }
            profile: { $ref: "#/components/schemas/DocPointer" }
            memory: { $ref: "#/components/schemas/DocPointer" }
        columns: { type: array, items: { $ref: "#/components/schemas/Column" } }
        projects: { type: array, items: { $ref: "#/components/schemas/Named" } }
        areas: { type: array, items: { $ref: "#/components/schemas/Named" } }
        tags: { type: array, items: { $ref: "#/components/schemas/Named" } }
        priorities: { type: array, items: { $ref: "#/components/schemas/Priority" } }
        recurrence: { type: array, items: { type: object, additionalProperties: true } }
        recentOperations:
          type: array
          description: Up to 10 latest operations made through this key, newest first. Use the id with undo.
          items:
            type: object
            properties:
              id: { type: string }
              summary: { type: string }
              createdAt: { type: string, format: date-time }
        recentlyArchived:
          type: array
          items:
            type: object
            properties:
              id: { type: string }
              shortId: { type: integer }
              title: { type: string }
              archivedAt: { type: [string, "null"], format: date-time }
        overview: { type: object, additionalProperties: true }
        briefing: { type: string }
    Selftest:
      type: object
      required: [ok, keyName, scopes, expiresAt, serverTime, userTimezone, userLocalTime, apiVersion, limits, warnings]
      properties:
        ok: { type: boolean }
        keyName: { type: string }
        scopes: { type: array, items: { type: string } }
        expiresAt: { type: [string, "null"], format: date-time }
        serverTime: { type: string, format: date-time }
        userTimezone: { type: string }
        userLocalTime: { type: string }
        apiVersion: { type: string }
        limits:
          type: object
          properties:
            maxWritesPerDay: { type: [integer, "null"] }
            allowedProjectIds: { type: [array, "null"], items: { type: string } }
        warnings: { type: array, items: { type: string } }
    DocPointer:
      type: object
      properties:
        url: { type: string }
        name: { type: string }
        version: { type: [string, integer] }
    AgentGuide:
      type: object
      properties:
        name: { type: string, enum: [AGENT.md] }
        content: { type: string }
        version: { type: string }
    AgentDoc:
      type: object
      properties:
        kind: { type: string, enum: [profile, memory] }
        name: { type: string, enum: [PROFILE.md, MEMORY.md] }
        content: { type: string }
        version: { type: integer }
        updatedAt: { type: [string, "null"], format: date-time }
        maxChars: { type: integer, example: 20000 }
    AgentMemory:
      allOf:
        - $ref: "#/components/schemas/AgentDoc"
        - type: object
          properties:
            facts:
              type: array
              description: Facts saved by the built-in Sprout assistant (read-only here).
              items:
                type: object
                properties:
                  id: { type: string }
                  category: { type: string }
                  fact: { type: string }
                  createdAt: { type: string, format: date-time }
    AgentMemoryUpdate:
      type: object
      additionalProperties: false
      required: [content]
      properties:
        mode: { type: string, enum: [append, replace], default: append }
        content: { type: string, maxLength: 20000 }
        expectedVersion: { type: integer, minimum: 0, description: Required for replace. }
    TaskInput:
      type: object
      additionalProperties: false
      required: [title]
      properties:
        title: { type: string, minLength: 1, maxLength: 200 }
        description: { type: string, maxLength: 10000, description: What the task is (the task's own text). }
        allowDuplicate: { type: boolean, default: false, description: Explicitly allow a likely duplicate when a separate task is intended. }
        column: { type: string, description: Exact column name from the context. Default is the first column. }
        project: { type: string, description: Exact project name from the context. }
        area: { type: string, description: Exact area name from the context. }
        tags: { type: array, maxItems: 20, items: { type: string }, description: Exact tag names from the context. }
        parent: { type: [string, "null"], maxLength: 200, description: Existing task UUID, short id or exact title; null detaches this task. Nested subtasks are not allowed. }
        priority: { $ref: "#/components/schemas/Priority" }
        estimatedMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Planned effort in minutes (0 = not estimated)" }
        actualMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Minutes actually spent; the focus timer adds to this" }
        focus: { type: boolean, description: "True when the task is one of today's top three" }
        availableFrom: { $ref: "#/components/schemas/LocalDate" }
        plannedFor: { $ref: "#/components/schemas/LocalDate" }
        dueOn: { $ref: "#/components/schemas/LocalDate" }
        tentativeStart: { $ref: "#/components/schemas/LocalDate" }
        tentativeEnd: { allOf: [{ $ref: "#/components/schemas/LocalDate" }], description: Must not be before tentativeStart. }
        waitingFor: { type: string, maxLength: 200 }
        subtasks:
          type: array
          maxItems: 20
          items: { type: string, minLength: 1, maxLength: 200 }
        reminderAt: { $ref: "#/components/schemas/ReminderTime" }
        reminders:
          type: array
          maxItems: 10
          items:
            oneOf:
              - { $ref: "#/components/schemas/ReminderTime" }
              - type: object
                additionalProperties: false
                required: [remindAt]
                properties:
                  remindAt: { $ref: "#/components/schemas/ReminderTime" }
                  message: { type: [string, "null"], maxLength: 200 }
    TaskBatch:
      type: object
      additionalProperties: false
      required: [tasks]
      properties:
        tasks:
          type: array
          minItems: 1
          maxItems: 25
          items: { $ref: "#/components/schemas/TaskInput" }
    TaskPatch:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        expectedVersion: { type: integer, minimum: 1 }
        title: { type: string, minLength: 1, maxLength: 200 }
        description: { type: [string, "null"], maxLength: 10000, description: What the task is (the task's own text); null clears it. }
        column: { type: string }
        priority: { $ref: "#/components/schemas/Priority" }
        estimatedMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Planned effort in minutes (0 = not estimated)" }
        actualMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Minutes actually spent; the focus timer adds to this" }
        focus: { type: boolean, description: "True when the task is one of today's top three" }
        dueOn: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        plannedFor: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        availableFrom: { $ref: "#/components/schemas/LocalDate" }
        tentativeStart: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        tentativeEnd: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        waitingFor: { type: [string, "null"], maxLength: 200, description: null or an empty string clears it. }
        project: { type: [string, "null"], description: Exact project name, or null to remove the task from its project. }
        area: { type: [string, "null"], description: Exact area name; an empty string or null removes the area. }
        tags: { type: array, maxItems: 20, items: { type: string }, description: FULL replacement of the task's tags. To add a tag and keep the rest use addTags and never tags. }
        addTags: { type: array, maxItems: 20, items: { type: string }, description: Tag names to add; the other tags are kept. }
        removeTags: { type: array, maxItems: 20, items: { type: string }, description: Tag names to remove; the other tags are kept. }
        complete: { type: boolean, description: true finishes the task, false reopens it. A task with open subtasks cannot be completed; complete the subtasks first or send completeSubtasks true. }
        completeSubtasks: { type: boolean, description: With a completion action, complete every open child in the same undoable operation. }
        reminderAt: { $ref: "#/components/schemas/ReminderTime" }
        reminders:
          type: array
          maxItems: 10
          items:
            oneOf:
              - { $ref: "#/components/schemas/ReminderTime" }
              - type: object
                additionalProperties: false
                required: [remindAt]
                properties:
                  remindAt: { $ref: "#/components/schemas/ReminderTime" }
                  message: { type: [string, "null"], maxLength: 200 }
    Task:
      type: object
      properties:
        id: { type: string }
        shortId: { type: integer }
        title: { type: string }
        description: { type: [string, "null"] }
        statusColumnId: { type: string }
        areaId: { type: [string, "null"] }
        projectId: { type: [string, "null"] }
        parentTaskId: { type: [string, "null"] }
        priority: { $ref: "#/components/schemas/Priority" }
        estimatedMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Planned effort in minutes (0 = not estimated)" }
        actualMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Minutes actually spent; the focus timer adds to this" }
        focus: { type: boolean, description: "True when the task is one of today's top three" }
        availableFrom: { $ref: "#/components/schemas/LocalDate" }
        plannedFor: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        dueOn: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        tentativeStart: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        tentativeEnd: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        waitingFor: { type: [string, "null"] }
        positionKey: { type: number }
        tagNames: { type: array, items: { type: string } }
        commentCount: { type: integer }
        attachmentCount: { type: integer }
        completedAt: { type: [string, "null"], format: date-time }
        archivedAt: { type: [string, "null"], format: date-time }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
        version: { type: integer }
    CalendarTask:
      allOf:
        - { $ref: "#/components/schemas/TaskSummary" }
        - type: object
          properties:
            done: { type: boolean }
            overdue: { type: boolean }
            reasons: { type: array, items: { type: string, enum: [due, planned, tentative] } }
    Calendar:
      type: object
      properties:
        from: { $ref: "#/components/schemas/LocalDate" }
        to: { $ref: "#/components/schemas/LocalDate" }
        today: { $ref: "#/components/schemas/LocalDate" }
        timezone: { type: string }
        days:
          type: array
          items:
            type: object
            properties:
              date: { $ref: "#/components/schemas/LocalDate" }
              weekday: { type: string }
              mode: { type: string, enum: [past, today, future] }
              tasks: { type: array, items: { $ref: "#/components/schemas/CalendarTask" } }
              recurrence:
                type: array
                items:
                  type: object
                  properties:
                    ruleId: { type: string }
                    title: { type: string }
                    status: { type: string, enum: [active, paused] }
                    taskId: { type: [string, "null"] }
                    shortId: { type: [integer, "null"] }
              counts:
                type: object
                properties:
                  onBoard: { type: integer }
                  completed: { type: integer }
    Stats:
      type: object
      properties:
        today: { $ref: "#/components/schemas/LocalDate" }
        timezone: { type: string }
        open: { type: integer }
        perColumn:
          type: array
          items:
            type: object
            properties:
              name: { type: string }
              kind: { type: string }
              open: { type: integer }
              total: { type: integer }
        overdue: { type: integer }
        dueToday: { type: integer }
        dueIn7Days: { type: integer }
        waiting: { type: integer }
        noDate: { type: integer }
        completedToday: { type: integer }
        subtasks:
          type: object
          properties:
            open: { type: integer }
            total: { type: integer }
        overdueTasks:
          type: array
          items: { type: object, properties: { number: { type: string }, title: { type: string }, due: { type: string } } }
        todayTasks:
          type: array
          items: { type: object, properties: { number: { type: string }, title: { type: string }, due: { type: string } } }
    ActivityEntry:
      type: object
      properties:
        id: { type: string }
        operationId: { type: string }
        kind: { type: string }
        summary: { type: string }
        source: { type: string, enum: [manual, ai, system, api] }
        via: { type: [string, "null"], description: API key name for API changes }
        byThisKey: { type: boolean }
        undone: { type: boolean }
        createdAt: { type: string, format: date-time }
    TaskSummary:
      type: object
      properties:
        id: { type: string }
        shortId: { type: integer }
        title: { type: string }
        description: { type: [string, "null"] }
        column: { type: string }
        priority: { $ref: "#/components/schemas/Priority" }
        estimatedMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Planned effort in minutes (0 = not estimated)" }
        actualMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Minutes actually spent; the focus timer adds to this" }
        focus: { type: boolean, description: "True when the task is one of today's top three" }
        dueOn: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        plannedFor: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        availableFrom: { $ref: "#/components/schemas/LocalDate" }
        tentativeStart: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        tentativeEnd: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        waitingFor: { type: [string, "null"] }
        project: { type: [string, "null"] }
        area: { type: [string, "null"] }
        tags: { type: array, items: { type: string } }
        parentTaskId: { type: [string, "null"] }
        completedAt: { type: [string, "null"], format: date-time }
        version: { type: integer }
    TaskDetail:
      type: object
      properties:
        id: { type: string }
        shortId: { type: integer }
        title: { type: string }
        description: { type: [string, "null"] }
        column: { type: [string, "null"] }
        columnKind: { type: [string, "null"], enum: [open, active, done, null] }
        priority: { $ref: "#/components/schemas/Priority" }
        estimatedMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Planned effort in minutes (0 = not estimated)" }
        actualMinutes: { type: integer, minimum: 0, maximum: 10080, description: "Minutes actually spent; the focus timer adds to this" }
        focus: { type: boolean, description: "True when the task is one of today's top three" }
        project: { type: [string, "null"] }
        area: { type: [string, "null"] }
        tags: { type: array, items: { type: string } }
        availableFrom: { $ref: "#/components/schemas/LocalDate" }
        plannedFor: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        dueOn: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        tentativeStart: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        tentativeEnd: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        waitingFor: { type: [string, "null"] }
        parent:
          oneOf:
            - type: object
              properties:
                id: { type: string }
                shortId: { type: integer }
                title: { type: string }
            - { type: "null" }
        subtasks:
          type: array
          items:
            type: object
            properties:
              id: { type: string }
              shortId: { type: integer }
              title: { type: string }
              done: { type: boolean }
              version: { type: integer }
        comments:
          type: object
          properties:
            count: { type: integer }
            recent:
              type: array
              maxItems: 5
              items:
                type: object
                properties:
                  id: { type: string }
                  body: { type: string }
                  createdAt: { type: string, format: date-time }
        attachmentCount: { type: integer }
        completedAt: { type: [string, "null"], format: date-time }
        archivedAt: { type: [string, "null"], format: date-time }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
        version: { type: integer }
    TaskCreated:
      type: object
      properties:
        task: { $ref: "#/components/schemas/Task" }
        operation: { type: string, description: Operation id. Use it with undo. }
        replayed: { type: boolean }
        reminders:
          type: array
          description: Reminders created from reminderAt or reminders (empty when none were sent).
          items: { $ref: "#/components/schemas/Reminder" }
    BatchResult:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              ok: { type: boolean }
              task:
                oneOf: [{ $ref: "#/components/schemas/Task" }, { type: "null" }]
              error:
                oneOf:
                  - type: "null"
                  - type: object
                    properties:
                      code: { type: string }
                      message: { type: string }
                      tasks:
                        type: array
                        description: Present for possible_duplicate; likely matching open tasks.
                        items:
                          type: object
                          properties:
                            id: { type: string }
                            shortId: { type: integer }
                            title: { type: string }
                            column: { type: string }
                            dueOn: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
                            similarity: { type: number, minimum: 0, maximum: 1 }
    StickyColour:
      type: string
      enum: [yellow, pink, mint, sky, peach, lilac]
    StickyKind:
      type: string
      enum: [text, checklist, bullets, steps, event]
    StickyPoint:
      type: object
      additionalProperties: false
      required: [text, done]
      properties:
        text: { type: string, minLength: 1, maxLength: 140 }
        done: { type: boolean }
    StickyField:
      type: object
      additionalProperties: false
      required: [label, value]
      properties:
        label: { type: string, minLength: 1, maxLength: 40 }
        value: { type: string, maxLength: 300 }
    StickyNote:
      type: object
      description: "What an API key sees. There is no `secrets` property: secrets, ciphertext, nonce, hint and the vault setup are never returned. A vault note shows an empty `body` and `points`."
      properties:
        id: { type: string, format: uuid }
        x: { type: number }
        y: { type: number }
        z: { type: integer }
        rotation: { type: number }
        colour: { $ref: "#/components/schemas/StickyColour" }
        kind: { $ref: "#/components/schemas/StickyKind" }
        title: { type: string, maxLength: 80 }
        points: { type: array, maxItems: 12, items: { $ref: "#/components/schemas/StickyPoint" } }
        tags: { type: array, maxItems: 6, items: { type: string } }
        dueOn: { type: [string, "null"], description: "Optional due date YYYY-MM-DD." }
        body: { type: string, maxLength: 1000, description: "Free text; may coexist with points." }
        vault: { type: boolean, description: "true for a vault note (holds secrets only the owner can read)." }
        locked: { type: boolean, description: "true for a locked note: plain details that can never be binned." }
        fields: { type: array, maxItems: 12, items: { $ref: "#/components/schemas/StickyField" } }
        secretLabels: { type: array, maxItems: 6, items: { type: string }, description: "Labels of the vault note's secrets." }
        hasSecret: { type: array, maxItems: 6, items: { type: boolean }, description: "Same order as secretLabels: has the owner pasted the secret yet." }
        source: { type: string, description: "`you`, or `agent:<key name>` for notes made through a key." }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
        binnedAt: { type: [string, "null"], format: date-time }
    Reminder:
      type: object
      properties:
        id: { type: string }
        taskId: { type: string }
        remindAt: { type: string, format: date-time }
        message: { type: [string, "null"], maxLength: 200 }
        status: { type: string, enum: [pending, fired, dismissed] }
        channel: { type: string, description: "in_app today; reserved for push." }
        snoozedUntil: { type: [string, "null"], format: date-time }
        dueAt: { type: string, format: date-time, description: "When it is next due: the snooze time when later than remindAt, else remindAt." }
        firedAt: { type: [string, "null"], format: date-time }
        source: { type: [string, "null"], description: "Name of the API key that created it." }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
    ReminderTime:
      type: string
      description: |
        ISO 8601 date-time. With a timezone offset (`2026-10-14T08:00:00+01:00` or `Z`) it is an exact instant;
        without one (`2026-10-14T08:00`) it is read in the owner's time zone. Must be in the future.
      examples: ["2026-10-14T08:00:00+01:00", "2026-10-14T08:00"]
    ReminderInput:
      type: object
      additionalProperties: false
      required: [task]
      properties:
        task: { type: string, description: "Task id, short id such as #12, or exact title." }
        remindAt: { $ref: "#/components/schemas/ReminderTime" }
        date: { allOf: [{ $ref: "#/components/schemas/LocalDate" }], description: "Use with time instead of remindAt." }
        time: { type: string, pattern: '^([01]\d|2[0-3]):[0-5]\d$', description: "Local 24-hour time HH:mm in the owner's time zone." }
        message: { type: [string, "null"], maxLength: 200 }
    ReminderPatch:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        remindAt: { $ref: "#/components/schemas/ReminderTime" }
        date: { $ref: "#/components/schemas/LocalDate" }
        time: { type: string, pattern: '^([01]\d|2[0-3]):[0-5]\d$' }
        message: { type: [string, "null"], maxLength: 200 }
        snoozeUntil: { $ref: "#/components/schemas/ReminderTime" }
        dismiss: { type: boolean, const: true }
    ReminderResult:
      type: object
      properties:
        reminder: { $ref: "#/components/schemas/Reminder" }
        task:
          type: object
          properties:
            id: { type: string }
            shortId: { type: integer }
            title: { type: string }
        timezone: { type: string }
        replayed: { type: boolean }
    Comment:
      type: object
      properties:
        id: { type: string }
        taskId: { type: string }
        body: { type: string }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
    Project:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        description: { type: [string, "null"] }
        colorToken: { type: string }
        archivedAt: { type: [string, "null"], format: date-time }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
    ProjectCreate:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 80 }
        description: { type: string, maxLength: 500 }
        colorToken: { type: string, pattern: '^[a-z0-9-]+$' }
    ProjectPatch:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        name: { type: string, minLength: 1, maxLength: 80 }
        description: { type: [string, "null"], maxLength: 500 }
        colorToken: { type: string, pattern: '^[a-z0-9-]+$' }
    Area:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        kind: { type: string, enum: [personal, professional, custom] }
        colorToken: { type: string }
        archivedAt: { type: [string, "null"], format: date-time }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
    Tag:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        colorToken: { type: string }
        archivedAt: { type: [string, "null"], format: date-time }
        createdAt: { type: string, format: date-time }
        updatedAt: { type: string, format: date-time }
    RecurrenceRule:
      type: object
      properties:
        id: { type: string }
        title: { type: string }
        frequency: { type: string, enum: [daily, weekly, monthly] }
        interval: { type: integer }
        weekdays: { type: [array, "null"], items: { type: integer } }
        startDate: { $ref: "#/components/schemas/LocalDate" }
        untilDate: { oneOf: [{ $ref: "#/components/schemas/LocalDate" }, { type: "null" }] }
        pausedAt: { type: [string, "null"], format: date-time }
        archivedAt: { type: [string, "null"], format: date-time }
        version: { type: integer }
    JournalEntry:
      type: object
      properties:
        date: { type: string, format: date }
        body: { type: string, description: Markdown. Empty when nothing is written. }
        updatedBy: { type: string, enum: [user, agent] }
        updatedAt: { type: [string, "null"], format: date-time }
    JournalSearchResult:
      type: object
      properties:
        entries:
          type: array
          items:
            allOf:
              - $ref: "#/components/schemas/JournalEntry"
              - type: object
                properties:
                  excerpt: { type: string }
