Client
Configure the Docutray Node.js client — API key, base URL, timeouts, and retries — plus the typed methods for convert, identify, and knowledge-base calls.
npm install docutraypnpm add docutrayDocuTray
The main client class for interacting with the DocuTray API. Provides access to all API resources through typed properties.
import DocuTray from 'docutray';
// Using environment variable (DOCUTRAY_API_KEY)
const client = new DocuTray();import DocuTray from 'docutray';
const client = new DocuTray({ apiKey: 'dt_my-api-key' });import DocuTray from 'docutray';
const client = new DocuTray({
apiKey: 'dt_my-api-key',
timeout: 30_000,
maxRetries: 3,
});Resources
Each property on a DocuTray instance exposes a typed resource client. Resource methods return typed promises and accept request-scoped overrides.
ClientOptions
Configuration options for the DocuTray client.
https://app.docutray.com.60000.2.fetch implementation. Defaults to globalThis.fetch.RequestOptions
Per-request options that override client-level defaults.
AbortSignal to cancel the request.RetryConfig
Configuration for the exponential backoff retry strategy.
File Input Types
FileInput
Accepted file input types for document uploads: Blob | Buffer | ArrayBuffer | FileWithMetadata.
When passing a raw Blob or Buffer without a filename, DocuTray
infers the MIME type from the content. For best accuracy, prefer
FileWithMetadata.
FileWithMetadata
A file with explicit filename and optional content type.
Buffer or Blob.filename when omitted.Node.js SDK
Official Node.js SDK for the DocuTray API — typed OCR conversion, document identification, data extraction, and knowledge bases for Node 20+.
Errors
Error handling in the Docutray Node.js SDK — the DocuTrayError hierarchy, HTTP status codes, and response details for robust retry and recovery logic.