WaitKitWaitKit
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

CodeDescriptionTypical cause
200SuccessRequest completed
201CreatedSubscriber added
400Bad requestMissing or invalid email field
401UnauthorizedMissing, invalid, or revoked API key
404Not foundProject slug does not exist
409ConflictEmail already registered for this project
429Too many requestsRate limit exceeded
500Internal errorServer 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 Authorization header uses the Bearer scheme

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.

On this page