Skip to content

Send API errors

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 identifier
  • ErrorCode: standardized classification of the error (see table bellow)
  • StatusCode: Status code of the error , follow the http status code
  • ErrorMessage: description of the error
  • ErrorRelatedTo: 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
}

Error in validation of the JSON Payload

{
  "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 CodeError CodeDescriptionRelated To
400send-0003when none of the HTMLTextTemplateID properties are provided.HTMLPart, TextPart, TemplateID
400send-0004when providing HTML property, as well as a template also containing an HTML part - i.e. Duplicated contentHTMLPart, TemplateID
403send-0006when the API key doesn’t have permission to use a Sender header. Please contact our support team to be granted permission.SenderID
403send-0007when SenderID is provided but not validated.SenderID
403send-0008when 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
400send-0010when the API key can’t send the provided template. Please verify the owner of the template.TemplateID
400send-0011when 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"]
400send-0012when DeduplicateCampaign is set to true while no CustomCampaign is defined.CustomCampaign, DeduplicateCampaign
400send-0015when the total number of recipients is over the limit.To,CC,Bcc
400send-0016when TemplateLanguage value is missing but TemplateErrorReporting or TemplateErrorDeliver are present.TemplateLanguage
401mj-0001when API key is suspended.
400mj-0002when the API call contains payload with an invalid JSON syntax.
400mj-0003when a mandatory property is missing or with null value. See ErrorRelatedTo for a list
400mj-0004when there is a type mismatch in the value of a property
400mj-0005when a property value is not an allowed values.Priority,TrackClicks,TrackOpens
400mj-0006when a property contains more than the maximum allowed number of characters.Subject, URLTags
400mj-0007when an empty array is provided that cannot be empty.Messages,To
400mj-0008when an array property contains more than the maximum allowed number of elements. Max Allowed item limit is 50.Messages,Attachments,InlineAttachments,Headers,Variables
400mj-0011when the payload size is over the limit.
400mj-0012when an empty string value is provided.Email,FileName,Base64Content,ContentType
400mj-0013when the email address format is invalid.Email
401mj-0015when 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.