{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/okfindex-com/json-schema/okfindex-com-document-schema.json",
  "title": "Document",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/okfindex-com-openapi.yml#/components/schemas/Document",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The 64-character ID returned by the API."
    },
    "version_id": {
      "type": "string",
      "description": "Immutable version ID, present in private history."
    },
    "current": {
      "type": "boolean",
      "description": "Whether this retained version is current."
    },
    "published": {
      "type": "boolean",
      "description": "Whether this retained version is the one explicitly published."
    },
    "base_id": {
      "type": "string",
      "description": "The 64-character ID returned by the API."
    },
    "filename": {
      "type": "string",
      "description": "Original filename."
    },
    "title": {
      "type": "string",
      "description": "Filename without extension."
    },
    "format": {
      "type": "string",
      "description": "md, txt, pdf, docx or doc after conversion."
    },
    "managed": {
      "type": [
        "string",
        "null"
      ],
      "description": "dataset for generated metadata; edit through save_base_dataset. Null for ordinary files."
    },
    "sha256": {
      "type": "string",
      "description": "SHA-256 of stored UTF-8 text. Converted source hash is source_sha256."
    },
    "bytes": {
      "type": "integer",
      "description": "Stored UTF-8 text size in bytes."
    },
    "status": {
      "type": "string",
      "description": "ready or pending."
    },
    "created_at": {
      "type": "string",
      "description": "Upload date, ISO 8601."
    },
    "api": {
      "type": "string",
      "description": "JSON with Markdown."
    },
    "source_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Present on document reads: source URL preserved with this version, or null for manual uploads. Also included in the exported OKF concept."
    },
    "source_sha256": {
      "type": "string",
      "description": "SHA-256 of the original converted file."
    },
    "pages": {
      "type": "integer",
      "description": "PDF physical page count. Zero for continuous DOC and DOCX text."
    },
    "review": {
      "type": "object",
      "description": "PDF: completed automated review. DOC/DOCX: not_applicable, null model and zero pages reviewed."
    },
    "markdown_url": {
      "type": "string",
      "description": "Markdown download."
    },
    "original_url": {
      "type": "string",
      "description": "Original file download."
    },
    "conversion_url": {
      "type": "string",
      "description": "Owner-only saved manifest, source metadata and processing result. Present for converted versions in private history."
    },
    "okf_url": {
      "type": "string",
      "description": "OKF concept URL."
    }
  },
  "required": [
    "id",
    "base_id",
    "filename",
    "title",
    "format",
    "managed",
    "sha256",
    "bytes",
    "status",
    "created_at",
    "api",
    "markdown_url",
    "original_url",
    "okf_url"
  ]
}