DocuTray

Convert Types

Type definitions for Convert in the DocuTray Python SDK — request and response models, fields, and enums.

Types for document conversion operations.

BoundingBox

Bounding box of a value, as floats in 0..1 relative to its page (origin top-left).

Fields:

  • model_config: Any

  • x0: float

  • x1: float

  • y0: float

  • y1: float

ConversionResult

Result of a synchronous document conversion.

Fields:

  • data: dict[str, Any] - Extracted data according to the document type JSON schema.

  • field_locations: FieldLocations | None - Per-field locations (only when the document type has bounding boxes enabled).

  • model_config: Any

  • validation: ConversionValidation - Validation of data against the JSON Schema and DSL rules.

ConversionStatus

Status of an asynchronous document conversion.

Fields:

  • conversion_id: str - Unique conversion ID.

  • data: dict[str, Any] | None - Extracted data (only present when status is SUCCESS).

  • document_metadata: dict[str, Any] | None - Metadata sent with the original request.

  • document_type_code: str | None - Document type code used for conversion.

  • error: str | None - Error message (only present when status is ERROR).

  • field_locations: FieldLocations | None - Per-field locations (only when the document type has bounding boxes enabled).

  • model_config: Any

  • original_filename: str | None - Original filename of the processed file.

  • request_timestamp: datetime | None - Timestamp when conversion was started.

  • response_timestamp: datetime | None - Timestamp when conversion was completed (only for SUCCESS/ERROR).

  • status: ConversionStatusType - Current conversion status.

  • status_url: str | None - URL to check conversion status.

  • validation: ConversionValidation - Validation of data (only meaningful when status is SUCCESS).

FieldLocation

Location of one extracted leaf field in the source document.

Fields:

  • box: BoundingBox - Bounding box of the printed value.

  • confidence: float | None - Reserved; currently always None.

  • model_config: Any

  • page: int - 1-based page the value appears on.

  • path: str - Restricted JSONPath of the field inside data (e.g. "$.items[0].total").

FieldLocations

Per-field locations, present when the document type has boundingBoxesEnabled.

Best-effort: fields the model could not locate are absent.

Fields:

  • coordinate_space: str - Coordinate space of the boxes.

  • fields: list[FieldLocation] - Located fields.

  • model_config: Any

  • pages: list[PageDimensions] - Real page dimensions. Empty for non-PDF documents.

PageDimensions

Real dimensions of a source document page.

Fields:

  • height: float

  • model_config: Any

  • page: int - 1-based page number.

  • unit: str - Unit of width and height.

  • width: float

On this page