@enlistdev/sdk
v0.8.0
Published
Official TypeScript SDK for Enlist — waitlist infrastructure as an API.
Maintainers
Readme
@enlistdev/sdk
Typed SDK for Enlist — waitlist infrastructure.
Create waitlists, add signups, track delivery. Fully typed, idempotent requests, built-in error handling. Drop-in for the REST API.
npm install @enlistdev/sdkQuickstart
import { Enlist } from '@enlistdev/sdk';
const enlist = new Enlist({ apiKey: process.env.ENLIST_API_KEY! });
const waitlist = await enlist.waitlists.create({ name: 'my-launch' });
const signup = await enlist.waitlists.addSignup(waitlist.id, {
email: '[email protected]',
utm_source: 'quest100k',
// Someone else's code, if this person arrived via a share link.
referral_code: 'k3f9x2mqbr',
metadata: { name: 'Ada Lovelace', company: 'Acme', plan: 'pro' },
});
console.log(`You're #${signup.position} of ${signup.total}`);
console.log(`Share: https://yoursite.com/?ref=${signup.referral_code}`);
const stats = await enlist.waitlists.getStats(waitlist.id);Your API key is a server-side secret. Call the SDK from a route handler or server action, never from browser code.
API
| Method | Returns |
| ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
| waitlists.create({ name }) | Waitlist |
| waitlists.list() | Page<WaitlistWithCount> |
| waitlists.get(id) | Waitlist |
| waitlists.update(id, { name }) | Waitlist — renames; nothing else moves |
| waitlists.delete(id) | void — deletes the waitlist AND all its signups |
| waitlists.addSignup(id, { email, utm_source?, referrer?, referral_code?, metadata?, fields? }) | SignupResult — { id, position, total, referral_code } |
| waitlists.listSignups(id, { limit?, offset? }) | Page<Signup> |
| waitlists.exportSignups(id) | string — full CSV of all signups |
| waitlists.removeSignup(id, signupId) | void |
| waitlists.getSignupPosition(id, { email }) | SignupPosition — { id, email, position, total, created_at } |
| waitlists.getStats(id, { from?, to? }) | WaitlistStats |
| waitlists.fields.list(waitlistId) | Page<FieldDefinition> |
| waitlists.fields.create(waitlistId, { key, label, type, required?, position? }) | FieldDefinition |
| waitlists.fields.update(waitlistId, key, { label?, required?, position? }) | FieldDefinition |
| waitlists.fields.delete(waitlistId, key) | void |
| integrations.list() | Integration[] |
| integrations.put(type, { config }) | IntegrationCreated — signing_secret set only on create |
| integrations.setEnabled(type, enabled) | Integration — pause or resume, keeps config, secret and log |
| integrations.delete(type) | void — also drops the signing secret and the delivery log |
The delivery log has no method here on purpose — it is a debugging read for a
human, so it lives in the dashboard and at
GET /v1/integrations/:type/deliveries, reachable with client.request.
waitlists.delete(id) is permanent and takes every signup with it. Call
waitlists.exportSignups(id) first if you want the addresses — nothing else does.
Every request and response shape is fully typed; import them from the package
root (import type { Signup } from '@enlistdev/sdk').
Supported integration types: webhook, slack, discord.
For webhook: creating without a signing_secret generates one and returns it
in signing_secret — the one and only time it is sent. Config is never readable
back, so omitted secret fields keep their stored value on update.
For slack and discord: pass { webhook_url, events } — webhook_url is
stored encrypted and never returned.
Referrals
Every signup gets a referral_code — ten lowercase Crockford base32 characters, stable for life.
Put it behind ?ref= and pass whatever comes back as referral_code on the next signup: the
referrer's referral_count goes up, and the new Signup carries referred_by. An unknown,
malformed, wrong-waitlist, or self-referral code is dropped silently rather than raised, so a
broken share link never costs you a signup. Positions are never touched — what a referral earns
is yours to define.
Errors
Non-2xx responses throw a EnlistError with status, a stable code, and
retryAfter on rate limits.
import { EnlistError } from '@enlistdev/sdk';
try {
await enlist.waitlists.addSignup(id, { email });
} catch (error) {
if (error instanceof EnlistError && error.code === 'rate_limited') {
// back off for error.retryAfter seconds
}
}Common codes: unauthorized, not_found, invalid_request, rate_limited,
quota_exceeded (402 — upgrade required, do not retry).
Options
new Enlist({
apiKey: '...',
baseUrl: 'http://localhost:3000', // self-hosted or local dev
timeoutMs: 15_000,
fetch: myFetch, // injectable, for tests
});Not using the SDK?
The API is plain REST. See the vanilla fetch() example in the
API reference — no dependency required. The
OpenAPI 3.1 spec describes every
endpoint if you would rather generate a client.
Docs
- Quickstart
- API reference
- SDK reference
- MCP server —
@enlistdev/mcp, for AI coding agents - Pricing and limits
MIT
