Docs / Schemas / document-extraction / 0.5.0
Document Extraction 0.5.0
Represent the layout and content of a document, including text blocks, geometric coordinates, and page structure.
This is an older version of document-extraction.
The latest version is 0.8.0. Releases before 0.7.0 use the $id https:/ and are served by DorsalHub.
$idhttps:// dorsalhub.com/ schemas/ open/ document-extraction - Latest
https:// oatschema.org/ document-extraction - Versions
- Source
- v0.5.0 on GitHub
Schema
{ "x-license": { "id": "Apache-2.0", "notice": "Copyright 2025-2026 Dorsal Hub LTD", "url": "https://github.com/dorsalhub/open-validation-schemas/blob/main/LICENSE" }, "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://dorsalhub.com/schemas/open/document-extraction", "title": "Document Extraction", "version": "0.5.0", "description": "Represent the layout and content of a document, including text blocks, geometric coordinates, and page structure.", "type": "object", "properties": { "extraction_type": { "type": "string", "description": "Optionally indicate the extraction type.", "enum": [ "text", "lines", "boxes", "polygons", "mixed" ] }, "producer": { "type": "string", "description": "The creator (model, tool or author) of this extraction.", "maxLength": 1024 }, "unit": { "type": "string", "description": "The unit for all coordinate values if geometric data is present.", "enum": [ "px", "pt", "normalized", "per_mille" ] }, "page_width": { "description": "The absolute width of the page(s) in pixels. Can be a single integer for uniform documents, or an array of objects mapping specific widths to page numbers.", "oneOf": [ { "type": "integer", "minimum": 1, "title": "Uniform Width" }, { "type": "array", "title": "Variable Widths", "minItems": 1, "maxItems": 10000, "items": { "type": "object", "properties": { "value": { "type": "integer", "minimum": 1, "description": "The absolute width in pixels." }, "pages": { "type": "array", "description": "The page numbers (1-indexed) that share this width.", "minItems": 1, "maxItems": 100000, "items": { "type": "integer", "minimum": 1 } } }, "required": [ "value", "pages" ], "additionalProperties": false } } ] }, "page_height": { "description": "The absolute height of the page(s) in pixels. Can be a single integer for uniform documents, or an array of objects mapping specific heights to page numbers.", "oneOf": [ { "type": "integer", "minimum": 1, "title": "Uniform Height" }, { "type": "array", "title": "Variable Heights", "minItems": 1, "maxItems": 10000, "items": { "type": "object", "properties": { "value": { "type": "integer", "minimum": 1, "description": "The absolute height in pixels." }, "pages": { "type": "array", "description": "The page numbers (1-indexed) that share this height.", "minItems": 1, "maxItems": 100000, "items": { "type": "integer", "minimum": 1 } } }, "required": [ "value", "pages" ], "additionalProperties": false } } ] }, "score_explanation": { "type": "string", "description": "Defines the meaning of the 'score' field.", "maxLength": 256 }, "blocks": { "type": "array", "description": "An array of text blocks extracted from the document.", "maxItems": 100000, "items": { "type": "object", "properties": { "block_type": { "type": "string", "description": "Defines the nature of this specific block (text, line, box, polygon, or multi_polygon).", "enum": [ "text", "line", "box", "polygon", "multi_polygon" ] }, "id": { "type": "string", "description": "A unique identifier (e.g., UUID4) for this block, useful for referencing.", "maxLength": 128 }, "text": { "type": "string", "description": "The text content of the block. Required for text and line block types.", "maxLength": 4096 }, "line_number": { "type": "integer", "description": "The line number of the block within its page, if applicable.", "minimum": 1 }, "page_number": { "type": "integer", "description": "The page number (1-indexed) where this block is located.", "minimum": 1 }, "score": { "type": "number", "description": "The confidence score for this block's detection and transcription, ranging from 0.0 (uncertain) to 1.0 (certain).", "minimum": 0, "maximum": 1 }, "box": { "type": "object", "description": "A rectangular bounding box defined by its top-left corner (x,y) and its dimensions.", "properties": { "x": { "type": "number", "description": "The x-coordinate of the top-left corner.", "minimum": 0 }, "y": { "type": "number", "description": "The y-coordinate of the top-left corner.", "minimum": 0 }, "width": { "type": "number", "description": "The width of the box.", "minimum": 0 }, "height": { "type": "number", "description": "The height of the box.", "minimum": 0 } }, "required": [ "x", "y", "width", "height" ], "additionalProperties": false }, "polygon": { "type": "array", "description": "An array of coordinate points defining the block's boundary for non-rectangular shapes.", "maxItems": 100, "minItems": 3, "items": { "type": "object", "properties": { "x": { "type": "number", "description": "The x-coordinate of a vertex point.", "minimum": 0 }, "y": { "type": "number", "description": "The y-coordinate of a vertex point.", "minimum": 0 } }, "required": [ "x", "y" ], "additionalProperties": false } }, "multi_polygon": { "type": "array", "description": "An array of polygons, useful for representing a single occluded or fragmented block split into multiple visible parts.", "maxItems": 100, "items": { "type": "array", "minItems": 3, "maxItems": 100, "items": { "type": "object", "properties": { "x": { "type": "number", "minimum": 0 }, "y": { "type": "number", "minimum": 0 } }, "required": [ "x", "y" ], "additionalProperties": false } } }, "attributes": { "type": "object", "description": "Arbitrary metadata relevant to this block.", "maxProperties": 16, "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 1024 }, { "type": "number" }, { "type": "boolean" }, { "type": "null" } ] } } }, "required": [ "block_type" ], "additionalProperties": false, "allOf": [ { "if": { "properties": { "block_type": { "enum": [ "text", "line" ] } } }, "then": { "required": [ "text" ] } }, { "if": { "properties": { "block_type": { "const": "box" } } }, "then": { "required": [ "box" ] } }, { "if": { "properties": { "block_type": { "const": "polygon" } } }, "then": { "required": [ "polygon" ] } }, { "if": { "properties": { "block_type": { "const": "multi_polygon" } } }, "then": { "required": [ "multi_polygon" ] } }, { "if": { "properties": { "block_type": { "const": "line" } } }, "then": { "anyOf": [ { "required": [ "box" ] }, { "required": [ "polygon" ] }, { "required": [ "multi_polygon" ] } ] } } ] } }, "attributes": { "type": "object", "description": "Arbitrary metadata relevant to this extraction.", "maxProperties": 16, "additionalProperties": { "anyOf": [ { "type": "string", "maxLength": 1024 }, { "type": "number" }, { "type": "boolean" }, { "type": "null" } ] } } }, "required": [ "extraction_type", "blocks" ], "additionalProperties": false, "oneOf": [ { "properties": { "extraction_type": { "enum": [ "text", "lines" ] } } }, { "properties": { "extraction_type": { "enum": [ "boxes", "polygons", "mixed" ] } }, "required": [ "unit" ] } ], "allOf": [ { "if": { "properties": { "unit": { "const": "normalized" } } }, "then": { "properties": { "blocks": { "items": { "properties": { "box": { "properties": { "x": { "maximum": 1 }, "y": { "maximum": 1 }, "width": { "maximum": 1 }, "height": { "maximum": 1 } } }, "polygon": { "items": { "properties": { "x": { "maximum": 1 }, "y": { "maximum": 1 } } } }, "multi_polygon": { "items": { "items": { "properties": { "x": { "maximum": 1 }, "y": { "maximum": 1 } } } } } } } } } } }, { "if": { "properties": { "unit": { "const": "per_mille" } } }, "then": { "properties": { "blocks": { "items": { "properties": { "box": { "properties": { "x": { "maximum": 1000 }, "y": { "maximum": 1000 }, "width": { "maximum": 1000 }, "height": { "maximum": 1000 } } }, "polygon": { "items": { "properties": { "x": { "maximum": 1000 }, "y": { "maximum": 1000 } } } }, "multi_polygon": { "items": { "items": { "properties": { "x": { "maximum": 1000 }, "y": { "maximum": 1000 } } } } } } } } } } } ]}
Fields
-
extraction_typestring requiredOptionally indicate the extraction type.
Allowed values:
"text","lines","boxes","polygons","mixed" -
producerstringThe creator (model, tool or author) of this extraction.
- at most 1024 characters
-
unitstringThe unit for all coordinate values if geometric data is present.
Allowed values:
"px","pt","normalized","per_mille" -
page_widthinteger | array of objectThe absolute width of the page(s) in pixels. Can be a single integer for uniform documents, or an array of objects mapping specific widths to page numbers.
Exactly one of these forms:
-
Uniform Width integer
- ≥ 1
-
Variable Widths array of object
- 1 to 10000 items
-
valueinteger requiredThe absolute width in pixels.
- ≥ 1
-
pagesarray of integer requiredThe page numbers (1-indexed) that share this width.
- 1 to 100000 items
- each ≥ 1
-
-
page_heightinteger | array of objectThe absolute height of the page(s) in pixels. Can be a single integer for uniform documents, or an array of objects mapping specific heights to page numbers.
Exactly one of these forms:
-
Uniform Height integer
- ≥ 1
-
Variable Heights array of object
- 1 to 10000 items
-
valueinteger requiredThe absolute height in pixels.
- ≥ 1
-
pagesarray of integer requiredThe page numbers (1-indexed) that share this height.
- 1 to 100000 items
- each ≥ 1
-
-
score_explanationstringDefines the meaning of the 'score' field.
- at most 256 characters
-
blocksarray of object requiredAn array of text blocks extracted from the document.
- at most 100000 items
-
block_typestring requiredDefines the nature of this specific block (text, line, box, polygon, or multi_polygon).
Allowed values:
"text","line","box","polygon","multi_polygon" -
idstringA unique identifier (e.g., UUID4) for this block, useful for referencing.
- at most 128 characters
-
textstringThe text content of the block. Required for text and line block types.
- at most 4096 characters
-
line_numberintegerThe line number of the block within its page, if applicable.
- ≥ 1
-
page_numberintegerThe page number (1-indexed) where this block is located.
- ≥ 1
-
scorenumberThe confidence score for this block's detection and transcription, ranging from 0.0 (uncertain) to 1.0 (certain).
- 0 to 1
-
boxobjectA rectangular bounding box defined by its top-left corner (x,y) and its dimensions.
-
xnumber requiredThe x-coordinate of the top-left corner.
- ≥ 0
-
ynumber requiredThe y-coordinate of the top-left corner.
- ≥ 0
-
widthnumber requiredThe width of the box.
- ≥ 0
-
heightnumber requiredThe height of the box.
- ≥ 0
-
-
polygonarray of objectAn array of coordinate points defining the block's boundary for non-rectangular shapes.
- 3 to 100 items
-
xnumber requiredThe x-coordinate of a vertex point.
- ≥ 0
-
ynumber requiredThe y-coordinate of a vertex point.
- ≥ 0
-
multi_polygonarray of array of objectAn array of polygons, useful for representing a single occluded or fragmented block split into multiple visible parts.
- at most 100 items
- each 3 to 100 items
-
xnumber required- ≥ 0
-
ynumber required- ≥ 0
-
attributesobjectArbitrary metadata relevant to this block.
- at most 16 properties
-
*string | number | boolean | nullAny other key.
- string: at most 1024 characters
Rules:
-
When the condition below holds,
textis required.Show the JSON Schema
{ "if": { "properties": { "block_type": { "enum": [ "text", "line" ] } } }, "then": { "required": [ "text" ] }} -
When
block_typeis"box",boxis required.Show the JSON Schema
{ "if": { "properties": { "block_type": { "const": "box" } } }, "then": { "required": [ "box" ] }} -
When
block_typeis"polygon",polygonis required.Show the JSON Schema
{ "if": { "properties": { "block_type": { "const": "polygon" } } }, "then": { "required": [ "polygon" ] }} -
When
block_typeis"multi_polygon",multi_polygonis required.Show the JSON Schema
{ "if": { "properties": { "block_type": { "const": "multi_polygon" } } }, "then": { "required": [ "multi_polygon" ] }} -
When
block_typeis"line": at least one ofbox,polygon,multi_polygonmust be present.Show the JSON Schema
{ "if": { "properties": { "block_type": { "const": "line" } } }, "then": { "anyOf": [ { "required": [ "box" ] }, { "required": [ "polygon" ] }, { "required": [ "multi_polygon" ] } ] }}
-
attributesobjectArbitrary metadata relevant to this extraction.
- at most 16 properties
-
*string | number | boolean | nullAny other key.
- string: at most 1024 characters
Exactly one of these forms:
-
any
-
extraction_typeenumAllowed values:
"text","lines"
-
-
any
-
extraction_typeenumAllowed values:
"boxes","polygons","mixed"
Rules:
-
Also requires
unit.
-
Rules:
-
When
unitis"normalized", further limits apply.Show the JSON Schema
{ "if": { "properties": { "unit": { "const": "normalized" } } }, "then": { "properties": { "blocks": { "items": { "properties": { "box": { "properties": { "x": { "maximum": 1 }, "y": { "maximum": 1 }, "width": { "maximum": 1 }, "height": { "maximum": 1 } } }, "polygon": { "items": { "properties": { "x": { "maximum": 1 }, "y": { "maximum": 1 } } } }, "multi_polygon": { "items": { "items": { "properties": { "x": { "maximum": 1 }, "y": { "maximum": 1 } } } } } } } } } }} -
When
unitis"per_mille", further limits apply.Show the JSON Schema
{ "if": { "properties": { "unit": { "const": "per_mille" } } }, "then": { "properties": { "blocks": { "items": { "properties": { "box": { "properties": { "x": { "maximum": 1000 }, "y": { "maximum": 1000 }, "width": { "maximum": 1000 }, "height": { "maximum": 1000 } } }, "polygon": { "items": { "properties": { "x": { "maximum": 1000 }, "y": { "maximum": 1000 } } } }, "multi_polygon": { "items": { "items": { "properties": { "x": { "maximum": 1000 }, "y": { "maximum": 1000 } } } } } } } } } }}
Copyright 2025-2026 Dorsal Hub LTD. Licensed under Apache-2.0.