SDK Quickstart — JavaScript
Installation
npm install @aelix/api-sdk
# or
yarn add @aelix/api-sdk
Initialise the Client
import { AelixClient } from '@aelix/api-sdk';
const client = new AelixClient({
clientId: process.env.AELIX_CLIENT_ID,
clientSecret: process.env.AELIX_CLIENT_SECRET,
environment: 'sandbox', // or 'production'
timeout: 30_000, // ms
});
Fetch Account Balances
const accounts = await client.banking.accounts.list({
limit: 25,
status: 'active',
});
for (const account of accounts.data) {
console.log(`${account.nickname}: £${account.balance / 100}`);
}
Initiate a Payment
const payment = await client.payments.create({
source_account_id: 'acc_abc123',
destination: {
account_number: '12345678',
sort_code: '20-00-00',
account_name: 'ACME Ltd',
},
amount: 5000, // £50.00 in pence
currency: 'GBP',
reference: 'Invoice INV-2025-042',
idempotency_key: `pay-${Date.now()}`,
});
console.log('Payment status:', payment.status);
// → 'pending_clearance'
Handle Errors
import { AelixError, RateLimitError } from '@aelix/api-sdk';
try {
const result = await client.banking.accounts.get('acc_invalid');
} catch (err) {
if (err instanceof RateLimitError) {
// Retry after err.retryAfter seconds
} else if (err instanceof AelixError) {
console.error(err.code, err.message);
}
}
TypeScript Support
The SDK ships with full TypeScript types. No @types package needed:
import type { Account, Payment } from '@aelix/api-sdk';