Convert Types
Type definitions for Convert in the DocuTray Node.js SDK — request and response models, fields, and enums.
ConversionStatusType
Possible statuses for a conversion operation.
type ConversionStatusType = 'ENQUEUED' | 'PROCESSING' | 'SUCCESS' | 'ERROR';ConversionResult
Result of a synchronous conversion (convert.run()): the extracted data, its validation and, when the document type has boundingBoxesEnabled, field_locations.
Prop
Type
ConversionEnqueued
Response of convert.runAsync(): the conversion was queued. Only conversion_id, status_url and status are sent at this point; wait() and getStatus() return the full ConversionStatus.
Prop
Type
ConversionStatus
Status of a conversion operation, as returned by the API. On SUCCESS it carries the validation of the extracted data.
Prop
Type
ConvertParams
Parameters for creating a conversion request. Provide exactly one of file, url, or base64 as the document source.
Prop
Type
FieldLocations
Location of each extracted leaf field in the source document. Present only when the document type has boundingBoxesEnabled. Best-effort: fields that could not be located are absent from fields.
Prop
Type
Prop
Type
Prop
Type
Prop
Type
Type Guards
isConversionComplete(status)
Returns true if the conversion has reached a terminal state (SUCCESS or ERROR).
isConversionSuccess(status)
Returns true if the conversion completed successfully.
isConversionError(status)
Returns true if the conversion failed with an error.
import { isConversionSuccess, isConversionError } from 'docutray';
if (isConversionSuccess(status)) {
console.log('Data:', status.data);
} else if (isConversionError(status)) {
console.log('Error:', status.error);
}