Skip to main content
TypeScript@aui.io/aui-clientv3
The official TypeScript/JavaScript SDK wraps the Apollo API with full type definitions, automatic authentication, retries, and built-in WebSocket handling. It exposes two clients, one per credential — import the one that matches where your code runs:
ClientCredentialBrowser-safeSurface
ApolloMessagingClientPublishable key (pk_network_...)YesEnd-user messaging, channels, WebSocket sessions
ApolloManagementClientOrganization API keyNo — server onlyProjects, agents, versions, threads, usage

Installation

Requires Node.js ≥ 18 (or any modern browser for the messaging client). Type definitions ship with the package.

Quick start — messaging

The messaging client authenticates with your publishable key. It exchanges the key for a short-lived access token and refreshes it as needed — you never handle tokens directly, and the agent is derived from the key rather than passed in request bodies.

Quick start — management

The management client authenticates with your organization API key, sent as the x-organization-api-key header on every request. It’s meant for backend services and CI — never expose the key in the browser.

Why use the SDK?

Auth handled for you

Token exchange, refresh, and header injection are automatic — construct the client with a key and start calling.

Type safety

Full TypeScript definitions with IntelliSense across every method and payload, exported under the Apollo namespace.

WebSocket management

connect() returns a reconnecting socket with typed envelopes and resume support.

Typed errors

ApolloError, ApolloTimeoutError, and per-status classes like Apollo.NotFoundError for clean handling.

Automatic retries

Transient failures retry automatically (2 attempts by default, tunable per call).

Always in sync

Generated from the live API specification, so the client tracks the API as it evolves.

Environment

Both clients default to production — no configuration needed:
To point at a different host (e.g. a regional deployment), pass baseUrl:

Resolved key context

After the first request (or an explicit getContext() call), the messaging client exposes the scope resolved from your publishable key:

Explore the SDK

Messaging client

Send and stream messages, read conversations, and reach users on WhatsApp/SMS.

Management client

Operate projects, agents, versions, threads, and usage from your backend.

WebSocket

Real-time sessions with typed envelopes, reconnection, and resume.

Best practices

Error handling, timeouts, retries, and key hygiene.

API

The underlying REST + WebSocket API the SDK wraps.