Node.js SDK
Official TotalAccess SDK for Node.js with TypeScript types, retry, rate limit handling, and webhook verification.
Node.js SDK
The @totalaccess/sdk-node package provides a fully typed Node.js client for the TotalAccess API. It handles authentication, automatic retry with exponential backoff, rate limit awareness, idempotency keys, and webhook signature verification.
Installation
npm install @totalaccess/sdk-nodeThe SDK has zero runtime dependencies — it uses Node.js built-in http/https modules.
Quickstart
import { createClient } from '@totalaccess/sdk-node';
const ta = createClient({
baseUrl: 'https://dev-next.totalaccess.co.za',
apiKey: 'ta_test_your_api_key',
});// Public Data API (API key auth)
const result = await ta.publicData.execute('get-active-users');
console.log(result.data);
// REST API (JWT auth — login first)
await ta.auth.login('[email protected]', 'password');
const items = await ta.workItems.list({ status: 'open' });import { WebhookUtils } from '@totalaccess/sdk-node';
const isValid = WebhookUtils.verifyWebhook(
rawBody,
signature,
timestamp,
'your-webhook-secret'
);Resources
The SDK exposes typed resource modules:
| Resource | Auth | Endpoints |
|---|---|---|
ta.publicData | API Key | Public Data API actions, MCP bridge |
ta.auth | None | Login, refresh tokens |
ta.workItems | JWT | Work item CRUD |
ta.webhooks | JWT | Outbound/inbound webhook management, delivery logs |
ta.apiKeys | JWT | API key CRUD |
Features
Automatic retry
Retries on 429 (rate limited) and 5xx errors with exponential backoff. Respects Retry-After headers.
Rate limit awareness
Reads X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers from every response:
console.log(ta.rateLimit);
// { limit: 200, remaining: 187, resetAt: '2026-07-25T13:10:00Z' }Idempotency keys
All mutating operations (POST, PUT, PATCH, DELETE) automatically include an Idempotency-Key header to prevent duplicate records from retried requests.
Webhook signature verification
HMAC-SHA256 verification with timing-safe comparison and replay attack protection:
import { WebhookUtils } from '@totalaccess/sdk-node';
// Full verification with timestamp (recommended)
const valid = WebhookUtils.verifyWebhook(rawBody, signature, timestamp, secret);
// Simple verification (without timestamp)
const valid = WebhookUtils.verifySignature(rawBody, signature, secret);Error handling
import { TotalAccessError, RateLimitError } from '@totalaccess/sdk-node';
try {
await ta.workItems.create({ title: 'Test' });
} catch (error) {
if (error instanceof RateLimitError) {
console.log('Rate limited. Reset at:', error.rateLimit?.resetAt);
} else if (error instanceof TotalAccessError) {
console.log(`API error (${error.statusCode}):`, error.message);
}
}Environments
| Environment | Base URL |
|---|---|
| Production | https://totalaccess.co.za |
| Development | https://dev-next.totalaccess.co.za |