Skip to main content

Installation

Install @cdx-forge/di-typescript-sdk, configure credentials, and make your first API call.

Requirements

RequirementNotes
Node.js 20+Required by the package engines field
ESM onlyUse 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

Bash
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+:

Bash
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:

Bash
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():

note

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:

Bash
node list-accounts.mjs

The SDK obtains and caches OAuth tokens automatically — you do not set Authorization headers manually.

tip

Pass either hostUserId or loginId per request — not both.

Package exports

Import pathPurpose
@cdx-forge/di-typescript-sdkCandescentClient, Environment, models, PageIterator, errors
@cdx-forge/di-typescript-sdk/operationsStandalone per-operation functions (serverless, scripts)
@cdx-forge/di-typescript-sdk/registryOperation registry (same data forge api list uses)
@cdx-forge/di-typescript-sdk/completionsTag 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.