Node.js SDKResources

Document Types

Node.js SDK - Document type catalog resource

DocumentTypes

Resource for Document type catalog. 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.code, docType.name);
}

// Auto-pagination
for await (const docType of page.autoPagingIter()) {
  console.log(docType.code);
}

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 the schema of a document type.

const result = await client.documentTypes.validate('dt_abc123');
console.log(result.valid, result.errors);

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);
const data = await raw.parse();

On this page