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

# Reply to a waiting run

> Answers a pending `user_input` interaction and durably queues the same run to resume from its checkpoint. Only the same API key that started the run may reply. A simple `message` maps to the sole question; use `answers` for a multi-question interaction. Concurrent or repeated replies fail with `409` rather than replaying the checkpoint. Every request must echo the exact `pendingInteraction.interactionId` returned by `GET /v1/public/runs/{runId}`; a stale id cannot answer a later wait.



## OpenAPI

````yaml /openapi/public-api.yaml post /v1/public/runs/{runId}/reply
openapi: 3.1.0
info:
  title: Erstan Public Agent API
  version: 1.2.0
  description: >-
    Start published Erstan agents from external systems and poll for results.
    API keys carry scopes (`agents:list`, `agents:read`, `agents:write`,
    `agents:run`, `runs:read`, `tasks:execute`, `documents:read`,
    `documents:write`, `files:read`, `files:write`). Agent access follows the
    key creator's current workspace and team permissions. Project and team
    allowlists (`allowedProjectIds`, `allowedTeamIds`) further restrict task and
    document and file access. Agent draft authoring and task/document/file tools
    are exposed through the MCP server at `/v1/mcp` rather than REST routes.
servers:
  - url: https://api.erstan.com
    description: Public endpoint
security:
  - PublicApiKey: []
tags:
  - name: Agents
    description: >-
      Discover and run published agents available to the key creator under their
      current permissions.
  - name: Runs
    description: Read run status and results.
  - name: MCP
    description: >-
      Model Context Protocol server for external clients. Agent Builder tools
      use `agents:read`, `agents:write`, or both, plus the key creator's live
      Erstan permissions. Task and content tools also apply project/team
      allowlists.
paths:
  /v1/public/runs/{runId}/reply:
    post:
      tags:
        - Runs
      summary: Reply to a waiting run
      description: >-
        Answers a pending `user_input` interaction and durably queues the same
        run to resume from its checkpoint. Only the same API key that started
        the run may reply. A simple `message` maps to the sole question; use
        `answers` for a multi-question interaction. Concurrent or repeated
        replies fail with `409` rather than replaying the checkpoint. Every
        request must echo the exact `pendingInteraction.interactionId` returned
        by `GET /v1/public/runs/{runId}`; a stale id cannot answer a later wait.
      operationId: replyToPublicRun
      parameters:
        - name: runId
          in: path
          required: true
          description: Waiting run ID returned by `POST /v1/public/agents/{agentId}/runs`.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunReplyRequest'
            examples:
              oneQuestion:
                value:
                  interactionId: 8ed08c7f-21e6-47ee-a862-f9fbb7e46b74
                  message: '2'
              questionnaire:
                value:
                  interactionId: 8ed08c7f-21e6-47ee-a862-f9fbb7e46b74
                  answers:
                    iterations: '2'
                    output_format: concise
                  userMessage: Submitted the requested run settings.
              skip:
                value:
                  interactionId: 8ed08c7f-21e6-47ee-a862-f9fbb7e46b74
                  skip: true
      responses:
        '202':
          description: Reply accepted and the run queued to resume.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunReplyResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The run is not waiting for a reply, has a non-replyable interaction,
            or another reply already claimed it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            The reply was valid but could not be queued; the waiting state is
            restored and the caller may retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - PublicApiKey: []
components:
  schemas:
    RunReplyRequest:
      type: object
      additionalProperties: false
      required:
        - interactionId
      properties:
        interactionId:
          type: string
          minLength: 1
          maxLength: 512
          description: Exact value from the current get_run pendingInteraction.
        message:
          type: string
          description: >-
            Free-text response; maps to the sole question when exactly one
            exists.
        userMessage:
          type: string
          description: User-facing transcript text and free-text response alias.
        answers:
          type: object
          additionalProperties: true
          description: >-
            Answers keyed by question ID for structured or multi-question
            interactions.
        answerLabels:
          type: object
          additionalProperties: true
        questionIds:
          type: array
          items:
            type: string
        action:
          type: string
          enum:
            - submit
            - skip
        skip:
          type: boolean
        skipped:
          type: boolean
      anyOf:
        - required:
            - message
        - required:
            - userMessage
        - required:
            - answers
        - required:
            - skip
        - required:
            - skipped
        - required:
            - action
    RunReplyResponse:
      type: object
      additionalProperties: false
      required:
        - runId
        - agentId
        - status
      properties:
        runId:
          type: string
          format: uuid
        agentId:
          type: string
        status:
          type: string
          const: running
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                $ref: '#/components/schemas/ErrorDetail'
            requestId:
              type: string
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        field:
          type: string
        code:
          type: string
        message:
          type: string
  responses:
    BadRequest:
      description: Request validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, expired, revoked, or inactive API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: >-
        The API key lacks scope or the creator lacks current permission for the
        requested operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: The requested agent or run was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    PublicApiKey:
      type: http
      scheme: bearer
      bearerFormat: ers_live API key
      description: >-
        Workspace API key created in Erstan Settings. Keys carry scopes
        (`agents:list`, `agents:read`, `agents:write`, `agents:run`,
        `runs:read`, `tasks:execute`, `documents:read`, `documents:write`,
        `files:read`, `files:write`). Agent access follows the key creator's
        current workspace, team, and agent permissions. Agent draft creation
        requires `agents:write`; update, validation, and publishing require both
        `agents:read` and `agents:write`; draft testing also requires
        `agents:run`. Keys with `tasks:execute` must include at least one
        allowed project or team (`allowedProjectIds` / `allowedTeamIds`); keys
        with document or file scopes must include at least one allowed team.
        Empty allowlists mean no access — the API fails closed.

````