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

# Decide a waiting run approval

> Explicitly approves or rejects the exact approval occurrence currently blocking a run, then durably queues that run to resume from its checkpoint. The approval id is derived server-side from the persisted interaction. Only the same API key that started the run may decide it. Concurrent, repeated, or stale decisions fail with `409`.



## OpenAPI

````yaml /openapi/public-api.yaml post /v1/public/runs/{runId}/approval
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}/approval:
    post:
      tags:
        - Runs
      summary: Decide a waiting run approval
      description: >-
        Explicitly approves or rejects the exact approval occurrence currently
        blocking a run, then durably queues that run to resume from its
        checkpoint. The approval id is derived server-side from the persisted
        interaction. Only the same API key that started the run may decide it.
        Concurrent, repeated, or stale decisions fail with `409`.
      operationId: decidePublicRunApproval
      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/RunApprovalDecisionRequest'
            examples:
              approve:
                value:
                  interactionId: approval:approval_abc123
                  action: approve
              reject:
                value:
                  interactionId: approval:approval_abc123
                  action: reject
      responses:
        '202':
          description: Decision accepted and the run queued to resume.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunApprovalDecisionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The current interaction is not that pending approval, or another
            decision already claimed it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            The decision was valid but could not be queued; all decision state
            is rolled back and the caller may retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - PublicApiKey: []
components:
  schemas:
    RunApprovalDecisionRequest:
      type: object
      additionalProperties: false
      required:
        - interactionId
        - action
      properties:
        interactionId:
          type: string
          minLength: 1
          maxLength: 512
          description: Exact value from the current approval pendingInteraction.
        action:
          type: string
          enum:
            - approve
            - reject
    RunApprovalDecisionResponse:
      type: object
      additionalProperties: false
      required:
        - runId
        - agentId
        - status
        - approvalId
        - action
      properties:
        runId:
          type: string
          format: uuid
        agentId:
          type: string
        status:
          type: string
          const: running
        approvalId:
          type: string
        action:
          type: string
          enum:
            - approve
            - reject
    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.

````