@custral/sdk is the official server-side client for the /v1 REST API: records, conversations, objects, identity, and Stripe-style webhook verification. Zero runtime dependencies (native fetch + node:crypto), ESM + CJS, fully typed.
Install
Quickstart
Create a key in Settings → Applications and grant it the scopes each endpoint needs.Configuration
Records
Conversations
View, manage, and ingest conversations: the loop a custom bridge (e.g. an iMessage or WhatsApp middleware) runs.Objects
Identity & MCP
Errors
Every failure throws a typedCustralError carrying a machine-readable code, an HTTP statusCode, the requestId, and the rateLimit budget.
CustralAuthenticationError (401), CustralPermissionError (403), CustralNotFoundError (404), CustralInvalidRequestError (400), CustralRateLimitError (429), CustralAPIError (5xx), and CustralConnectionError. maxRetries retries only safe failures, 429s always, and 5xx / connection errors only for idempotent GETs (a failed create is never auto-retried).
Webhooks
Custral delivers events as signed HTTP POSTs (X-Custral-Signature: t=<ts>,v1=<hmac>). Register listeners with on(...) and verify + dispatch with webhooks.express() (mount with a raw body parser so the signed bytes survive):
See also
- API Reference: every
/v1endpoint with a live playground. - Authentication: API keys, scopes, and environments.
- Browser SDK:
@custral/jsfor usage tracking and errors. - React SDK:
@custral/widgetfor the chat widget.