DeckleDocs
Dashboard

API reference

Errors

Deckle uses conventional HTTP status codes and returns a JSON error message on every failure.

A 2xx status means success. A 4xx indicates a problem with your request; a 5xx indicates a problem on Deckle’s side.

Error shape#

Every non-2xx response has the same body: a single human-readable message.

json
{
  "error": "'to' must be a valid email address."
}

Status codes#

CodeMeaning
200 / 201Success. Created resources return 201.
202Accepted and queued (for example, an async send or campaign).
400The request body was not valid JSON.
401Missing or invalid secret API key.
403Forbidden — e.g. a test key attempting a live-only action.
404The resource does not exist or is not in your project.
409Conflict — e.g. editing a campaign that has already sent.
422Validation failed. The message names the field or rule.
429Rate limit exceeded. Retry after the Retry-After header.
5xxSomething went wrong on Deckle’s side, or delivery via SES failed (502).

Handling errors in the SDK#

The Node.js SDK throws a DeckleError for any non-2xx response, exposing status, message, and the raw body.

ts
import { DeckleError } from "@deckle/sdk";

try {
  await deckle.emails.send({ /* … */ });
} catch (err) {
  if (err instanceof DeckleError) {
    console.error(err.status, err.message);
  }
}