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.
Install
Section titled “Install”npm install @waitlo/sdkThe package has no runtime dependencies of its own, and works anywhere fetch and crypto.subtle do – see Runtimes for exactly which ones CI proves.
Entry points
Section titled “Entry points”@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.
The server client
Section titled “The server client”Construct it with one credential. A secret key is bound to one project and one mode:
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:
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.
Calling a method
Section titled “Calling a method”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:
const waitlist = await waitlo.waitlists.create({ name: "Beta", public_count: false, consent_required: false, retention_days: null, challenge_required: true, double_opt_in: false,});{ "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, mapped to its method
Section titled “Every operation, mapped to its method”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:
Projects
Section titled “Projects”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.projects.list | GET /projects | List projects | Personal access token |
waitlo.projects.create | POST /projects | Create a project | Personal access token |
waitlo.projects.retrieve | GET /projects/{project_id} | Retrieve a project | Secret key or Personal access token |
waitlo.projects.update | PATCH /projects/{project_id} | Update a project | Personal access token |
waitlo.projects.delete | DELETE /projects/{project_id} | Delete a project | Personal access token |
waitlo.projects.apiKeys.list | GET /projects/{project_id}/keys | List a project's API keys | Personal access token |
waitlo.projects.apiKeys.create | POST /projects/{project_id}/keys | Create an API key | Personal access token |
waitlo.projects.apiKeys.retrieve | GET /projects/{project_id}/keys/{key_id} | Retrieve an API key | Personal access token |
waitlo.projects.apiKeys.revoke | DELETE /projects/{project_id}/keys/{key_id} | Revoke an API key | Personal access token |
waitlo.projects.apiKeys.roll | POST /projects/{project_id}/keys/{key_id}/roll | Roll an API key | Personal access token |
Waitlists
Section titled “Waitlists”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.waitlists.list | GET /waitlists | List waitlists | Secret key or Personal access token |
waitlo.waitlists.create | POST /waitlists | Create a waitlist | Secret key or Personal access token |
waitlo.waitlists.retrieve | GET /waitlists/{waitlist_id} | Retrieve a waitlist | Secret key or Personal access token |
waitlo.waitlists.update | PATCH /waitlists/{waitlist_id} | Update a waitlist | Secret key or Personal access token |
waitlo.waitlists.delete | DELETE /waitlists/{waitlist_id} | Delete a waitlist | Secret key or Personal access token |
waitlo.waitlists.countwaitlo.waitlists.count | GET /waitlists/{waitlist_id}/count | Get a waitlist's public count | Secret key, Personal access token or Publishable key |
waitlo.waitlists.consentPrompt | GET /waitlists/{waitlist_id}/consent_prompt | Read a waitlist's consent prompt | Publishable key |
waitlo.waitlists.consentWordings.list | GET /waitlists/{waitlist_id}/consent_wordings | List a waitlist's consent wordings | Secret key or Personal access token |
waitlo.waitlists.consentWordings.create | POST /waitlists/{waitlist_id}/consent_wordings | Publish a consent wording | Secret key or Personal access token |
waitlo.waitlists.consentWordings.retrieve | GET /waitlists/{waitlist_id}/consent_wordings/{consent_wording_id} | Retrieve a consent wording | Secret key or Personal access token |
waitlo.waitlists.consentWordings.retire | POST /waitlists/{waitlist_id}/consent_wordings/{consent_wording_id}/retire | Retire a consent wording | Secret key or Personal access token |
waitlo.waitlists.challenge | GET /waitlists/{waitlist_id}/challenge | Get a proof-of-work challenge for a waitlist | Publishable key |
waitlo.waitlists.entries.list | GET /waitlists/{waitlist_id}/entries | List a waitlist's entries | Secret key or Personal access token |
waitlo.waitlists.join | POST /waitlists/{waitlist_id}/entries | Join a waitlist | Publishable key |
waitlo.waitlists.entries.retrieve | GET /waitlists/{waitlist_id}/entries/{entry_id} | Retrieve an entry | Secret key or Personal access token |
waitlo.waitlists.entries.update | PATCH /waitlists/{waitlist_id}/entries/{entry_id} | Update an entry | Secret key or Personal access token |
waitlo.waitlists.entries.delete | DELETE /waitlists/{waitlist_id}/entries/{entry_id} | Delete an entry | Secret key or Personal access token |
waitlo.waitlists.entries.consentEvents.list | GET /waitlists/{waitlist_id}/entries/{entry_id}/consent_events | List an entry's consent history | Secret key or Personal access token |
waitlo.waitlists.entries.withdrawConsent | POST /waitlists/{waitlist_id}/entries/{entry_id}/withdraw_consent | Withdraw consent for an entry's address | Secret key or Personal access token |
waitlo.waitlists.entries.bulkUpdate | POST /waitlists/{waitlist_id}/entries/bulk_update | Bulk-update entries' status | Secret key or Personal access token |
waitlo.waitlists.entries.bulkDelete | POST /waitlists/{waitlist_id}/entries/bulk_delete | Bulk-delete entries | Secret key or Personal access token |
waitlo.waitlists.updates.list | GET /waitlists/{waitlist_id}/updates | List a waitlist's Updates | Secret key or Personal access token |
waitlo.waitlists.updates.create | POST /waitlists/{waitlist_id}/updates | Send an Update, or preview it with dry_run | Secret key or Personal access token |
waitlo.waitlists.updates.retrieve | GET /waitlists/{waitlist_id}/updates/{update_id} | Retrieve an Update | Secret key or Personal access token |
| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.forms.list | GET /forms | List contact forms | Secret key or Personal access token |
waitlo.forms.create | POST /forms | Create a contact form | Secret key or Personal access token |
waitlo.forms.retrieve | GET /forms/{form_id} | Retrieve a contact form | Secret key or Personal access token |
waitlo.forms.update | PATCH /forms/{form_id} | Update a contact form | Secret key or Personal access token |
waitlo.forms.delete | DELETE /forms/{form_id} | Delete a contact form | Secret key or Personal access token |
waitlo.forms.challenge | GET /forms/{form_id}/challenge | Get a proof-of-work challenge for a contact form | Publishable key |
waitlo.forms.messages.list | GET /forms/{form_id}/messages | List a form's messages | Secret key or Personal access token |
waitlo.forms.send | POST /forms/{form_id}/messages | Send a contact form message | Publishable key |
waitlo.forms.messages.retrieve | GET /forms/{form_id}/messages/{message_id} | Retrieve a message | Secret key or Personal access token |
waitlo.forms.messages.update | PATCH /forms/{form_id}/messages/{message_id} | Update a message | Secret key or Personal access token |
waitlo.forms.messages.delete | DELETE /forms/{form_id}/messages/{message_id} | Delete a message | Secret key or Personal access token |
waitlo.forms.messages.bulkUpdate | POST /forms/{form_id}/messages/bulk_update | Bulk-update messages' status | Secret key or Personal access token |
waitlo.forms.messages.bulkDelete | POST /forms/{form_id}/messages/bulk_delete | Bulk-delete messages | Secret key or Personal access token |
waitlo.forms.recipients.list | GET /forms/{form_id}/recipients | List a form's notification recipients | Secret key or Personal access token |
waitlo.forms.recipients.create | POST /forms/{form_id}/recipients | Add a notification recipient | Secret key or Personal access token |
waitlo.forms.recipients.delete | DELETE /forms/{form_id}/recipients/{recipient_id} | Remove a notification recipient | Secret key or Personal access token |
waitlo.forms.recipients.resendVerification | POST /forms/{form_id}/recipients/{recipient_id}/resend | Resend a recipient's verification email | Secret key or Personal access token |
Exports
Section titled “Exports”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.exports.create | POST /exports | Mint a 15-minute export link | Secret key or Personal access token |
| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.usage.retrieve | GET /usage | Get this month's submission usage | Personal access token |
Sending
Section titled “Sending”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.sending.retrieve | GET /sending | Get the project's daily email cap status | Secret key or Personal access token |
| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.stats.retrieve | GET /stats | Count a mode's entries and messages per local day | Secret key or Personal access token |
Sender
Section titled “Sender”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.sender.retrieve | GET /sender | Retrieve the project's sender identity | Secret key or Personal access token |
waitlo.sender.set | PUT /sender | Set the project's sender identity | Secret key or Personal access token |
waitlo.sender.domains.list | GET /sender/domains | List sender domains | Secret key or Personal access token |
waitlo.sender.domains.create | POST /sender/domains | Add a sender domain | Secret key or Personal access token |
waitlo.sender.domains.retrieve | GET /sender/domains/{sender_domain_id} | Retrieve a sender domain | Secret key or Personal access token |
waitlo.sender.domains.update | PATCH /sender/domains/{sender_domain_id} | Change a sender domain's local part | Secret key or Personal access token |
waitlo.sender.domains.delete | DELETE /sender/domains/{sender_domain_id} | Delete a sender domain | Secret key or Personal access token |
waitlo.sender.domains.check | POST /sender/domains/{sender_domain_id}/check | Re-check a sender domain's verification | Secret key or Personal access token |
Webhook
Section titled “Webhook”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.webhook.retrieve | GET /webhook | Retrieve the credential's mode's webhook | Secret key or Personal access token |
waitlo.webhook.set | PUT /webhook | Set the credential's mode's webhook | Secret key or Personal access token |
waitlo.webhook.delete | DELETE /webhook | Delete the credential's mode's webhook | Secret key or Personal access token |
waitlo.webhook.rollSecret | POST /webhook/secret/roll | Roll the webhook's signing secret | Secret key or Personal access token |
waitlo.webhook.test | POST /webhook/test | Send a test event to the webhook | Secret key or Personal access token |
waitlo.webhook.deliveries.list | GET /webhook/deliveries | List the webhook's deliveries | Secret key or Personal access token |
waitlo.webhook.deliveries.retrieve | GET /webhook/deliveries/{delivery_id} | Retrieve a webhook delivery | Secret key or Personal access token |
waitlo.webhook.deliveries.resend | POST /webhook/deliveries/{delivery_id}/resend | Resend a webhook delivery | Secret key or Personal access token |
Suppressions
Section titled “Suppressions”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.suppressions.list | GET /suppressions | List suppressions | Secret key or Personal access token |
waitlo.suppressions.create | POST /suppressions | Suppress an address | Secret key or Personal access token |
waitlo.suppressions.retrieve | GET /suppressions/{suppression_id} | Retrieve a suppression | Secret key or Personal access token |
waitlo.suppressions.delete | DELETE /suppressions/{suppression_id} | Lift a suppression | Secret key or Personal access token |
Email messages
Section titled “Email messages”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.emailMessages.list | GET /email_messages | List email messages | Secret key or Personal access token |
waitlo.emailMessages.retrieve | GET /email_messages/{email_message_id} | Retrieve an email message | Secret key or Personal access token |
Privacy
Section titled “Privacy”| Method | Route | Summary | Credential |
|---|---|---|---|
waitlo.privacy.subjects.retrieve | GET /privacy/subjects | Look up everything held about an email | Secret key or Personal access token |
waitlo.privacy.subjects.delete | DELETE /privacy/subjects | Erase everything held about an email | Secret key or Personal access token |
A handful of operations have no method on either client:
- The OpenAPI document itself, served at /openapi.json. Get the OpenAPI document
- Only the dashboard's own signed-in session reaches this -- a personal access token can't manage other personal access tokens or connected apps. Create a personal access token, List connected apps, List personal access tokens, Retrieve a personal access token, Revoke a connected app, Revoke a personal access token
- A query-string link token carries this request, not a bearer credential. Confirm a double opt-in join, Show a double opt-in join's confirm page, Show a submitter's unsubscribe confirm page, Show a recipient's unsubscribe-link confirm page, Show a recipient's verify-link confirm page, Show which waitlists hold a submitter's address, and their Updates state, Unsubscribe from a project's updates, Unsubscribe a recipient from a form's notifications, Stop all Updates, or re-grant Updates on one waitlist, Confirm a recipient's verify link
- Returns the CSV file itself, not a JSON body. Export a waitlist, a form or consent_events as CSV
The browser client
Section titled “The browser 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:
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:
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.
Errors
Section titled “Errors”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):
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.
Retries, idempotency and timeouts
Section titled “Retries, idempotency and timeouts”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:
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".
Pagination
Section titled “Pagination”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:
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.
Runtimes
Section titled “Runtimes”@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) |
Webhooks
Section titled “Webhooks”@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.