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
- 400
invalid_jsonBody isn't valid JSON - 422
validation_failedSome fields are invalid - 404
not_foundNot found - 404
template_not_foundTemplate not found - 404
list_not_foundContact list not found - 404
sequence_not_foundSequence not found - 404
theme_not_foundTheme not found - 429
rate_limitedToo many requests - 422
rendering_failedTemplate couldn't render
Sending limits and blocks
- 202
suppressedRecipient is suppressed - 202
unsubscribedRecipient unsubscribed - 202
unsubscribed_topicRecipient left this topic - 429
daily_limit_reachedToday's marketing limit reached - 402
spending_cap_reachedSpending cap reached - 402
plan_limit_reachedPlan limit reached - 409
domain_not_verifiedNo verified domain - 409
broadcast_too_largeAudience too large for the trust level
Account state
Conflicts
- 409
idempotency_key_reusedIdempotency key reused - 409
idempotency_in_progressSame request in flight - 409
list_existsList name taken - 409
list_in_useList in use - 409
too_many_listsToo many lists - 409
already_memberAlready a member - 409
last_ownerLast owner - 409
template_in_useTemplate in use - 409
domain_in_useDomain in use - 409
domain_takenDomain belongs to another account - 409
broadcast_not_editableBroadcast can't be changed - 409
broadcast_not_awaiting_approvalNot awaiting approval - 409
broadcast_not_heldNot held - 409
broadcast_finishedBroadcast finished - 409
upload_missingFile not uploaded yet - 409
asset_limitToo many images