> ## 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.

# Get run

> Returns run status, a pending interaction when the run is waiting for user input, and the final response when the run has completed. Only the same API key that started the run may read it.



## OpenAPI

````yaml /openapi/public-api.yaml get /v1/public/runs/{runId}
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}:
    get:
      tags:
        - Runs
      summary: Get run
      description: >-
        Returns run status, a pending interaction when the run is waiting for
        user input, and the final response when the run has completed. Only the
        same API key that started the run may read it.
      operationId: getPublicRun
      parameters:
        - name: runId
          in: path
          required: true
          description: Run ID returned by `POST /v1/public/agents/{agentId}/runs`.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Run status and result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicRun'
              examples:
                running:
                  value:
                    runId: 0cfd96a4-3e9b-40f2-9a62-8b5ec8ab19f8
                    agentId: clx_agent_123
                    laneId: start_ocr_quote_intake
                    status: running
                    finalResponse: null
                    pendingInteraction: null
                    interruptDisposition: none
                    error: null
                    startedAt: '2026-05-26T00:00:00.000Z'
                    completedAt: null
                    cancelRequestedAt: null
                    cancelledAt: null
                waitingForAnswer:
                  value:
                    runId: 0cfd96a4-3e9b-40f2-9a62-8b5ec8ab19f8
                    agentId: clx_agent_123
                    laneId: start_chat
                    status: waiting
                    finalResponse: null
                    pendingInteraction:
                      interactionId: 8ed08c7f-21e6-47ee-a862-f9fbb7e46b74
                      type: user_input
                      status: pending
                      nodeId: agent_1
                      message: Quick clarification before I continue.
                      inputMode: questions
                      allowSkip: false
                      questions:
                        - id: iterations
                          label: How many iterations should I run?
                          type: text
                          required: true
                    interruptDisposition: actionable
                    error: null
                    startedAt: '2026-05-26T00:00:00.000Z'
                    completedAt: null
                    cancelRequestedAt: null
                    cancelledAt: null
                quoteIntakeCompleted:
                  summary: Completed OCR quote intake result
                  value:
                    runId: 0cfd96a4-3e9b-40f2-9a62-8b5ec8ab19f8
                    agentId: clx_quote_agent_123
                    laneId: start_ocr_quote_intake
                    status: completed
                    finalResponse:
                      classification:
                        is_quote_request: true
                        confidence: medium
                        reason: >-
                          Email body and attached PDF include requested items
                          and quantities.
                      extractedQuote:
                        customerName: Example Customer
                        customerEmail: orders@examplecustomer.com
                        customerPoNumber: null
                        requestedShipDate: '2026-06-02'
                        currency: AUD
                        lineItems:
                          - lineNumber: 1
                            inputSku: ABC-100
                            description: competitor part ABC-100
                            quantity: 12
                      decision:
                        readyToCreatePendingQuote: false
                        recommendedAction: alert_user
                        blockingIssues:
                          - Customer could not be identified
                          - Line 2 item is ambiguous
                    pendingInteraction: null
                    interruptDisposition: none
                    error: null
                    startedAt: '2026-05-26T00:00:00.000Z'
                    completedAt: '2026-05-26T00:00:18.000Z'
                    cancelRequestedAt: null
                    cancelledAt: null
                failed:
                  value:
                    runId: 0cfd96a4-3e9b-40f2-9a62-8b5ec8ab19f8
                    agentId: clx_agent_123
                    laneId: start_ocr_quote_intake
                    status: failed
                    finalResponse: null
                    pendingInteraction: null
                    interruptDisposition: none
                    error: llm_not_configured
                    startedAt: '2026-05-26T00:00:00.000Z'
                    completedAt: '2026-05-26T00:00:03.000Z'
                    cancelRequestedAt: null
                    cancelledAt: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - PublicApiKey: []
components:
  schemas:
    PublicRun:
      type: object
      required:
        - runId
        - agentId
        - laneId
        - status
        - finalResponse
        - pendingInteraction
        - interruptDisposition
        - error
        - startedAt
        - completedAt
        - cancelRequestedAt
        - cancelledAt
      properties:
        runId:
          type: string
          format: uuid
        agentId:
          type: string
        laneId:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/RunStatus'
        finalResponse:
          description: Final agent output when status is `completed`; otherwise null.
          anyOf:
            - $ref: '#/components/schemas/QuoteIntakeResult'
            - type: object
              additionalProperties: true
            - type: string
            - type: array
            - type: number
            - type: boolean
            - type: 'null'
        pendingInteraction:
          description: Interaction to answer when status is `waiting`; otherwise null.
          anyOf:
            - $ref: '#/components/schemas/PendingInteraction'
            - type: 'null'
        interruptDisposition:
          type: string
          enum:
            - actionable
            - retained
            - none
          description: >-
            Canonical interaction lifecycle. `actionable` is the only state in
            which pendingInteraction may be answered. `retained` means a resume
            was claimed but not yet accepted and the caller must keep polling;
            `none` means there is no current actionable interaction.
        error:
          type:
            - string
            - 'null'
        startedAt:
          type: string
          format: date-time
        completedAt:
          type:
            - string
            - 'null'
          format: date-time
        cancelRequestedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Time the durable cancellation request was first accepted.
        cancelledAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Time the worker acknowledged terminal cancellation.
    RunStatus:
      type: string
      enum:
        - running
        - cancelling
        - waiting
        - completed
        - failed
        - cancelled
    QuoteIntakeResult:
      type: object
      description: Example structured result for a NetSuite OCR quote-intake agent.
      additionalProperties: true
      properties:
        classification:
          type: object
          additionalProperties: true
        source:
          type: object
          additionalProperties: true
        extractedQuote:
          type: object
          additionalProperties: true
        netsuiteMatches:
          type: object
          additionalProperties: true
        decision:
          type: object
          additionalProperties: true
    PendingInteraction:
      type: object
      additionalProperties: false
      required:
        - interactionId
        - type
        - status
      properties:
        interactionId:
          type: string
          maxLength: 512
          description: >-
            Opaque occurrence id that must be echoed when replying to this exact
            wait.
        type:
          type: string
          enum:
            - user_input
            - approval
            - async_job_batch
        status:
          type: string
        nodeId:
          type: string
        message:
          type: string
        inputMode:
          type: string
        questions:
          type: array
          items:
            $ref: '#/components/schemas/PendingQuestion'
        allowSkip:
          type: boolean
        submitLabel:
          type: string
        skipLabel:
          type: string
        approvalId:
          type: string
        actions:
          type: array
          items:
            type: string
            enum:
              - approve
              - reject
        approval:
          $ref: '#/components/schemas/PendingApprovalDetail'
        queuePosition:
          type: number
        retryDelaySeconds:
          type: number
    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
    PendingQuestion:
      type: object
      additionalProperties: true
      required:
        - id
        - label
        - type
      properties:
        id:
          type: string
        label:
          type: string
        type:
          type: string
        required:
          type: boolean
        helpText:
          type: string
        placeholder:
          type: string
        options:
          type: array
          items:
            type: object
            additionalProperties: true
        defaultValue: {}
    PendingApprovalDetail:
      type: object
      additionalProperties: false
      properties:
        kind:
          type: string
        tool:
          type: object
          additionalProperties: false
          properties:
            id:
              type: string
            name:
              type: string
            source:
              type: string
        preview:
          description: Bounded, recursively redacted preview of the proposed action.
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        field:
          type: string
        code:
          type: string
        message:
          type: string
  responses:
    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.

````