Examples
Runnable TypeScript examples for the Candescent Digital Insight API are available in the cdx-typescript-sdk repository. Clone the repo to explore recommended SDK usage patterns against the Stage environment.
| Package | Version |
|---|---|
@cdx-forge/di-typescript-sdk | 1.0.0 |
| OpenAPI spec (candescent-dev/openapi) | 1.6.0 |
Clone and install
git clone https://github.com/candescent-dev/cdx-typescript-sdk.git
cd cdx-typescript-sdk
pnpm install
pnpm install pulls @cdx-forge/di-typescript-sdk and other dependencies required to run scripts under examples/typescript/.
Environment setup
cp .env.example .env
Generate your credentials using the values provided in the Developer Console quickstart guide.
| Variable | Required | Description |
|---|---|---|
CANDESCENT_INSTITUTION_ID | Yes | Institution identifier |
CANDESCENT_CLIENT_ID | Yes* | OAuth 2.0 client ID |
CANDESCENT_CLIENT_SECRET | Yes* | OAuth 2.0 client secret |
CANDESCENT_BEARER_TOKEN | Yes* | Pre-obtained JWT (skips OAuth) |
CANDESCENT_ENVIRONMENT | No | stage (default) or production |
*Provide either CANDESCENT_BEARER_TOKEN or both CANDESCENT_CLIENT_ID and CANDESCENT_CLIENT_SECRET.
See .env.example for example-specific variables (account IDs, business banking, MX, alerts, and more).
Credential groups
If one OAuth app works for all flows, you can repeat the values for each group:
| Group | Variables |
|---|---|
| Retail / default | CANDESCENT_CLIENT_ID, CANDESCENT_CLIENT_SECRET, CANDESCENT_INSTITUTION_ID |
| Business banking | CANDESCENT_BB_CLIENT_ID, CANDESCENT_BB_CLIENT_SECRET, CANDESCENT_BB_INSTITUTION_ID |
| MX integration | CANDESCENT_MX_CLIENT_ID (MX also requires CANDESCENT_MX_API_KEY) |
User identifiers:
| Variable | Used for |
|---|---|
CANDESCENT_HOST_USER_ID | Retail examples (hostUserId) |
CANDESCENT_LOGIN_ID | Retail examples (loginId) |
CANDESCENT_BB_LOGIN_ID | Business banking examples |
Set FALLBACK_CUSTOMER_ID to skip registration and test lookups against an existing customer.
Run a single example
node --experimental-strip-types examples/typescript/accounts.ts
Replace accounts.ts with any script from the catalog below.
Individual scripts do not auto‑load .env. Either source it manually (source .env) or use the batch runner below.
Run all examples
From the repo root:
node scripts/run-all-typescript-examples.mjs
Output is appended to developerscript/typescript/logs/all-examples.log of the cdx-typescript-sdk repo. The process exits non-zero if any example fails.
| Detail | Value |
|---|---|
| Default log | developerscript/typescript/logs/all-examples.log |
| Custom log | node scripts/run-all-typescript-examples.mjs --log=/tmp/ts-examples.log |
| Credentials | Environment variables or repo-root .env (loaded automatically by the batch runner) |
When CANDESCENT_CLIENT_ID and CANDESCENT_CLIENT_SECRET are set, a static CANDESCENT_BEARER_TOKEN is stripped so examples use live OAuth.
Run error-handling.ts individually — it exercises intentional failures and is excluded from the batch runner:
node --experimental-strip-types examples/typescript/error-handling.ts
Example catalog
| Example file | What it covers |
|---|---|
accounts.ts | List accounts, retrieve account details, banking images |
transactions.ts | Transaction history, filtering |
authentication.ts | OAuth token lifecycle |
authentication-lifecycle.ts | Full token creation, revoke flow |
customer-management.ts | Contact methods, password reset, unlock |
register-and-lookup.ts | Customer registration, search |
disclosures.ts | Institution and user disclosures |
estatements.ts | E-statement delivery preferences |
alert-configuration.ts | Alert templates and types |
alert-preferences.ts | User and institution alert preferences |
alert-delivery.ts | Alert history and content |
notification-channels.ts | Subscription management |
business-registration.ts | Business banking registration |
business-entitlements.ts | Business and user entitlements |
business-payments.ts | ACH and wire payments |
customer-campaigns.ts | Experience groups and campaigns |
money-movement.ts | Recipients and transfers |
mx-service.ts | MX integration — widget, users, logs |
pagination.ts | PageIterator patterns |
error-handling.ts | Error hierarchy showcase |
user-status.ts | User authentication status |
Example to operation coverage
| API tag | Example file(s) | Operations covered |
|---|---|---|
| Accounts | accounts, transactions | list, get, banking images, activities, listTransactions |
| Alert Configuration | alert-configuration | Templates, types, institution types CRUD |
| Alert Delivery | alert-delivery | History, content, publish events |
| Alert Preferences | alert-preferences | User + institution preference CRUD |
| Authentication | authentication, authentication-lifecycle | Authorize, legacy token, auth code, create/revoke token |
| Business Banking | business-registration, business-entitlements, business-payments | Registration, entitlements, ACH/Wire |
| Customer Campaigns | customer-campaigns | Experience groups, jobs, user lists |
| Customer Management | register-and-lookup, user-status, customer-management | Register, lookups, contact, password, unlock |
| Documents & Preferences | disclosures, estatements | Disclosure CRUD, e-statement prefs/report |
| MX | mx-service | Users, widget URL, transaction logs |
| Money Movement | money-movement | Recipients and transfers |
| Notification Channels | notification-channels | Subscriptions CRUD and send event |
| Cross-cutting | error-handling, pagination | Error hierarchy, pagination patterns |
All API operations are covered by these scripts.