Errors
The error format and every error code an API key can receive.
Errors use the RFC 9457 problem details format
(Content-Type: application/problem+json):
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.21",
"title": "Template variables are missing: firstName.",
"status": 422,
"instance": "POST /api/v1/companies/…/projects/…/messages",
"code": "message.missing_variables",
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
}| Field | Meaning |
|---|---|
status | The HTTP status code. |
title | A human-readable message. It may change; do not parse it. |
code | A stable error code. Branch on this in your code. |
traceId | Identifies the request in the platform logs. Include it when you contact support. |
instance | The method and path of the request. |
errors | Only for validation errors: messages per field. |
Responses produced before your request reaches the API logic (401, 403, 413, unknown routes, unreadable JSON)
are problem details without a code. Rely on the HTTP status for those.
Validation errors
400 with code: "validation.failed" lists the invalid fields in errors. Field names use the server's naming: for a
send request they start with Message., and list parameters use their PascalCase name (PageSize, Sort).
{
"title": "One or more validation errors occurred.",
"status": 400,
"code": "validation.failed",
"errors": {
"Message.Recipients[0].Value": ["'Value' is not a valid email address."],
"Message.Content": ["'Content' is required when no template is given."]
},
"traceId": "0af7651916cd43dd8448eb211c80319c"
}Status codes
| Status | Meaning | Retry? |
|---|---|---|
200, 201, 202, 204 | Success. 202 means the message was accepted for delivery. | — |
400 | The request is invalid. | No, fix the request. |
401 | Missing, invalid, expired or revoked API key. | No, fix the key. |
403 | The key is not allowed to call this route (another project, or a missing permission). | No. |
404 | The project, message, template, attachment or channel does not exist. | No. |
413 | The request body is too large (attachment uploads: 10 MB; other requests: 30 MB). | No. |
422 | The request is valid but a business rule rejects it (see codes below). | Only after fixing the cause. |
429 | Rate limit exceeded. | Yes, after Retry-After. |
500, 502, 503, 504 | Server or infrastructure error. | Yes, with backoff (use an idempotency key for sends). |
Error codes
Common
| Code | Status | Meaning |
|---|---|---|
validation.failed | 400 | One or more fields are invalid; see errors. |
project.not_found | 404 | The project does not exist or was deleted. |
company.not_found | 404 | The company does not exist or was deleted. |
rate_limit.exceeded | 429 | Too many requests; see Rate limits. |
Messages
| Code | Status | Meaning |
|---|---|---|
message.not_found | 404 | No message with this id in the project. |
message.channel_not_found | 404 | The channel code does not exist. |
message.template_not_found | 404 | The template does not exist in the project or belongs to another channel. |
attachment.not_found | 404 | An id in attachmentIds does not exist in the project. |
message.company_inactive | 422 | The company is passive and cannot send. |
message.project_inactive | 422 | The project is passive and cannot send. |
message.no_active_provider | 422 | The project has no active provider in the chain of this channel. |
message.push_requires_device_tokens | 422 | A push message has a recipient that is not a DeviceToken. |
message.otp_not_supported | 422 | isOtp is set but no provider of the SMS chain supports OTP. |
message.missing_variables | 422 | Template placeholders have no value; the title lists them. |
message.attachments_not_supported | 422 | Attachments on a channel other than email. |
message.attachments_too_large | 422 | More than 10 attachments or 20 MB in total, template attachments included. |
message.not_cancellable | 422 | Cancel on a message that is no longer Pending. |
Templates
| Code | Status | Meaning |
|---|---|---|
message_template.not_found | 404 | No template with this id in the project. |
Attachments
| Code | Status | Meaning |
|---|---|---|
attachment.not_found | 404 | No attachment with this id in the project. |
attachment.empty | 422 | The uploaded file is empty. |
attachment.too_large | 422 | The file is larger than 10 MB. |
attachment.type_not_allowed | 422 | The extension is not allowed, or the content does not match it. |
attachment.rejected | 422 | The file was rejected by the content scan. |
attachment.in_use | 422 | The attachment is used by a message or template and cannot be deleted. |
project_storage_provider.not_found | 404 | The storage the file was written to no longer exists. |
storage.no_default | 422 | The project has no default storage for uploads. |
storage.inactive | 422 | The project's storage is passive. |
storage.credentials_missing | 422 | The project's storage is not fully configured. |
storage.request_failed | 422 | The storage service rejected the request. |
The storage.* codes are fixed in the dashboard by a project administrator.
Troubleshooting
Check that the header is named X-Api-Key and holds the whole key (nb_<prefix>_<secret>), without quotes or a
Bearer prefix. In the dashboard, check that the key is not revoked or expired. A key that is lost cannot be shown
again: create a new one.
A key only works on routes of its own project. Compare companyId and projectId in the URL with the project of the
key, and make sure the endpoint is one of the API key endpoints: deleting messages or changing
templates is not possible with a key.
The channel has no active provider in the project's provider chain. In the dashboard, add a provider under Providers and put it in the chain of the channel under Provider chains.
A message is Pending until its dispatches are picked up. If scheduledAt is set, it waits for that time. If not,
and it stays Pending for several minutes, the delivery pipeline or the channel's providers need attention:
stalePendingMessages in the statistics overview counts these messages.
Every {{ placeholder }} of the template (content, subject and data) needs a value for every recipient. The error
title lists the missing keys; keys are case-sensitive. Add them to variables or to each recipient's variables.