TypeScript / JavaScript SDK
@creb/sdk wraps the public /v1 REST surface with a typed client.
Availability. The SDK is provided to customers and pilot partners on request. It is not published to the public npm registry. The REST API and its OpenAPI specification are public.
Install
Install the package file your InsuredAudit contact provides:
npm install ./creb-sdk-<version>.tgz
# or
pnpm add ./creb-sdk-<version>.tgz
# or
yarn add ./creb-sdk-<version>.tgzRequires Node 18 or newer (uses the global fetch).
Construct
import { CrebClient } from "@creb/sdk";
const client = new CrebClient({
baseUrl: "https://api.insuredaudit.com",
apiKey: process.env.CREB_API_KEY!,
tenantId: "acme", // optional default for every call
timeoutMs: 30_000, // optional, default 30s
maxAttempts: 3, // optional retry budget
});Method map
| Method | Underlying route |
|---|---|
healthz() | GET /v1/healthz |
ingestEvent() | POST /v1/events |
ingestBatch() | POST /v1/events (batch shape) |
validateEvent() | POST /v1/events/validate |
memberTimeline() | GET /v1/members/{id}/timeline |
searchEvents() | POST /v1/search |
uploadDocument() | POST /v1/documents |
getDocumentMetadata() | GET /v1/documents/{id}/metadata |
downloadDocument() | GET /v1/documents/{id} |
requestBundle() | POST /v1/bundles |
getBundle() | GET /v1/bundles/{id} |
listBundles() | GET /v1/bundles |
downloadBundle() | GET /v1/bundles/{id}/download |
requestBundleAndWait() | POST then poll until sealed |
createWebhook() | POST /v1/webhooks |
listWebhooks() | GET /v1/webhooks |
rotateWebhookSecret() | POST /v1/webhooks/{id}/rotate-secret |
deleteWebhook() | DELETE /v1/webhooks/{id} |
listRules() | GET /v1/rules |
listLegalHolds() | GET /v1/legal-holds |
Error handling
import { CrebApiError } from "@creb/sdk";
try {
await client.ingestEvent(envelope);
} catch (e) {
if (e instanceof CrebApiError) {
if (e.code === "RATE_LIMITED") {
// back off
} else if (e.status === 400) {
console.error("validation:", e.body);
}
} else {
throw e;
}
}Retries
Transient errors (network failures, 5xx, 429) are retried with full-jitter exponential backoff for GET, PUT, DELETE, and for POSTs that supply idempotencyKey. Other POSTs are not retried — pass idempotencyKey when you need them to be.
Examples
Five runnable examples are provided with the SDK on request:
01-ingest-event.ts02-request-bundle.ts03-search-timeline.ts04-manage-webhooks.ts05-list-rules.ts
