@knoxcall/sdk is the official KnoxCall client for Node.js and TypeScript. Every method is fully typed against the live /v1 response shapes.
Install
Not yet published to npm — install from a monorepo checkout by path, or via a git subdirectory reference. Requires Node 18 or newer.
Create a client
KNOXCALL_ACCESS_TOKEN / KNOXCALL_API_KEY), the credentials file written by knoxcall login (~/.knoxcall/credentials.json), workload identity (GitHub Actions, GCP, AWS, Azure, Vercel — the platform’s OIDC token is exchanged for a KnoxCall access token, no stored secrets in CI), then KNOXCALL_CLIENT_ID + KNOXCALL_CLIENT_SECRET.
Log in once with the CLI
On a developer machine, runknoxcall login once (this package ships it: npm install -g @knoxcall/sdk or npx knoxcall login — every KnoxCall SDK ships the same command). It signs you in via your browser and stores the credential in ~/.knoxcall/credentials.json — this SDK picks the file up automatically, including the stored tenant and base URL, and handles refresh (cross-process safe, atomic rotation of the single-use refresh token). If the stored credential is revoked or expired, the SDK throws AuthenticationError telling you to run knoxcall login again. Select a profile with KNOXCALL_PROFILE.
Manage resources
Create a route, then list with pagination — the server’s{data, meta} envelope is unwrapped for single objects, and iterate() walks every page:
secrets, webhooks, clients, oauthClients, environments, apiKeys, account, auditLogs, agents, crypto, pki, vaults, and dynamicDb.
Call routes through the proxy
client.call() proxies a request through a KnoxCall route to your upstream and returns the raw Response — the upstream’s HTTP status belongs to you; the SDK never turns it into an error. Reference routes by slug (write-once, rename-proof); UUIDs also work.
Bound routes
State the route (and optional defaults) once withclient.route(), then use plain HTTP verbs:
call().
Verify webhooks
constructWebhookEvent verifies the delivery signature AND parses it into a typed event in one step. Pass the raw body bytes (never re-serialized JSON):
client.webhooks.constructEvent(). Same positional signature as every other KnoxCall SDK — (rawBody, headers, secret, options?), pure synchronous computation. Timestamps are replay-checked (default tolerance 300s; pass { toleranceSeconds: null } to disable).
Handle errors
All errors extendKnoxCallError and carry .status, .code, .headers, .body, and .requestId:
APIConnectionError / APIConnectionTimeoutError / APIUserAbortError (transport), AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404), ConflictError (409), ValidationError (422, with .fields), RateLimitError (429, with .retryAfter), ServerError (5xx), plus WebhookSignatureVerificationError, SignupError, and BootstrapError.
Retries and idempotency
Management requests retry automatically on network errors and HTTP 408/429/500/502/503/504 with exponential jittered backoff (never 409;Retry-After honored on 429, capped at 30s). Mutating requests carry a ULID X-Idempotency-Key that stays stable across retries — pass { idempotencyKey } on any mutating method to supply your own. Tune with:
DPoP
For higher-security tenants, enable sender-constrained tokens (RFC 9449) — the SDK generates an ES256 keypair, binds the access token viacnf.jkt, and signs a fresh proof per request:
"auto" mode the SDK upgrades to DPoP automatically when the OAuth client record requires it.
Full reference
The package README documents every resource method, token stores (FileTokenStore, RedisTokenStore), telemetry hooks, the ephemeral proxy, the low-level Session, and credential-less signup(): sdk/knoxcall-node/README.md in the monorepo.