{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/webcite/json-schema/webcite-extract-pages-response-dto-schema.json",
  "title": "ExtractPagesResponseDto",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/webcite-openapi.json#/components/schemas/ExtractPagesResponseDto",
  "properties": {
    "chunks": {
      "description": "Anchored chunks, in document order. Empty both when the document held no text and when the read was refused — `code` is what tells those apart.",
      "items": {
        "$ref": "#/$defs/AnchoredChunkDto"
      },
      "type": "array"
    },
    "code": {
      "description": "The stable classification of `reason`, safe to switch on. The same vocabulary and the same values as `POST /extract`. Null when nothing refused.\n\n| Code | What it means | What to do |\n|------|---------------|------------|\n| `source_too_large` | a size or expansion ceiling refused the read | `reason` carries the observed value and the limit; send a smaller file |\n| `source_encrypted` | the container is password-protected | send an unlocked copy |\n| `source_corrupt` | the container could not be opened as the format it declares | re-export the file |\n| `unsupported_format` | no reader is registered for this format | convert it |\n| `ocr_unavailable` | the page had no text layer and no vision provider is configured | configure a vision key, or send a text-layer file |\n| `partial_extraction` | some of the source was recovered and some was not | use what came back |\n| `empty_source` | the source was read and held nothing | a fact about the file, not a failure — nothing to retry |\n| `extraction_error` | our failure | retry |",
      "enum": [
        "source_too_large",
        "source_encrypted",
        "source_corrupt",
        "unsupported_format",
        "ocr_unavailable",
        "partial_extraction",
        "empty_source",
        "extraction_error"
      ],
      "type": [
        "string",
        "null"
      ]
    },
    "mode": {
      "description": "Present when the chunks come from a `mode: \"lite\"` request; absent on a standard request.",
      "enum": [
        "lite"
      ],
      "type": "string"
    },
    "reason": {
      "description": "Free text naming the cause, straight from whatever refused or failed — `spreadsheet_magic_mismatch:xlsx`, `spreadsheet_too_large:bytes:33554433>33554432`, `extraction_failed:File is password-protected`. Carries detail no enum can, and is NOT stable: it includes dependency error text. Display it; do not branch on it. Null when nothing refused.",
      "type": [
        "string",
        "null"
      ]
    },
    "state": {
      "description": "How much of the source the read recovered, in one word. `complete` on a healthy read, whatever the payload beside it turned out to contain.",
      "enum": [
        "complete",
        "partial",
        "unsupported",
        "error"
      ],
      "type": "string"
    }
  },
  "required": [
    "state",
    "reason",
    "code",
    "chunks"
  ],
  "type": "object",
  "$defs": {
    "AnchoredChunkDto": {
      "properties": {
        "ordinal": {
          "description": "Position of this chunk in the document, from 0.",
          "type": "number"
        },
        "page": {
          "description": "1-based page the chunk came from.",
          "type": "number"
        },
        "section": {
          "description": "Nearest preceding markdown heading.",
          "type": "string"
        },
        "sheet": {
          "description": "Workbook tab the chunk came from.",
          "type": "string"
        },
        "text": {
          "description": "The chunk text.",
          "type": "string"
        },
        "token_estimate": {
          "description": "Rough token count (~4 chars/token) for packing a retrieval budget.",
          "type": "number"
        }
      },
      "required": [
        "ordinal",
        "text",
        "token_estimate"
      ],
      "type": "object"
    }
  }
}