Examples
Runnable Java examples for the Candescent Digital Insight API are available in the cdx-java-sdk repository. Clone the repo to explore recommended SDK usage patterns against the Stage environment. Examples cover the same API areas as the TypeScript SDK examples.
Clone and install
git clone https://github.com/candescent-dev/cdx-java-sdk.git
cd cdx-java-sdk/examples/java
mvn compile
The Maven project is examples/java/ (cdx-java-sdk/examples/java). mvn compile downloads com.candescent.forge:di-java-sdk from Maven Central and compiles the example classes. Copy .env at the repo root (see below).
Environment setup
From the repo root:
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), sandbox, 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).
Optional example variables
| Variable | Used for |
|---|---|
CANDESCENT_HOST_USER_ID | Retail examples (hostUserId) |
CANDESCENT_LOGIN_ID | Retail examples (loginId) |
CANDESCENT_ACCOUNT_ID | Account-specific examples |
CANDESCENT_CUSTOMER_ID | Customer lookup examples |
CANDESCENT_BB_CLIENT_ID / CANDESCENT_BB_CLIENT_SECRET / CANDESCENT_BB_INSTITUTION_ID | Business banking examples |
CANDESCENT_MX_CLIENT_ID / CANDESCENT_MX_CLIENT_SECRET / CANDESCENT_MX_INSTITUTION_ID | MX integration examples |
Load credentials into your shell before running a single example manually:
set -a && source .env && set +a # bash / zsh
Individual examples do not auto-load .env. Either source it manually (as above) or use the batch runner below.
Run a single example
cd examples/java
mvn exec:java -Dexec.mainClass="com.candescent.examples.AccountsExample"
Replace AccountsExample with any class from the catalog below.
Run all examples
From the repo root:
bash scripts/run-all-java-examples.sh
Output is appended to logs/all-examples.log of the cdx-java-sdk repo. The process exits non-zero if any example fails.
| Detail | Value |
|---|---|
| Default log | logs/all-examples.log |
| Custom log | bash scripts/run-all-java-examples.sh --log=/tmp/java-examples.log |
| Credentials | Environment variables or repo-root .env (loaded automatically by the batch runner) |
Run ErrorHandlingExample individually — it exercises intentional failures and is excluded from the batch runner. From examples/java/:
mvn exec:java -Dexec.mainClass="com.candescent.examples.ErrorHandlingExample"
Add the SDK to your own project
To use the SDK outside the examples repo, add the Maven dependency from Installation to your application pom.xml.
Example catalog
For teams using both SDKs, each Java class maps to a TypeScript script in cdx-typescript-sdk.
| Example class | TypeScript equivalent | What it covers |
|---|---|---|
AccountsExample | accounts.ts | List accounts, retrieve account details |
TransactionsExample | transactions.ts | Transaction history, filtering |
AuthenticationExample | authentication.ts | OAuth token lifecycle |
AuthenticationLifecycleExample | authentication-lifecycle.ts | Full token creation, revoke flow |
CustomerManagementExample | customer-management.ts | Contact methods, password reset, unlock |
RegisterAndLookupExample | register-and-lookup.ts | Customer registration, search |
DisclosuresExample | disclosures.ts | Institution and user disclosures |
EstatementsExample | estatements.ts | E-statement delivery preferences |
AlertConfigurationExample | alert-configuration.ts | Alert templates and types |
AlertPreferencesExample | alert-preferences.ts | User and institution alert preferences |
AlertDeliveryExample | alert-delivery.ts | Alert history and content |
NotificationChannelsExample | notification-channels.ts | Subscription management |
BusinessRegistrationExample | business-registration.ts | Business banking registration |
BusinessEntitlementsExample | business-entitlements.ts | Business and user entitlements |
BusinessPaymentsExample | business-payments.ts | ACH and wire payments |
CustomerCampaignsExample | customer-campaigns.ts | Experience groups and campaigns |
MoneyMovementExample | money-movement.ts | Recipients and transfers |
MxServiceExample | mx-service.ts | MX integration — widget, users, logs |
PaginationExample | pagination.ts | PageIterator patterns |
ErrorHandlingExample | error-handling.ts | Error hierarchy showcase |
UserStatusExample | user-status.ts | User authentication status |
Example to operation coverage
All API operations are covered by these examples.
| API tag | Example class(es) | Operations covered |
|---|---|---|
| Accounts | AccountsExample, TransactionsExample | List, get, banking images, activities, list transactions |
| Alert Configuration | AlertConfigurationExample | Templates, types, institution types CRUD |
| Alert Delivery | AlertDeliveryExample | History, content, publish events |
| Alert Preferences | AlertPreferencesExample | User + institution preference CRUD |
| Authentication | AuthenticationExample, AuthenticationLifecycleExample | Authorize, legacy token, auth code, create/revoke token |
| Business Banking | BusinessRegistrationExample, BusinessEntitlementsExample, BusinessPaymentsExample | Registration, entitlements, ACH/Wire |
| Customer Campaigns | CustomerCampaignsExample | Experience groups, jobs, user lists |
| Customer Management | RegisterAndLookupExample, UserStatusExample, CustomerManagementExample | Register, lookups, contact, password, unlock |
| Documents & Preferences | DisclosuresExample, EstatementsExample | Disclosure CRUD, e-statement prefs/report |
| MX | MxServiceExample | Users, widget URL, transaction logs |
| Money Movement | MoneyMovementExample | Recipients and transfers |
| Notification Channels | NotificationChannelsExample | Subscriptions CRUD and send event |
| Cross-cutting | ErrorHandlingExample, PaginationExample | Error hierarchy, pagination patterns |