JavaScript and TypeScript SDK
Install the versioned SDK and load DEFDEX_API_KEY privately.
Node.js 22+ is required; TypeScript declarations are included.
Methods
The client URL-encodes IDs and JSON-encodes filters. Keep record_id unchanged.
Type declarations describe the generic transport; use each collection’s reference
for its attributes. Correction methods require the matching scopes.
Configuration and failures
new DefDexClient({apiKey, baseUrl, timeoutMs, fetch}) accepts optional settings.
The default timeout is 30,000 ms and the default transport is globalThis.fetch.
Do not include credentials, query parameters or fragments in baseUrl.
DefDexError exposes status, requestId and retryAfter when available; transport
failures use status 0. Clients do not retry automatically. Apply the bounded policy in
errors. An aborted request is not proof that a correction was never received;
reuse its idempotency key when retrying.
Keep decimal money as strings or use an exact decimal library. JavaScript Number
can lose cents and large integer precision. Check nulls before performing arithmetic.
