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:
| Client | Credential | Browser-safe | Surface |
|---|---|---|---|
ApolloMessagingClient | Publishable key (pk_network_...) | Yes | End-user messaging, channels, WebSocket sessions |
ApolloManagementClient | Organization API key | No — server only | Projects, agents, versions, threads, usage |
Installation
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 thex-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:baseUrl:
Resolved key context
After the first request (or an explicitgetContext() 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.