DocuTray

Webhook Types

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

Types for webhook event payloads sent by DocuTray.

These models parse the JSON body of webhook deliveries. The event type is in the X-Docutray-Event header.

Example:

from docutray.types import ConversionWebhookPayload payload = ConversionWebhookPayload.model_validate_json(request_body) if payload.status == "SUCCESS" and payload.validation: ... print(payload.validation)

ConversionWebhookPayload

Payload of CONVERSION_* webhook events.

Fields:

  • conversion_id: str - Unique conversion ID.

  • data: dict[str, Any] | None - Extracted data (CONVERSION_COMPLETED only).

  • document_metadata: dict[str, Any] | None - Custom metadata sent with the conversion.

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

  • error: str | None - Error message (CONVERSION_FAILED only).

  • model_config: Any

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

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

  • response_timestamp: datetime | None - Timestamp when the conversion finished.

  • status: str - PROCESSING, SUCCESS or ERROR.

  • validation: ConversionValidation - Validation of data (CONVERSION_COMPLETED only). Informational only.

IdentificationWebhookPayload

Payload of IDENTIFICATION_* webhook events.

Fields:

  • alternatives: list[DocumentTypeMatch] | None - Other candidate document types.

  • document_metadata: dict[str, Any] | None

  • document_type: DocumentTypeMatch | None - Identified document type (IDENTIFICATION_COMPLETED only).

  • document_type_code_options: list[str] | None - Document type codes the identification chose from.

  • error: str | None - Error message (IDENTIFICATION_FAILED only).

  • identification_id: str - Unique identification ID.

  • model_config: Any

  • original_filename: str | None

  • request_timestamp: datetime | None

  • response_timestamp: datetime | None

  • status: str - PROCESSING, SUCCESS or ERROR.

StepWebhookPayload

Payload of STEP_* webhook events.

Fields:

  • data: dict[str, Any] | None - Extracted data (STEP_COMPLETED only).

  • document_metadata: dict[str, Any] | None

  • error: str | None - Error message (STEP_FAILED only).

  • identification: StepIdentification | None - Identification result (STEP_COMPLETED only).

  • model_config: Any

  • request_timestamp: datetime | None

  • response_timestamp: datetime | None

  • status: str - started, completed or failed.

  • step_execution_id: str - Unique step execution ID.

  • step_id: str

  • step_name: str | None

  • validation: StepValidationSummary | None - Validation summary (STEP_COMPLETED only). Informational only.

On this page