{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/webcite/json-schema/webcite-classify-response-dto-schema.json",
  "title": "ClassifyResponseDto",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/webcite-openapi.json#/components/schemas/ClassifyResponseDto",
  "properties": {
    "basis": {
      "enum": [
        "content",
        "filename",
        "fallback"
      ],
      "type": "string"
    },
    "category": {
      "description": "The coarse category, or `unfiled` when nothing matched. Unchanged by a refusal: check `code` to learn whether the document was read at all.",
      "type": "string"
    },
    "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"
      ]
    },
    "confidence": {
      "description": "Heuristic signal score, not a calibrated probability.",
      "maximum": 1,
      "minimum": 0,
      "type": "number"
    },
    "confidenceAssessment": {
      "properties": {
        "basis": {
          "enum": [
            "heuristic"
          ],
          "type": "string"
        },
        "calibrated": {
          "enum": [
            false
          ],
          "type": "boolean"
        },
        "language": {
          "description": "Unknown; the vocabulary census is not a document language detector.",
          "type": [
            "string",
            "null"
          ]
        },
        "languageBasis": {
          "enum": [
            "unknown"
          ],
          "type": "string"
        },
        "perLanguageCalibration": {
          "enum": [
            "unavailable"
          ],
          "type": "string"
        }
      },
      "required": [
        "basis",
        "calibrated",
        "language",
        "languageBasis",
        "perLanguageCalibration"
      ],
      "type": "object"
    },
    "covers": {
      "description": "The fine multi-type covers the document holds. Empty when nothing matched.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "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"
    },
    "sufficiency": {
      "properties": {
        "reason": {
          "type": "string"
        },
        "status": {
          "enum": [
            "unavailable"
          ],
          "type": "string"
        }
      },
      "required": [
        "status",
        "reason"
      ],
      "type": "object"
    }
  },
  "required": [
    "state",
    "reason",
    "code",
    "confidence",
    "basis",
    "category",
    "covers"
  ],
  "type": "object"
}