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();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. An unknown option throws a DocuTrayError with a suggestion, for example baseUrl (did you mean baseURL?): a misspelled option would otherwise send your requests, with the API key, to the default production URL.
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.
WaitOptions
Options of the wait() method returned by convert.runAsync(), identify.runAsync() and steps.runAsync(). wait() polls until the operation reaches SUCCESS or ERROR and resolves with that final status in both cases; it rejects only on timeout (APITimeoutError) or when a status request fails.
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.