Error handling
Error Response Structure
The error payload follows a strict structure composed of two root objects:
errors(Array): A list containing one or more error objects.code(String): Unique error identifier, stable and machine-readable (e.g.,INVALID_RECIPIENT).message(String): Textual description of the problem, intended for the developer.location(String, optional): Pointer to the faulty field in the request (dot notation, e.g.,body.recipients.0.email).input(Mixed, optional): The provided value that caused the error.
metadata(Object): Contextual information regarding execution.timestamp(Float): Date and time of the error (UNIX timestamp).
HTTP Status Codes
The HTTP code indicates the general category of the error.
| Code | Meaning | Description | Recommended Action |
|---|---|---|---|
| 400 | Bad Request | Request syntax is invalid (e.g., malformed JSON). | Check your JSON syntax. |
| 401 | Unauthorized | Authentication failed. | Check the presence and validity of your Bearer Token. |
| 403 | Forbidden | Authenticated, but insufficient rights. | Check account or token permissions. |
| 404 | Not Found | The targeted resource is missing. | Check the resource ID in the URL. |
| 409 | Conflict | State conflict (e.g., creating a duplicate). | Check if the resource already exists. |
| 413 | Payload Too Large | Request exceeds size limit. | Reduce payload or attachment size. |
| 422 | Unprocessable Entity | Semantic validation error. | Correct fields indicated in errors. |
| 429 | Rate Limit Error | Request quota exceeded. | Implement an Exponential Backoff. |
| 500 | Server Error | Unexpected internal error. | Contact support with the timestamp. |
Application Error Codes (code)
The code field within the errors object allows for programmatic error handling.
Code (code) | Probable Cause | Resolution Path |
|---|---|---|
VALIDATION_ERROR | Missing data or incorrect type. | Consult the endpoint schema documentation. |
AUTHENTICATION_ERROR | Token missing, expired, or badly signed. | Renew your access token. |
INVALID_PERMISSIONS | Attempt to access outside of scope. | Check scopes associated with your token. |
INVALID_CONTENT | Invalid HTML or forbidden tags. | Validate your HTML code or check encoding. |
INVALID_METADATA | Unsupported metadata keys. | Respect the expected key/value structure. |
INVALID_ATTACHMENT | File too large or forbidden extension. | Check size limits and MIME types. |
INVALID_RECIPIENT | Malformed email/phone or blacklisted. | Check contact format (Regex). |
INTERNAL_SERVER_ERROR | Platform-side bug. | Retry later or contact support. |
Response Example (422 Error)
The example below illustrates a validation error where a recipient's email address is formatted incorrectly. Note the use of the location field to identify the precise index within an array.
{
"errors": [
{
"code": "INVALID_RECIPIENT",
"message": "The recipient email format is invalid.",
"location": "body.to.0.email",
"input": "jean.dupont@"
}
],
"metadata": {
"timestamp": 1742294105.0
}
}
Rate limiting
To ensure fair usage and maintain platform stability, the NMP API enforces a strict rate limiting system on the number of requests performed within a given time period.
Filtering
Many list endpoints support narrowing results via a company-wide `filter[field][key(optional)][$op]=value` query convention, letting you filter by field, operator and value directly from the query string.