Guides
Error Handling
Error types, status codes, and troubleshooting for SDK and API errors.
SDK errors
The SDK throws WaitKitError for all API errors. The error object includes the HTTP status and a message:
import { WaitKit, WaitKitError } from "waitkit";
try {
await wk.subscribers.create({ email: "invalid" });
} catch (err) {
if (err instanceof WaitKitError) {
console.error(err.status, err.message);
}
}API status codes
| Code | Description | Typical cause |
|---|---|---|
200 | Success | Request completed |
201 | Created | Subscriber added |
400 | Bad request | Missing or invalid email field |
401 | Unauthorized | Missing, invalid, or revoked API key |
404 | Not found | Project slug does not exist |
409 | Conflict | Email already registered for this project |
429 | Too many requests | Rate limit exceeded |
500 | Internal error | Server error (contact support if persistent) |
Common issues
API key not working
- Verify the key starts with
wk_ - Confirm the key belongs to the correct project
- Check that the key has not been deleted from the dashboard
- Ensure the
Authorizationheader uses theBearerscheme
Project slug not found
The slug in the API path must match the project slug exactly. Slugs are case-sensitive and are set when the project is created. View the slug from the project settings page in the dashboard.
Email already registered
A 409 means this email is already on the waitlist. This is expected behavior — duplicate signups are prevented to maintain accurate counts.
