InsuredAuditDeveloper Portal

TypeScript / JavaScript SDK

@creb/sdk wraps the public /v1 REST surface with a typed client. Source lives at packages/sdk-ts/ in the platform repo.

Install

npm install @creb/sdk
# or
pnpm add @creb/sdk
# or
yarn add @creb/sdk

Requires 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

MethodUnderlying 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 ship in the repo under packages/sdk-ts/examples/:

  • 01-ingest-event.ts
  • 02-request-bundle.ts
  • 03-search-timeline.ts
  • 04-manage-webhooks.ts
  • 05-list-rules.ts