Bernstein Approvals API

The approvals API from Bernstein — 12 operation(s) for approvals.

Operations 12

GET /approvals List Approvals #
POST /approvals/{task_id}/approve Approve Task #
POST /approvals/{task_id}/reject Reject Task #
GET /approvals/queue List Queued Approvals #
POST /approvals/{approval_id}/resolve Resolve Queued Approval #
GET /approvals/live-fragment Approvals Live Fragment #
GET /api/v1/approvals List Approvals #
POST /api/v1/approvals/{task_id}/approve Approve Task #
POST /api/v1/approvals/{task_id}/reject Reject Task #
GET /api/v1/approvals/queue List Queued Approvals #
POST /api/v1/approvals/{approval_id}/resolve Resolve Queued Approval #
GET /api/v1/approvals/live-fragment Approvals Live Fragment #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/bernstein-run:bernstein-run-approvals-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

bernstein-run-approvals-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Bernstein Task Server Approvals API
  description: 'Bernstein REST API - the open-source governance layer for AI agents, one git worktree per task.


    ## Authentication


    Authentication is ENABLED by default. Include a Bearer token in all requests:


    ```

    Authorization: Bearer

    ```


    To run without auth (development only), set `BERNSTEIN_AUTH_DISABLED=1` - this logs a loud warning and passes every request through.


    Public endpoints (no auth required): `/health`, `/health/ready`, `/health/live`, `/ready`, `/alive`, `/.well-known/agent.json`, `/docs`, `/openapi.json`, and the auth-flow endpoints (`/auth/login`, `/auth/oidc/callback`, etc.).


    Webhook and hook endpoints (`/webhook`, `/webhooks/*`, `/hooks/{session_id}`) authenticate via HMAC-SHA256 signatures - they do NOT accept Bearer tokens.


    ## Base URL


    Default: `http://127.0.0.1:8052`. Override with env vars `BERNSTEIN_HOST` and `BERNSTEIN_PORT`.


    ## Error Format


    All errors return JSON with a `detail` field:


    ```json

    {"detail": "Task not found: task-xyz"}

    ```


    | Status | Meaning |

    |--------|---------|

    | 400 | Bad request (validation error) |

    | 401 | Unauthorized (missing/invalid token) |

    | 403 | Forbidden (IP not in allowlist) |

    | 404 | Resource not found |

    | 409 | Conflict (task already in terminal state) |

    | 429 | Rate limited - respect the `Retry-After` header |

    | 500 | Internal server error |'
  version: 3.22.0
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  contact:
    name: Alex Chernysh
    url: https://github.com/sipyourdrink-ltd/bernstein
servers:
- url: http://{host}:{port}
  description: Task server started by the Bernstein CLI on the operator's own machine. There is no hosted instance; substitute the host and port of your install.
  variables:
    host:
      default: 127.0.0.1
      description: Interface the task server binds to. Loopback by default.
    port:
      default: '8052'
      description: Task server port. Override with BERNSTEIN_PORT.
tags:
- name: Approvals
paths:
  /approvals:
    get:
      tags:
      - Approvals
      summary: List Approvals
      description: List all pending approval requests across task-review and pre-spawn gates.
      operationId: list_approvals_approvals_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListApprovalsResponse'
  /approvals/{task_id}/approve:
    post:
      tags:
      - Approvals
      summary: Approve Task
      description: 'Approve a pending approval request.


        Writes a .approved decision file so the orchestrator poll loop unblocks.

        The pending file is then removed.


        Args:

        task_id: Task ID to approve.

        body: Optional reason metadata.


        Returns:

        Success message.'
      operationId: approve_task_approvals__task_id__approve_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovalDecisionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Approve Task Approvals  Task Id  Approve Post
        '400':
          description: Invalid task_id format
        '404':
          description: No pending approval for task
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /approvals/{task_id}/reject:
    post:
      tags:
      - Approvals
      summary: Reject Task
      description: 'Reject a pending approval request.


        Writes a .rejected decision file so the orchestrator poll loop unblocks.

        The pending file is then removed.


        Args:

        task_id: Task ID to reject.

        body: Optional reason metadata.


        Returns:

        Success message.'
      operationId: reject_task_approvals__task_id__reject_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovalDecisionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Reject Task Approvals  Task Id  Reject Post
        '400':
          description: Invalid task_id format
        '404':
          description: No pending approval for task
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /approvals/queue:
    get:
      tags:
      - Approvals
      summary: List Queued Approvals
      description: 'List pending tool-call approvals (op-002).


        Args:

        session_id: Optional filter; when given only approvals for that

        session are returned.'
      operationId: list_queued_approvals_approvals_queue_get
      parameters:
      - name: session_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueuedApprovalsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /approvals/{approval_id}/resolve:
    post:
      tags:
      - Approvals
      summary: Resolve Queued Approval
      description: 'Resolve a queued approval with ``allow``, ``reject``, or ``always``.


        The request body must echo the ``nonce`` the gate issued when the

        approval was queued. Mismatches return ``409 NONCE_MISMATCH``; a

        nonce replayed against an already-resolved or evicted approval

        returns ``410 NONCE_EXPIRED``. The resolution is attributed to the

        principal the request authenticated as. When scoped tokens are

        configured and the request presents none, the call is refused with

        ``401`` rather than recorded against an unnamed caller; when no scoped

        tokens are configured the server is in its loopback posture and the

        decision is attributed to the loopback operator.'
      operationId: resolve_queued_approval_approvals__approval_id__resolve_post
      parameters:
      - name: approval_id
        in: path
        required: true
        schema:
          type: string
          title: Approval Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResolveRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Resolve Queued Approval Approvals  Approval Id  Resolve Post
        '400':
          description: Invalid approval id or decision
        '401':
          description: No authenticated principal to attribute the decision to
        '404':
          description: No pending approval with that id
        '409':
          description: NONCE_MISMATCH
        '410':
          description: NONCE_EXPIRED
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /approvals/live-fragment:
    get:
      tags:
      - Approvals
      summary: Approvals Live Fragment
      description: 'Return an HTML fragment the live-session page embeds.


        Each pending approval becomes a row with three buttons that POST the

        resolution back to ``/approvals/{id}/resolve``. The fragment is

        intentionally minimal so it can be inlined into the existing live

        dashboard without pulling a new framework.'
      operationId: approvals_live_fragment_approvals_live_fragment_get
      parameters:
      - name: session_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/approvals:
    get:
      tags:
      - Approvals
      summary: List Approvals
      description: List all pending approval requests across task-review and pre-spawn gates.
      operationId: list_approvals_api_v1_approvals_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListApprovalsResponse'
  /api/v1/approvals/{task_id}/approve:
    post:
      tags:
      - Approvals
      summary: Approve Task
      description: 'Approve a pending approval request.


        Writes a .approved decision file so the orchestrator poll loop unblocks.

        The pending file is then removed.


        Args:

        task_id: Task ID to approve.

        body: Optional reason metadata.


        Returns:

        Success message.'
      operationId: approve_task_api_v1_approvals__task_id__approve_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovalDecisionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Approve Task Api V1 Approvals  Task Id  Approve Post
        '400':
          description: Invalid task_id format
        '404':
          description: No pending approval for task
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/approvals/{task_id}/reject:
    post:
      tags:
      - Approvals
      summary: Reject Task
      description: 'Reject a pending approval request.


        Writes a .rejected decision file so the orchestrator poll loop unblocks.

        The pending file is then removed.


        Args:

        task_id: Task ID to reject.

        body: Optional reason metadata.


        Returns:

        Success message.'
      operationId: reject_task_api_v1_approvals__task_id__reject_post
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovalDecisionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Reject Task Api V1 Approvals  Task Id  Reject Post
        '400':
          description: Invalid task_id format
        '404':
          description: No pending approval for task
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/approvals/queue:
    get:
      tags:
      - Approvals
      summary: List Queued Approvals
      description: 'List pending tool-call approvals (op-002).


        Args:

        session_id: Optional filter; when given only approvals for that

        session are returned.'
      operationId: list_queued_approvals_api_v1_approvals_queue_get
      parameters:
      - name: session_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueuedApprovalsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/approvals/{approval_id}/resolve:
    post:
      tags:
      - Approvals
      summary: Resolve Queued Approval
      description: 'Resolve a queued approval with ``allow``, ``reject``, or ``always``.


        The request body must echo the ``nonce`` the gate issued when the

        approval was queued. Mismatches return ``409 NONCE_MISMATCH``; a

        nonce replayed against an already-resolved or evicted approval

        returns ``410 NONCE_EXPIRED``. The resolution is attributed to the

        principal the request authenticated as. When scoped tokens are

        configured and the request presents none, the call is refused with

        ``401`` rather than recorded against an unnamed caller; when no scoped

        tokens are configured the server is in its loopback posture and the

        decision is attributed to the loopback operator.'
      operationId: resolve_queued_approval_api_v1_approvals__approval_id__resolve_post
      parameters:
      - name: approval_id
        in: path
        required: true
        schema:
          type: string
          title: Approval Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResolveRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
                title: Response Resolve Queued Approval Api V1 Approvals  Approval Id  Resolve Post
        '400':
          description: Invalid approval id or decision
        '401':
          description: No authenticated principal to attribute the decision to
        '404':
          description: No pending approval with that id
        '409':
          description: NONCE_MISMATCH
        '410':
          description: NONCE_EXPIRED
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/approvals/live-fragment:
    get:
      tags:
      - Approvals
      summary: Approvals Live Fragment
      description: 'Return an HTML fragment the live-session page embeds.


        Each pending approval becomes a row with three buttons that POST the

        resolution back to ``/approvals/{id}/resolve``. The fragment is

        intentionally minimal so it can be inlined into the existing live

        dashboard without pulling a new framework.'
      operationId: approvals_live_fragment_api_v1_approvals_live_fragment_get
      parameters:
      - name: session_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    QueuedApprovalsResponse:
      properties:
        pending:
          items:
            $ref: '#/components/schemas/QueuedApprovalResponse'
          type: array
          title: Pending
      type: object
      required:
      - pending
      title: QueuedApprovalsResponse
      description: Response envelope for ``GET /approvals/queue``.
    ListApprovalsResponse:
      properties:
        pending:
          items:
            $ref: '#/components/schemas/PendingApproval'
          type: array
          title: Pending
      type: object
      required:
      - pending
      title: ListApprovalsResponse
      description: Response for GET /approvals.
    ApprovalDecisionRequest:
      properties:
        reason:
          type: string
          title: Reason
          default: ''
      type: object
      title: ApprovalDecisionRequest
      description: Body for POST /approvals/{task_id}/approve or /reject.
    ResolveRequest:
      properties:
        decision:
          type: string
          enum:
          - allow
          - reject
          - always
          title: Decision
        nonce:
          type: string
          title: Nonce
          default: ''
        reason:
          type: string
          title: Reason
          default: ''
      type: object
      required:
      - decision
      title: ResolveRequest
      description: 'Body for ``POST /approvals/{id}/resolve``.


        The reply must echo the exact ``nonce`` hex string issued when the

        approval was queued. ``nonce`` defaults to an empty string at the

        schema layer so a missing field flows through the handler as a

        nonce mismatch (``409 NONCE_MISMATCH``) rather than a Pydantic 422

        validation error, matching the documented contract.'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    QueuedApprovalResponse:
      properties:
        id:
          type: string
          title: Id
        session_id:
          type: string
          title: Session Id
        agent_role:
          type: string
          title: Agent Role
        tool_name:
          type: string
          title: Tool Name
        tool_args:
          additionalProperties: true
          type: object
          title: Tool Args
        created_at:
          type: number
          title: Created At
        ttl_seconds:
          type: integer
          title: Ttl Seconds
        nonce:
          type: string
          title: Nonce
      type: object
      required:
      - id
      - session_id
      - agent_role
      - tool_name
      - tool_args
      - created_at
      - ttl_seconds
      - nonce
      title: QueuedApprovalResponse
      description: 'One queued tool-call approval from the op-002 approval queue.


        The ``nonce`` field is the hex-encoded single-use token the reply

        must echo. It travels only over the human-channel surface (TUI,

        dashboard, chat bridge) and never reaches agent stdin or any

        rendered prompt template.'
    PendingApproval:
      properties:
        task_id:
          type: string
          title: Task Id
        task_title:
          type: string
          title: Task Title
        session_id:
          type: string
          title: Session Id
        diff:
          type: string
          title: Diff
          default: ''
        test_summary:
          type: string
          title: Test Summary
          default: ''
        mechanism:
          type: string
          title: Mechanism
          default: task_review
        prompt:
          type: string
          title: Prompt
          default: ''
        default_action:
          type: string
          title: Default Action
          default: ''
        timeout_at_iso:
          type: string
          title: Timeout At Iso
          default: ''
        created_iso:
          type: string
          title: Created Iso
          default: ''
        timeout_seconds:
          anyOf:
          - type: integer
          - type: 'null'
          title: Timeout Seconds
        unblocks:
          type: string
          title: Unblocks
          default: task completion and merge
        resolution_endpoint:
          type: string
          title: Resolution Endpoint
          default: ''
      type: object
      required:
      - task_id
      - task_title
      - session_id
      title: PendingApproval
      description: A single pending approval request (task-level or pre-spawn).