Skip to content
Documentation
Hevia for developers

SDK: @hevia/sdkBeta

A typed TypeScript client generated from the OpenAPI document: pagination, safe retries, webhook verification, OAuth.

Note

The package lives in the repository (packages/sdk) and is not on npm yet. It has no runtime dependencies and runs on Node 22 or newer.

Install

In the monorepo it is the workspace package @hevia/sdk:

JSON
{ "dependencies": { "@hevia/sdk": "*" } }

Outside the monorepo, copy packages/sdk until the first npm release. The package exports TypeScript source; run it with Node 22.6+ (--experimental-strip-types) or any bundler.

Client

TypeScript
import { HeviaClient } from "@hevia/sdk";

const hevia = new HeviaClient({ apiKey: process.env.HEVIA_KEY!, version: "2026-11-09" });
OptionMeaning
apiKey / accessToken / tokenProviderExactly one. tokenProvider is an async function asked before every attempt (use it with OAuth).
baseUrlDefault https://hevia.app/api/v1.
versionSent as Hevia-Version.
maxRetriesDefault 3.
timeoutMsPer attempt, default 30 000.

Every endpoint is a method: contacts.list / listAll / create, conversations.list / get, requests.list / get, deals.list / get / create, quotes.list / get, tasks.list / create / update, objects.list / listTypes, customerSuccess.listHealth, events.send. The API reference shows the call for each endpoint.

Errors

ClassWhen
AuthenticationError401
PermissionError403, code is insufficient_scope or plan_required
NotFoundError404
InvalidRequestError400, 413, 422; field names the culprit
ConflictError409
RateLimitError429; retryAfter in seconds
ApiError5xx and anything unexpected
ConnectionErrorNo answer: network or timeout

Retries

Network errors, 429 (honouring Retry-After) and 5xx are retried with exponential backoff and jitter. A write is retried only when it carries an Idempotency-Key; for POST /contacts, /deals and /tasks the client creates one and reuses it on every attempt. POST /events and PATCH /tasks/{id} are never retried automatically.

Regenerate

Shell
npm run snapshot -w @hevia/sdk   # openapi.json and events.json from the product
npm run generate -w @hevia/sdk   # src/generated/*
npm test -w @hevia/sdk

A test fails when the committed snapshots differ from the live OpenAPI document or the event catalog, so the SDK cannot fall behind. More in SDK examples.

Generated from the product's own registries, so the reference matches the API.