TypeScript SDK
Official TypeScript SDK for Audact. A thin, dependency-free wrapper
(Node ≥18 fetch/FormData/AbortSignal/URLSearchParams only) around Audact's HTTP services —
Validator, Evidence Layer, LLM Proxy, Tenant Management, Voice Gateway, Agent Worker, Aggregator,
Policy Engine, Audio Validator, and Org Management.
Install
bash
npm install @audactcore/sdk
Quick start
ts
import { AudactClient } from "@audactcore/sdk";
const client = new AudactClient({ apiKey: "aud_live_..." });
const result = await client.validator.validate({
call_id: "a1b2c3d4-...",
tenant_id: "t1t2t3...",
config_id: "c1c2c3...",
turn: 1,
content: "Hello, I am an AI assistant.",
context: {
previous_turns: [],
call_state: { disclosure_delivered: false },
},
});
if (result.verdict === "ALLOW") {
console.log("Content approved:", result.content);
}Base URL
In production every service sits behind one public host, path-routed under /v1. Pass it once:
ts
const client = new AudactClient({ apiKey: "aud_live_...", baseUrl: "https://api.audact.ai" });A trailing / or /v1 on baseUrl is stripped; requests go to https://api.audact.ai/v1/....
serviceUrls (per-service overrides, which win over baseUrl) are only needed for custom deployments.
Coverage
The SDK is at full parity with the documented API: 209 of 211 operations are covered
(the remaining 2 are receive-side provider-to-platform webhooks —
POST /telnyx/webhook and POST /webhooks/livekit — which are ingress endpoints Audact receives,
never calls).
| Sub-client | Service | Auth | What it covers |
|---|---|---|---|
client.validator | Validator | API key | Per-turn ACVF validation, finalize call score |
client.evidence | Evidence Layer | API key | Evidence events, chains, verify/reconstruct, calls, violations, Article 50 reports/exports, C2PA, receipts, delivery, transcript reconciliation |
client.llmProxy | LLM Proxy | API key | Compliance-validated LLM chat completion (sync + streaming) |
client.tenants | Tenant Management | API key | Tenant CRUD, usage, API keys, configurations |
client.numbers | Voice Gateway | API key | KYC documents/sets, number provisioning lifecycle (order, assign, suspend, resume, release, trunk) |
client.calls | Voice Gateway | API key | SIP call lifecycle (outbound/inbound/browser, hangup, status, handover, transfer), trunks, dispatch rules, admission URL, WS tickets |
client.webhooks | Tenant Management | API key | Webhook endpoint CRUD, test-ping, delivery history/resend, event-type/schema discovery, secret status/rotation |
client.agents | Agent Worker | API key | Agent CRUD + duplicate, TTS voice catalog CRUD, pipeline status |
client.tools | Agent Worker | API key | Function-calling tool CRUD/test, agent-tool attach/detach |
client.integrations | Agent Worker | API key | Cal.com connection CRUD, health check, event-type discovery |
client.knowledgeBases | Tenant Management | API key | Knowledge-base (RAG) CRUD, sources (url/text JSON + multipart file upload, reingest), agent links with retrieval tuning, crawl exclusions, retrieval test harness |
client.aggregation | Aggregator | API key (public: getMetachain, verifyInclusion) | Merkle aggregation proofs, public meta-chain, offline inclusion verification |
client.policy | Policy Engine | API key | Policy evaluation, jurisdiction policy documents, calling-hours pre-check |
client.audio | Audio Validator | API key | Synchronous per-turn audio validation, post-call audio-to-transcript reconciliation |
client.auth | Tenant Management | API key | API-key ↔ JWT session bridge (exchange, refresh) |
client.org | Org Management | OrgBearer (JWT) | Org self-service: signup/login/refresh/logout, profile, KYC |
client.org (tenants) | Org Management | OrgBearer (JWT) | Org-owned tenant lifecycle: list/create/get, soft-delete/enable/disable/restore, initialize, issue key, impersonate |
client.pii | Evidence Layer | API key | PII vault shred by identity (shred, shredCall), call identities (listCallIdentities, linkCallIdentity), decrypt vault tokens (decrypt), erased-keyset status (listErasedKeysets), encryption settings (settings) |
Added in 0.3.0
| Method | Route |
|---|---|
client.pii.listErasedKeysets(callId, keysetIds) | GET /v1/calls/{call_id}/pii/erased-keysets |
client.evidence.listComplianceEvents(opts?) | GET /v1/compliance/events |
Error handling
Failed requests throw AudactError, populated from the API's {"error": {...}} envelope:
ts
import { AudactError } from "@audactcore/sdk";
try {
await client.evidence.getCallDetail("missing");
} catch (err) {
if (err instanceof AudactError) {
console.error(err.status, err.code, err.message);
console.error("request id:", err.requestId); // quote this to support
if (err.hint) console.error("hint:", err.hint);
if (err.status === 429) console.error("retry in", err.retryAfter, "s");
}
}hint, details and retryAfter may be undefined.
Auth flows
Most sub-clients send Authorization: Bearer <apiKey> using the apiKey passed to the
AudactClient constructor. Two surfaces use a different bearer token (org and platform), set via
setAuthToken() (or supplied up front in AudactClientOptions):
- OrgBearer — a JWT obtained from
client.org.login(). The SDK stores it on theorgsub-client automatically; every subsequentclient.org.*call (including the tenant-lifecycle methods) sends it instead of the API key.
Org login flow
ts
import { AudactClient } from "@audactcore/sdk";
const client = new AudactClient({ apiKey: "aud_live_..." });
// login() is public (no bearer required) and stores the returned access
// token on client.org automatically.
await client.org.login({ email: "admin@example.com", password: "hunter2" });
// Subsequent calls send `Authorization: Bearer <jwt>`.
const profile = await client.org.getProfile();
const tenants = await client.org.listTenants();
// Rotate the token before it expires, then clear it when done.
await client.org.refresh();
await client.org.logout();Alternatively, start pre-authenticated:
ts
const client = new AudactClient({
apiKey: "aud_live_...",
orgToken: "<jwt from a prior login>",
});A new client: webhooks
ts
const endpoint = await client.webhooks.createWebhook({
url: "https://example.com/hooks/audact",
events: ["call_ended", "compliance.violation_detected"],
scope: "account",
});
await client.webhooks.testWebhook(endpoint.id);
const deliveries = await client.webhooks.listWebhookDeliveries(endpoint.id);Development
bash
npm install npx tsc --noEmit # typecheck npm run build # emit dist/esm + dist/cjs npm run test # vitest
