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_COMPLETEDonly). -
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_FAILEDonly). -
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,SUCCESSorERROR. -
validation:ConversionValidation- Validation ofdata(CONVERSION_COMPLETEDonly). 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_COMPLETEDonly). -
document_type_code_options:list[str] | None- Document type codes the identification chose from. -
error:str | None- Error message (IDENTIFICATION_FAILEDonly). -
identification_id:str- Unique identification ID. -
model_config:Any -
original_filename:str | None -
request_timestamp:datetime | None -
response_timestamp:datetime | None -
status:str-PROCESSING,SUCCESSorERROR.
StepWebhookPayload
Payload of STEP_* webhook events.
Fields:
-
data:dict[str, Any] | None- Extracted data (STEP_COMPLETEDonly). -
document_metadata:dict[str, Any] | None -
error:str | None- Error message (STEP_FAILEDonly). -
identification:StepIdentification | None- Identification result (STEP_COMPLETEDonly). -
model_config:Any -
request_timestamp:datetime | None -
response_timestamp:datetime | None -
status:str-started,completedorfailed. -
step_execution_id:str- Unique step execution ID. -
step_id:str -
step_name:str | None -
validation:StepValidationSummary | None- Validation summary (STEP_COMPLETEDonly). Informational only.