Skip to content

TypeScript SDK

@waitlo/sdk is a thin, typed client over the REST API: no dependencies, generated types, and the same behavior – retries, errors, pagination – on every call. It ships as two entry points, a server client for your backend and a browser client for the page a person submits from, and both are thin enough that reading this page once covers every method either one has.

sdk/install.txt
npm install @waitlo/sdk

The package has no runtime dependencies of its own, and works anywhere fetch and crypto.subtle do – see Runtimes for exactly which ones CI proves.

@waitlo/sdk is the server entry: a secret key or a personal access token, for your backend, a script, or the local MCP server. It throws if it ever finds itself running with both window and document defined, since either credential would otherwise sit in a page anyone can read.

@waitlo/sdk/browser is the browser entry: a publishable key only, for the page a person submits a waitlist join or a contact message from. It has no such guard – a publishable key is meant to run wherever a page’s own code runs.

Reach for the server entry anywhere you manage a project’s data; reach for the browser entry only to wire up a submit.

Construct it with one credential. A secret key is bound to one project and one mode:

sdk/secret-key-client.ts
export const waitlo = new Waitlo({ secretKey: "sk_test_…" });

A personal access token acts as you across every project you own, so it also takes which project and mode this client talks to:

sdk/personal-access-token-client.ts
export const waitlo = new Waitlo({ accessToken: "waitlo_pat_…", project: "proj_…", mode: "test" });

Pass exactly one of secretKey or accessToken – both, or neither, is a TypeError thrown at construction. Every namespace below (waitlo.waitlists, waitlo.forms, and so on) hangs off whichever client you built.

Every method takes its resource’s path ids first, positionally, then its params, then an options object last – timeout, signal, maxRetries, a per-call headers, and (a personal access token only) project/mode to override the client’s own. await a call to get its parsed response body:

sdk/calling-a-method.ts
const waitlist = await waitlo.waitlists.create({
name: "Beta",
public_count: false,
consent_required: false,
retention_days: null,
challenge_required: true,
double_opt_in: false,
});
sdk/calling-a-method-output.json
{
"id": "wl_8f2k",
"object": "waitlist",
"name": "Beta",
"public_count": false,
"consent_required": false,
"retention_days": null,
"challenge_required": true,
"double_opt_in": false,
"first_live_submission_at": null,
"created_at": "2026-01-09T15:04:05.000Z"
}

Awaiting isn’t the only thing you can do with a call: .withResponse() gives you the raw Response alongside the parsed body and the request’s own id, and a GET list method returns something richer still – see Pagination.

Every operation apps/api’s OpenAPI document declares, grouped by the server client’s namespace that carries it (or, where only the browser client reaches it, marked as such) and the credential it takes:

MethodRouteSummaryCredential
waitlo.projects.listGET /projectsList projectsPersonal access token
waitlo.projects.createPOST /projectsCreate a projectPersonal access token
waitlo.projects.retrieveGET /projects/{project_id}Retrieve a projectSecret key or Personal access token
waitlo.projects.updatePATCH /projects/{project_id}Update a projectPersonal access token
waitlo.projects.deleteDELETE /projects/{project_id}Delete a projectPersonal access token
waitlo.projects.apiKeys.listGET /projects/{project_id}/keysList a project's API keysPersonal access token
waitlo.projects.apiKeys.createPOST /projects/{project_id}/keysCreate an API keyPersonal access token
waitlo.projects.apiKeys.retrieveGET /projects/{project_id}/keys/{key_id}Retrieve an API keyPersonal access token
waitlo.projects.apiKeys.revokeDELETE /projects/{project_id}/keys/{key_id}Revoke an API keyPersonal access token
waitlo.projects.apiKeys.rollPOST /projects/{project_id}/keys/{key_id}/rollRoll an API keyPersonal access token
MethodRouteSummaryCredential
waitlo.waitlists.listGET /waitlistsList waitlistsSecret key or Personal access token
waitlo.waitlists.createPOST /waitlistsCreate a waitlistSecret key or Personal access token
waitlo.waitlists.retrieveGET /waitlists/{waitlist_id}Retrieve a waitlistSecret key or Personal access token
waitlo.waitlists.updatePATCH /waitlists/{waitlist_id}Update a waitlistSecret key or Personal access token
waitlo.waitlists.deleteDELETE /waitlists/{waitlist_id}Delete a waitlistSecret key or Personal access token
waitlo.waitlists.count
waitlo.waitlists.count
GET /waitlists/{waitlist_id}/countGet a waitlist's public countSecret key, Personal access token or Publishable key
waitlo.waitlists.consentPromptGET /waitlists/{waitlist_id}/consent_promptRead a waitlist's consent promptPublishable key
waitlo.waitlists.consentWordings.listGET /waitlists/{waitlist_id}/consent_wordingsList a waitlist's consent wordingsSecret key or Personal access token
waitlo.waitlists.consentWordings.createPOST /waitlists/{waitlist_id}/consent_wordingsPublish a consent wordingSecret key or Personal access token
waitlo.waitlists.consentWordings.retrieveGET /waitlists/{waitlist_id}/consent_wordings/{consent_wording_id}Retrieve a consent wordingSecret key or Personal access token
waitlo.waitlists.consentWordings.retirePOST /waitlists/{waitlist_id}/consent_wordings/{consent_wording_id}/retireRetire a consent wordingSecret key or Personal access token
waitlo.waitlists.challengeGET /waitlists/{waitlist_id}/challengeGet a proof-of-work challenge for a waitlistPublishable key
waitlo.waitlists.entries.listGET /waitlists/{waitlist_id}/entriesList a waitlist's entriesSecret key or Personal access token
waitlo.waitlists.joinPOST /waitlists/{waitlist_id}/entriesJoin a waitlistPublishable key
waitlo.waitlists.entries.retrieveGET /waitlists/{waitlist_id}/entries/{entry_id}Retrieve an entrySecret key or Personal access token
waitlo.waitlists.entries.updatePATCH /waitlists/{waitlist_id}/entries/{entry_id}Update an entrySecret key or Personal access token
waitlo.waitlists.entries.deleteDELETE /waitlists/{waitlist_id}/entries/{entry_id}Delete an entrySecret key or Personal access token
waitlo.waitlists.entries.consentEvents.listGET /waitlists/{waitlist_id}/entries/{entry_id}/consent_eventsList an entry's consent historySecret key or Personal access token
waitlo.waitlists.entries.withdrawConsentPOST /waitlists/{waitlist_id}/entries/{entry_id}/withdraw_consentWithdraw consent for an entry's addressSecret key or Personal access token
waitlo.waitlists.entries.bulkUpdatePOST /waitlists/{waitlist_id}/entries/bulk_updateBulk-update entries' statusSecret key or Personal access token
waitlo.waitlists.entries.bulkDeletePOST /waitlists/{waitlist_id}/entries/bulk_deleteBulk-delete entriesSecret key or Personal access token
waitlo.waitlists.updates.listGET /waitlists/{waitlist_id}/updatesList a waitlist's UpdatesSecret key or Personal access token
waitlo.waitlists.updates.createPOST /waitlists/{waitlist_id}/updatesSend an Update, or preview it with dry_runSecret key or Personal access token
waitlo.waitlists.updates.retrieveGET /waitlists/{waitlist_id}/updates/{update_id}Retrieve an UpdateSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.forms.listGET /formsList contact formsSecret key or Personal access token
waitlo.forms.createPOST /formsCreate a contact formSecret key or Personal access token
waitlo.forms.retrieveGET /forms/{form_id}Retrieve a contact formSecret key or Personal access token
waitlo.forms.updatePATCH /forms/{form_id}Update a contact formSecret key or Personal access token
waitlo.forms.deleteDELETE /forms/{form_id}Delete a contact formSecret key or Personal access token
waitlo.forms.challengeGET /forms/{form_id}/challengeGet a proof-of-work challenge for a contact formPublishable key
waitlo.forms.messages.listGET /forms/{form_id}/messagesList a form's messagesSecret key or Personal access token
waitlo.forms.sendPOST /forms/{form_id}/messagesSend a contact form messagePublishable key
waitlo.forms.messages.retrieveGET /forms/{form_id}/messages/{message_id}Retrieve a messageSecret key or Personal access token
waitlo.forms.messages.updatePATCH /forms/{form_id}/messages/{message_id}Update a messageSecret key or Personal access token
waitlo.forms.messages.deleteDELETE /forms/{form_id}/messages/{message_id}Delete a messageSecret key or Personal access token
waitlo.forms.messages.bulkUpdatePOST /forms/{form_id}/messages/bulk_updateBulk-update messages' statusSecret key or Personal access token
waitlo.forms.messages.bulkDeletePOST /forms/{form_id}/messages/bulk_deleteBulk-delete messagesSecret key or Personal access token
waitlo.forms.recipients.listGET /forms/{form_id}/recipientsList a form's notification recipientsSecret key or Personal access token
waitlo.forms.recipients.createPOST /forms/{form_id}/recipientsAdd a notification recipientSecret key or Personal access token
waitlo.forms.recipients.deleteDELETE /forms/{form_id}/recipients/{recipient_id}Remove a notification recipientSecret key or Personal access token
waitlo.forms.recipients.resendVerificationPOST /forms/{form_id}/recipients/{recipient_id}/resendResend a recipient's verification emailSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.exports.createPOST /exportsMint a 15-minute export linkSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.usage.retrieveGET /usageGet this month's submission usagePersonal access token
MethodRouteSummaryCredential
waitlo.sending.retrieveGET /sendingGet the project's daily email cap statusSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.stats.retrieveGET /statsCount a mode's entries and messages per local daySecret key or Personal access token
MethodRouteSummaryCredential
waitlo.sender.retrieveGET /senderRetrieve the project's sender identitySecret key or Personal access token
waitlo.sender.setPUT /senderSet the project's sender identitySecret key or Personal access token
waitlo.sender.domains.listGET /sender/domainsList sender domainsSecret key or Personal access token
waitlo.sender.domains.createPOST /sender/domainsAdd a sender domainSecret key or Personal access token
waitlo.sender.domains.retrieveGET /sender/domains/{sender_domain_id}Retrieve a sender domainSecret key or Personal access token
waitlo.sender.domains.updatePATCH /sender/domains/{sender_domain_id}Change a sender domain's local partSecret key or Personal access token
waitlo.sender.domains.deleteDELETE /sender/domains/{sender_domain_id}Delete a sender domainSecret key or Personal access token
waitlo.sender.domains.checkPOST /sender/domains/{sender_domain_id}/checkRe-check a sender domain's verificationSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.webhook.retrieveGET /webhookRetrieve the credential's mode's webhookSecret key or Personal access token
waitlo.webhook.setPUT /webhookSet the credential's mode's webhookSecret key or Personal access token
waitlo.webhook.deleteDELETE /webhookDelete the credential's mode's webhookSecret key or Personal access token
waitlo.webhook.rollSecretPOST /webhook/secret/rollRoll the webhook's signing secretSecret key or Personal access token
waitlo.webhook.testPOST /webhook/testSend a test event to the webhookSecret key or Personal access token
waitlo.webhook.deliveries.listGET /webhook/deliveriesList the webhook's deliveriesSecret key or Personal access token
waitlo.webhook.deliveries.retrieveGET /webhook/deliveries/{delivery_id}Retrieve a webhook deliverySecret key or Personal access token
waitlo.webhook.deliveries.resendPOST /webhook/deliveries/{delivery_id}/resendResend a webhook deliverySecret key or Personal access token
MethodRouteSummaryCredential
waitlo.suppressions.listGET /suppressionsList suppressionsSecret key or Personal access token
waitlo.suppressions.createPOST /suppressionsSuppress an addressSecret key or Personal access token
waitlo.suppressions.retrieveGET /suppressions/{suppression_id}Retrieve a suppressionSecret key or Personal access token
waitlo.suppressions.deleteDELETE /suppressions/{suppression_id}Lift a suppressionSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.emailMessages.listGET /email_messagesList email messagesSecret key or Personal access token
waitlo.emailMessages.retrieveGET /email_messages/{email_message_id}Retrieve an email messageSecret key or Personal access token
MethodRouteSummaryCredential
waitlo.privacy.subjects.retrieveGET /privacy/subjectsLook up everything held about an emailSecret key or Personal access token
waitlo.privacy.subjects.deleteDELETE /privacy/subjectsErase everything held about an emailSecret key or Personal access token

A handful of operations have no method on either client:

@waitlo/sdk/browser takes one publishable key and exposes the same two namespaces, waitlists and forms, trimmed to what a page submitting from the browser needs: join/send for the two submits, plus the challenge, count and consent-prompt reads that a hand-built form (one that isn’t using an integration snippet) calls directly. Construct it with a publishable key in place of a secret key or token:

sdk/browser-client.ts
export const waitlo = new Waitlo({ publishableKey: "pk_test_…" });

A waitlist or form with its challenge on needs a solved ALTCHA proof before it’ll accept a join or a message. Solving one takes real work, so a page that waits until the click to start it makes someone watch a spinner for no reason – call solveChallenge as soon as the page loads instead, and only await it inside the submit handler:

wire-waitlist-form.ts
import { Waitlo, solveChallenge } from "@waitlo/sdk/browser";
const waitlo = new Waitlo({ publishableKey: "pk_test_…" });
const waitlistId = "wl_…";
const form = document.querySelector<HTMLFormElement>("#waitlist-form");
// Solved ahead of the click (ADR 0117), so the submit itself only waits on the network.
let solved = waitlo.waitlists.challenge(waitlistId).then(async (challenge) => ({ challenge, solution: await solveChallenge(challenge) }));
form?.addEventListener("submit", async (event) => {
event.preventDefault();
const data = new FormData(form);
const body = { email: String(data.get("email") ?? ""), waitlo_website: String(data.get("waitlo_website") ?? "") };
const { challenge, solution } = await solved;
const altcha = btoa(JSON.stringify({ challenge, solution }));
await waitlo.waitlists.join(waitlistId, { ...body, altcha });
});

waitlists.join/forms.send both accept { challenge: false } as a third argument in place of an altcha field, for a waitlist or form you’ve turned the challenge off for.

Every error the SDK throws on purpose is a WaitloError; instanceof WaitloError catches them all. A response the API answered with its own error envelope throws one WaitloApiError subclass per error.type – InvalidRequestError, AuthenticationError, PermissionError, IdempotencyError, RateLimitError or ServerError – never by HTTP status alone, and each carries status, code, param, docUrl and requestId straight from the envelope. .is(code) narrows code and, for the few codes that carry one, types the extra field alongside it (duplicate_entry’s entry, rate_limited’s policy):

sdk/errors.ts
async function retrieveWaitlistSafely(waitlistId: string) {
try {
return await waitlo.waitlists.retrieve(waitlistId);
} catch (err) {
if (err instanceof InvalidRequestError && err.is("resource_missing")) {
console.error(`No such waitlist: ${waitlistId}`);
return null;
}
throw err;
}
}
const waitlist = await retrieveWaitlistSafely("wl_00000000000000000000000000");

Three more classes cover what isn’t a response at all: ConnectionError (DNS, a refused connection, a CORS failure), its subclass TimeoutError (the client’s own timeout fired first) and AbortError (your own AbortSignal fired). A fourth, UnexpectedResponseError, covers a response the SDK couldn’t read at all – an error status with no recognizable envelope, or a success whose body isn’t the JSON the operation promises.

Every call times out after 30 seconds by default (timeout, per call or per client) and retries a transient failure up to twice (maxRetries, same override): a 408/429/500/503 on any method, a 502/504 or a connection failure only on GET/POST (the two methods a retry never risks duplicating a write for), each wait backing off from half a second, doubling, capped at 8 seconds, honoring a Retry-After header when the API sends one.

Every POST carries an Idempotency-Key – generated once before the first attempt, unchanged across every retry – so a retried create is never duplicated. Pass your own to make a call idempotent across separate invocations too, not just within one:

sdk/idempotency.ts
const body = { name: "Beta", public_count: false, consent_required: false, retention_days: null, challenge_required: true, double_opt_in: false };
const idempotencyKey = `signup-${Date.now()}`;
const first = await waitlo.waitlists.create(body, { idempotencyKey });
const retry = await waitlo.waitlists.create(body, { idempotencyKey });
// retry.id === first.id: the retry never created a second waitlist.

Reusing a key with a different body is an IdempotencyError; reusing it while the first call is still in flight is the same, with code: "idempotency_key_in_use".

Every GET list method returns a PagePromise, not a plain ApiPromise: await it for the first page alone, same as any other call, or walk every item across every page with for await:

sdk/pagination.ts
const names: string[] = [];
for await (const waitlist of waitlo.waitlists.list({ limit: 1 })) {
names.push(waitlist.name);
}

.pages() walks page by page instead of item by item, and .toArray({ max }) collects up to a required cap. Every page’s own limit stays the page size, never a total – the SDK never raises it on your behalf, so await and for await of the same call always agree on what page one looks like.

Every request body, response, and the OpenAPI document itself are generated straight from apps/api’s own spec, exported by name (CreateWaitlistBody, Waitlist, Entry, and so on) – the SDK can’t drift from the API it types, because a spec change that breaks a type fails the SDK’s own build. Four generic helpers, keyed by any operation id, cover the rest: OperationBody, OperationQuery, OperationPathIds and OperationResult (plus OperationListItem for a list operation’s own item type), for code that needs a type without importing the one export name a generated schema happens to have.

@waitlo/sdk needs only fetch and, for the browser entry’s challenge solving, crypto.subtle – no Node-specific API anywhere in its import graph. CI’s own sdk-runtimes matrix builds and runs the SDK for real against each of these, so these are the only ones this page promises, not a longer list the SDK merely seems compatible with:

Runtime
Node.js 22
Bun
Deno
Cloudflare Workers (workerd)

@waitlo/sdk also exports verifyWebhook and the WebhookEvent/WebhookEventType types a receiver needs to check and read a delivery – see Verify webhooks for the full guide, receivers included.