Node.js SDKResources
Document Types
Node.js SDK - Document type catalog resource
DocumentTypes
Resource for listing and inspecting document type definitions. Access via client.documentTypes.
Methods
list(params?, options?)
Lists available document types with pagination.
const page = await client.documentTypes.list({ limit: 10 });
for (const docType of page.data) {
console.log(docType.name, docType.codeType);
}
// Auto-pagination
for await (const docType of page.autoPagingIter()) {
console.log(docType.name);
}Parameters: DocumentTypesListParams (optional)
Returns: Promise<Page<DocumentType>>
get(id, options?)
Retrieves a single document type by ID.
const docType = await client.documentTypes.get('dt_abc123');
console.log(docType.name, docType.schema);Parameters: id: string
Returns: Promise<DocumentType>
validate(id, options?)
Validates a document type schema.
const result = await client.documentTypes.validate('dt_abc123');
if (result.errors.count === 0) {
console.log('Schema is valid');
} else {
console.log('Errors:', result.errors.messages);
}Parameters: id: string
Returns: Promise<ValidationResult>
Raw Responses
Access raw HTTP response details via withRawResponse:
const raw = await client.documentTypes.withRawResponse.list();
console.log(raw.statusCode);