When an error occurs on a message validation, a error Status will be returned in the response. The description of the error(s) will be contain in the Errors property. Each error will contain the following properties:
ErrorIdentifier: internal Mailjet Error identifierErrorCode: standardized classification of the error (see table bellow)StatusCode: Status code of the error , follow the http status codeErrorMessage: description of the errorErrorRelatedTo: list of message properties related to this error
Global Error (example: broken JSON format)
{
"ErrorIdentifier": "06df1144-c6f3-4ca7-8885-7ec5d4344113",
"ErrorCode": "mj-0002",
"ErrorMessage": "Malformed JSON, please review the syntax and properties types.",
"StatusCode": 400
}{
"Messages": [
{
"Status": "error",
"Errors": [
{
"ErrorIdentifier": "f987008f-251a-4dff-8ffc-40f1583ad7bc",
"ErrorCode": "mj-0004",
"StatusCode": 400,
"ErrorMessage": "Type mismatch. Expected type \"array of emails\".",
"ErrorRelatedTo": ["HTMLPart", "TemplateID"]
},
{
"ErrorIdentifier": "8e28ac9c-1fd7-41ad-825f-1d60bc459189",
"ErrorCode": "mj-0005",
"StatusCode": 400,
"ErrorMessage": "The To is mandatory but missing from the input",
"ErrorRelatedTo": ["To"]
}
]
}
]
}In bulk sending (multiple instances of messages in Messages), we will process each message separately. As a result, the response can contain both success and error notifications. For a single message, Send API can return multiple errors, each related to different properties of the payload.
| Status Code | Error Code | Description | Related To |
|---|---|---|---|
| 400 | send-0003 | when none of the HTML, Text, TemplateID properties are provided. | HTMLPart, TextPart, TemplateID |
| 400 | send-0004 | when providing HTML property, as well as a template also containing an HTML part - i.e. Duplicated content | HTMLPart, TemplateID |
| 403 | send-0006 | when the API key doesn’t have permission to use a Sender header. Please contact our support team to be granted permission. | SenderID |
| 403 | send-0007 | when SenderID is provided but not validated. | SenderID |
| 403 | send-0008 | when the sender email address provided in the From property is not authorized. The validation can be done on the Sender domains & addresses page or through the API. | From |
| 400 | send-0010 | when the API key can’t send the provided template. Please verify the owner of the template. | TemplateID |
| 400 | send-0011 | when one of the forbidden headers (headers that have a property alternative) is set in the Headers collection. Please use the dedicated message property to set this header. | Headers["headerName"] |
| 400 | send-0012 | when DeduplicateCampaign is set to true while no CustomCampaign is defined. | CustomCampaign, DeduplicateCampaign |
| 400 | send-0015 | when the total number of recipients is over the limit. | To,CC,Bcc |
| 400 | send-0016 | when TemplateLanguage value is missing but TemplateErrorReporting or TemplateErrorDeliver are present. | TemplateLanguage |
| 401 | mj-0001 | when API key is suspended. | |
| 400 | mj-0002 | when the API call contains payload with an invalid JSON syntax. | |
| 400 | mj-0003 | when a mandatory property is missing or with null value. See ErrorRelatedTo for a list | |
| 400 | mj-0004 | when there is a type mismatch in the value of a property | |
| 400 | mj-0005 | when a property value is not an allowed values. | Priority,TrackClicks,TrackOpens |
| 400 | mj-0006 | when a property contains more than the maximum allowed number of characters. | Subject, URLTags |
| 400 | mj-0007 | when an empty array is provided that cannot be empty. | Messages,To |
| 400 | mj-0008 | when an array property contains more than the maximum allowed number of elements. Max Allowed item limit is 50. | Messages,Attachments,InlineAttachments,Headers,Variables |
| 400 | mj-0011 | when the payload size is over the limit. | |
| 400 | mj-0012 | when an empty string value is provided. | Email,FileName,Base64Content,ContentType |
| 400 | mj-0013 | when the email address format is invalid. | |
| 401 | mj-0015 | when the user did not provide valid authorization credentials. |
When the HTTP status for the API call is 500, you will see ErrorIdentifier field. It will contain a reference to the error in our internal log and it is crucial for us to determine the root cause of the failure. Should you encounter such errors, please contact our support for additional investigation, providing this error identifier.