Mailpark
Get started

Errors

Every error says what happened and what to do about it, in plain words. Read the fix before you retry: most 4xx errors won't go away on their own.

422 Unprocessable Entity
{
  "error": {
    "code": "validation_failed",
    "message": "Some fields are missing or invalid.",
    "fix": "Fix the fields listed in `error.fields` and try again.",
    "docs": "https://docs.mailpark.io/errors/validation_failed",
    "fields": {
      "to": "Must be one email address."
    }
  }
}

code is stable: branch on it. message and fix are for people and may change. docs links to the code's page below. validation_failed adds fields, keyed by field path.

import { MailparkError } from "mailpark";

try {
  await mailpark.emails.send({ to, template: "password-reset", data });
} catch (err) {
  if (err instanceof MailparkError) {
    console.error(err.status, err.code, err.message, "Fix:", err.fix);
    if (err.code === "rate_limited") { /* back off and retry */ }
  }
  throw err;
}

Authentication and permissions

Request problems

Sending limits and blocks

Account state

Conflicts

Server and availability