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

# Reprocess a document

> Re-extract a document, optionally with a new schema.

Re-runs extraction, optionally with a different published schema version (or none). Completing this run is a **new page charge**. Ingest-born documents go through the batch worker so spend stays `black_hole`.

**Retry** of a *failed* document is a different route on the chat-pk surface and does not start a billed full reprocess.


## OpenAPI

````yaml POST /api/v2/documents/attachments/{att_id}/reprocess/
openapi: 3.1.0
info:
  title: Abacus Docs API
  version: 1.0.0
  description: |
    REST + SSE surface for Abacus Docs on the same host as the web app
    (`https://abacusdocs.com`). Paths are `/api/v2/…`.

    Authenticate with an organisation API key (`sk-abacus-*`) as a Bearer
    token, or an Auth0 access token. Cross-tenant reads return **404**, not
    403. Page-based lists use `?page=` and `?page_size=`.

    Extraction, reprocess, schema tests, and chat turns spend credits.
    See the help centre Credits pages for rates.
  contact:
    name: Abacus Docs
    url: https://abacusdocs.com/contact
servers:
  - url: https://abacusdocs.com
    description: Production (Extract)
security: []
paths:
  /api/v2/documents/attachments/{att_id}/reprocess/:
    post:
      tags:
        - v2/documents
      summary: Reprocess a document with a new (or no) schema
      description: >-
        Re-fires Lynx in place (Decision 6: in-place overwrite, no version
        history). ``struct_version_id`` int → schema-guided extraction; ``null``
        / omitted → OCR-only. Billing is attributed to the caller (per-user
        attribution invariant), even on a shared-batch doc. The document must be
        COMPLETED (reprocess) or FAILED (retry a failed extraction); a run
        already in flight (pending/processing) is 409.
      operationId: v2_documents_attachments_reprocess_create
      parameters:
        - in: path
          name: att_id
          schema:
            type: integer
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentReprocessRequestRequest'
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Progress'
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
        '403':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
        '409':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
      security:
        - extractApiKey: []
        - bearerAuth: []
        - cookieAuth: []
components:
  schemas:
    DocumentReprocessRequestRequest:
      type: object
      description: |-
        Body for POST ``/attachments/<att_id>/reprocess/``.

        ``struct_version_id``:
            * an int → pin that ``StructVersion`` and run schema-guided extraction
            * ``null`` / omitted → remove any schema and run OCR-only re-extraction
      properties:
        struct_version_id:
          type:
            - integer
            - 'null'
    Progress:
      type: object
      description: >-
        Processing status snapshot for the progress-polling endpoint.


        Serializes ChatAttachment directly (not Chat) because the progress
        endpoint

        queries the attachment by chat pk.
      properties:
        status:
          type: string
        progress:
          type: integer
        stage:
          type: string
        page_count:
          type: integer
          maximum: 2147483647
          minimum: 0
          description: Number of pages in the original document
      required:
        - progress
        - stage
        - status
  securitySchemes:
    extractApiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Organisation API key from Settings → API / `/api/keys/`. The secret is
        shown once. Send `Authorization: Bearer sk-abacus-…`. One active key
        per organisation. Ingest (`/api/v2/ingest/*`) refuses API keys — that
        surface is Auth0-only with `ingest:read` / `ingest:write` scopes.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Auth0 access token for a signed-in user. Send `Authorization: Bearer
        <token>`.

        The SPA and desktop agent use this. Prefer an organisation API key for

        server-to-server integrations.
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid
      description: |
        Django session cookie from a browser login. Present so the web app can
        call `/api/v2` without a header. Do not rely on this for integrations.

````