Installation
Install @cdx-forge/di-typescript-sdk, configure credentials, and make your first API call.
Requirements
| Requirement | Notes |
|---|---|
| Node.js 20+ | Required by the package engines field |
| ESM only | Use import syntax. require() is not supported — see Troubleshooting |
Your project must use ES modules: set "type": "module" in package.json, or use .mjs file extensions.
1. Install the package
pnpm add @cdx-forge/di-typescript-sdk
This package is available on npm.
2. Verify installation
Create a minimal script (for example check-sdk.mjs):
import { CandescentClient, Environment } from "@cdx-forge/di-typescript-sdk";
console.log("SDK loaded:", typeof CandescentClient === "function");
console.log("Environments:", Environment.Stage, Environment.Production);
Run with Node 20+:
node check-sdk.mjs
3. Configure credentials
Obtain a Client ID, Client Secret, and Institution ID from the Developer Console quickstart guide, then export them:
export CANDESCENT_CLIENT_ID=your-client-id
export CANDESCENT_CLIENT_SECRET=your-client-secret
export CANDESCENT_INSTITUTION_ID=your-institution-id
export CANDESCENT_ENVIRONMENT=stage # or production
Set credentials in your shell or a .env file, then use CandescentClient.fromEnv():
Node.js does not load .env files automatically. Run source .env before your script.
4. Make your first API call
With credentials configured, call a live endpoint. This example lists accounts for a user — a common first integration check.
Create list-accounts.mjs:
import { CandescentClient } from "@cdx-forge/di-typescript-sdk";
const client = CandescentClient.fromEnv();
try {
const accounts = await client.accounts.list({
hostUserId: process.env.CANDESCENT_HOST_USER_ID ?? "user-12345",
});
console.log(`Found ${accounts.accounts?.length ?? 0} accounts`);
} finally {
await client.close();
}
Run it:
node list-accounts.mjs
The SDK obtains and caches OAuth tokens automatically — you do not set Authorization headers manually.
Pass either hostUserId or loginId per request — not both.
Package exports
| Import path | Purpose |
|---|---|
@cdx-forge/di-typescript-sdk | CandescentClient, Environment, models, PageIterator, errors |
@cdx-forge/di-typescript-sdk/operations | Standalone per-operation functions (serverless, scripts) |
@cdx-forge/di-typescript-sdk/registry | Operation registry (same data forge api list uses) |
@cdx-forge/di-typescript-sdk/completions | Tag group and tag names for tooling and autocomplete |
Next step
Quick Start — authentication, accounts, business banking, and standalone operations. See the full TypeScript SDK README for additional usage.