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

# Poll an async request

> Read a request's current state, and its result or error once it lands.



## OpenAPI

````yaml /openapi.yaml get /v1/requests/{id}
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: Extract
    description: >-
      Turn a document into structured data, and manage the schema types that
      shape it.
  - name: Loom
    description: Threads, messages, runs, and outcomes for an embedded agent.
  - name: Files
    description: Upload bytes once, get a durable handle, reference it from any product.
  - name: Voice
    description: Transcribe an utterance, speak a reply, list the available voices.
  - name: MCP
    description: >-
      The grants your users hold when they reach an agent from their own AI
      client.
paths:
  /v1/requests/{id}:
    get:
      tags:
        - Extract
      summary: Poll an async request
      description: Read a request's current state, and its result or error once it lands.
      operationId: getRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The request's current state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvelopeRequest'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such request in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    EnvelopeRequest:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: string
          const: success
        data:
          $ref: '#/components/schemas/RequestObject'
    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.
    RequestObject:
      type: object
      required:
        - id
        - product
        - state
      description: >-
        Present fields depend on `state` — `result` when completed, `error` when
        failed.
      properties:
        id:
          type: string
          description: Request id (`req_…`).
        product:
          type: string
          description: Workbench product that owns the work, e.g. `extract`.
        state:
          type: string
          enum:
            - pending
            - completed
            - failed
        result:
          $ref: '#/components/schemas/ExtractResult'
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
    ExtractResult:
      type: object
      required:
        - result
        - document
      properties:
        result:
          type: string
          enum:
            - extracted
            - unreadable
            - unmatched
          description: >
            `extracted` — fields are below. `unreadable` — a legal file we will
            not stand behind. `unmatched` — only from `template: "auto"`: the
            document was readable but no schema type in your workspace fits it.
        document:
          type: object
          properties:
            media_type:
              type: string
            pages:
              type: integer
              description: Page count. Images are 1. Billing is charged per page.
        template:
          type: string
          description: >-
            Schema type id used, when one was. Absent when `result` is
            `unmatched`.
        match:
          type: object
          description: >
            Present only when you sent `template: "auto"`. How we chose the
            schema type, and what else it could have been.
          properties:
            name:
              type: string
              description: >-
                Name of the matched schema type. Absent when `result` is
                `unmatched`.
            confidence:
              type: string
              enum:
                - high
                - medium
                - low
              description: >
                How sure we are of this match. A level, not a score — route on
                `low` rather than on a number we would have to keep stable.
            alternatives:
              type: array
              description: The schema types we considered and rejected, best first.
              items:
                type: object
                properties:
                  template:
                    type: string
                  name:
                    type: string
                  confidence:
                    type: string
                    enum:
                      - high
                      - medium
                      - low
        fields:
          type: object
          description: >-
            Extracted values, shaped by your schema. Present when `result` is
            `extracted`.
        missing:
          type: array
          items:
            type: string
          description: >-
            Declared fields that could not be filled. Present when `result` is
            `extracted`.
        extracted_at:
          type: string
          format: date-time
          description: Present when `result` is `extracted`.
  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).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.