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

# Resolve an outcome

> Tell the runtime what happened to a proposed action — the user approved it (`occurred`) or it failed (`failed`). Resumes the run.




## OpenAPI

````yaml /openapi.yaml post /v1/loom/runs/{run_id}/outcome
openapi: 3.1.0
info:
  title: Patchwork API
  version: 1.0.0
  description: >
    Public data-plane API. Two products today: Identify (bare account
    resolution) and Loom (threads, runs, and outcomes). Every response is a JSON
    envelope — `status: success` with `data`, or `status: error` with `error`.
  contact:
    url: https://usepatchwork.co
servers:
  - url: https://api.usepatchwork.co
security:
  - bearerAuth: []
tags:
  - name: Identify
    description: Resolve an account or wallet to the institution and rails behind it.
  - name: Loom
    description: Threads, messages, runs, and outcomes for an embedded agent.
paths:
  /v1/loom/runs/{run_id}/outcome:
    post:
      tags:
        - Loom
      summary: Resolve an outcome
      description: >
        Tell the runtime what happened to a proposed action — the user approved
        it (`occurred`) or it failed (`failed`). Resumes the run.
      operationId: resolveOutcome
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - $ref: '#/components/parameters/PatchworkSubject'
        - $ref: '#/components/parameters/PatchworkConnection'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - tool_call_id
                - state
              properties:
                tool_call_id:
                  type: string
                  format: uuid
                state:
                  type: string
                  enum:
                    - occurred
                    - failed
                detail:
                  type: object
                  description: Optional structured detail recorded on the outcome.
            example:
              tool_call_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
              state: occurred
      responses:
        '202':
          description: Outcome accepted; run resumed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvelopeOutcome'
        '401':
          description: Missing or invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Unknown action or run.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Run is not awaiting an outcome, or state is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    PatchworkSubject:
      name: Patchwork-Subject
      in: header
      required: false
      description: >
        Relay only. Opaque subject id for the acting user. Direct tokens carry
        `sub` instead — do not send this header on a session token.
      schema:
        type: string
    PatchworkConnection:
      name: Patchwork-Connection
      in: header
      required: false
      description: >
        Connection id or name the agent may call. Required in relay when the
        agent has unpinned customer tools. Direct tokens may carry `conn`
        instead.
      schema:
        type: string
  schemas:
    EnvelopeOutcome:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: string
          const: success
        data:
          $ref: '#/components/schemas/OutcomeAccepted'
    Error:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: string
          const: error
        error:
          type: object
          required:
            - message
            - code
          properties:
            message:
              type: string
              description: Human-readable explanation.
            code:
              type: string
              description: Stable machine-readable code.
            details:
              description: Optional extra context.
    OutcomeAccepted:
      type: object
      properties:
        run_id:
          type: string
          format: uuid
        state:
          $ref: '#/components/schemas/RunState'
    RunState:
      type: string
      enum:
        - running
        - awaiting_input
        - awaiting_outcome
        - closed
        - failed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Identify accepts a workspace API key (`sk_…`). Loom accepts either a
        short-lived session token (direct) or a workspace API key (relay).

````