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

# Ask the coach to answer what was said

> Runs the model over the thread as it stands and writes its reply into it. Post the message first with `POST /coach/messages`: recording and answering are separate so a slow or failing model never loses what was typed.

Answers while it works. The reply is written progressively into a message that `GET /coach/stream` returns, so a caller can show what is happening instead of a blank wait; that message becomes the finished reply when this returns.

The coach acts as well as speaks: it may call any operation this API exposes, on behalf of the caller and with the caller's permissions. `actions` counts what it did.

Fails with a 409 when no Anthropic key is stored — the thread stays readable without one.



## OpenAPI

````yaml https://api.doers.sh/openapi.json post /v2/coach/reply
openapi: 3.1.0
info:
  title: Doers API
  version: 2.0.0
  description: >-
    The open API of Doers: tasks, projects, areas, prioritised context and the
    day's plan.


    ## Authentication


    Every route requires a bearer token, generated from **Settings > API & MCP**
    in the app:


    ```

    Authorization: Bearer pc_…

    ```


    ## Two date fields, not to be confused


    - `when` — the **schedule**: `today`, `anytime` (Later), `someday` (Future)
    or a date.

    - `deadline` — the **commitment**, independent of the schedule.


    ## Time zone


    The server reasons in UTC and does not know yours. Send the `X-PC-Today:
    YYYY-MM-DD` header

    (or the `day` argument where it exists) so dated operations use your local
    day.


    ## MCP server


    The same token gives access to the [Model Context
    Protocol](https://modelcontextprotocol.io)

    server at `POST https://doers.sh/mcp`, which exposes the same operations as
    tools for Claude,

    Cursor and other compatible clients.
servers:
  - url: https://api.doers.sh
    description: Production.
security:
  - bearerAuth: []
tags:
  - name: Tasks
  - name: Projects
  - name: Areas
  - name: Headings
  - name: Comments
  - name: Realtime
  - name: Devices
  - name: Context
  - name: Plan
  - name: Sessions
  - name: Rounds
  - name: Journal
  - name: Habits
  - name: Stats
  - name: Users
  - name: Profiles
  - name: Workspaces
  - name: Access
  - name: Activity
  - name: Tokens
  - name: Referrals
  - name: Files
  - name: Connections
  - name: Collaborators
  - name: Links
  - name: Packages
  - name: Installs
  - name: Billing
  - name: Calendar
  - name: Coach
  - name: Marketplace
paths:
  /v2/coach/reply:
    post:
      tags:
        - Coach
      summary: Ask the coach to answer what was said
      description: >-
        Runs the model over the thread as it stands and writes its reply into
        it. Post the message first with `POST /coach/messages`: recording and
        answering are separate so a slow or failing model never loses what was
        typed.


        Answers while it works. The reply is written progressively into a
        message that `GET /coach/stream` returns, so a caller can show what is
        happening instead of a blank wait; that message becomes the finished
        reply when this returns.


        The coach acts as well as speaks: it may call any operation this API
        exposes, on behalf of the caller and with the caller's permissions.
        `actions` counts what it did.


        Fails with a 409 when no Anthropic key is stored — the thread stays
        readable without one.
      operationId: generateCoachReply
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                agent:
                  type: object
                  description: >-
                    Required when `agentKey` names an agent: its instructions
                    live on the caller's disk, not in this database.
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 200
                    instructions:
                      type: string
                      maxLength: 40000
                    notes:
                      maxItems: 40
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            maxLength: 200
                          body:
                            type: string
                            maxLength: 40000
                        required:
                          - name
                          - body
                        additionalProperties: false
                      description: >-
                        Reference notes shipped with the agent, injected as its
                        knowledge.
                  required:
                    - name
                    - instructions
                    - notes
                  additionalProperties: false
                agentKey:
                  type: string
                  description: >-
                    The agent whose thread this is. Absent means the coach's
                    own.
                  maxLength: 200
                images:
                  type: array
                  items:
                    type: object
                    properties:
                      mediaType:
                        type: string
                        enum:
                          - image/jpeg
                          - image/png
                          - image/gif
                          - image/webp
                        description: >-
                          What the Messages API accepts. Anything else is
                          refused here.
                      data:
                        type: string
                        minLength: 1
                        maxLength: 5592410
                        description: Base64, no prefix.
                    required:
                      - mediaType
                      - data
                    additionalProperties: false
                  maxItems: 4
                mode:
                  type: string
                  description: >-
                    A brain-dump: organise it into tasks and a plan now, without
                    asking questions.
                  const: dump
                uiContext:
                  type: string
                  description: >-
                    Where the person is — the view, project or task open in
                    front of them.
                  maxLength: 2000
              additionalProperties: false
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  reply:
                    type: string
                  actions:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: Tool calls the coach made. Zero means it only spoke.
                required:
                  - reply
                  - actions
                additionalProperties: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        Invalid request — unreadable body, out-of-range field or unknown
        parameter.
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Token missing, unknown or revoked.
    Conflict:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Conflicts with the resource's current state.
    TooManyRequests:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Too many requests. `Retry-After` says how many seconds to wait.
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable machine-readable code.
            message:
              type: string
              description: Human-readable message.
            details:
              type: array
              description: Per-field detail, present on validation errors.
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - field
                  - message
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A `pc_…` token generated from Settings > API & MCP.

````