TypeScript SDK
The DICE SDK is a typed client for the public API, generated from the OpenAPI document. It has no dependencies and runs on Node 20 or newer.
import { DiceClient } from '@dice/sdk';
const dice = new DiceClient({ apiKey: process.env.DICE_API_KEY });
const { intake_id } = await dice.leads.create({ first_name: 'Ada', email: '[email protected]', message: 'Furnace repair' });
const lead = await dice.leads.waitForLead(intake_id);
for await (const l of dice.paginate((p) => dice.leads.list({ ...p, status: 'QUALIFIED' }))) console.log(l.id, l.score);What it does for you
- Sends the key as
Authorization: Bearer …, andDice-Businessfor agency keys (dice.forBusiness(id)). - Adds an
Idempotency-Keyto every POST. Pass your own with{ idempotencyKey }to retry safely across processes. - Retries 429 answers after
Retry-Afterand network errors on requests that are safe to repeat. - Throws
DiceApiErrorwithstatus,code,messageandrequestId. dice.paginate(…)walks every page of a list.verifyWebhook({ secret, payload, signature })checks a delivery and returns the event, or throwsWebhookSignatureError.
Other languages
Generate a client from the OpenAPI document at /api/openapi.json with any OpenAPI generator, or call the API directly: it is plain JSON over HTTPS.