Sandbox mode is only used to validate your request. The email will never be delivered while this feature is enabled! Any requests made in sandbox mode will not generate events in either Event Webhook or Email Activity. No Credits will be consumed.
Sandbox mode is an optional parameter within mail_settings
. Enabling sandbox mode allows you to send a test email to ensure that your request body is formatted correctly without delivering the email to any of your recipients.
When making a request with sandbox mode enabled, we will validate the form, type, and shape of your request. In other words, sandbox mode will validate each parameter you include and the structure of your JSON payload. If you include a template_id
in your sandbox mode request, it will be assumed that you have included a subject line and body within the template. We will not validate this content.
When using sandbox mode, you must include the "enable" parameter, and it must be given a Boolean value of either true or false. Do not enclose the Boolean value in quotes or you will receive the error:
The sandbox mode enable param should be a boolean value.
When your request validates, you will receive a 200 OK
response (as opposed to the 202 ACCEPTED
response that is returned for successful non-sandbox requests).
If you submit a request with sandbox mode enabled, but your request body is invalid, you will receive one or more error messages with error codes, detailed explanations for the error or errors, and links to any relevant documentation.
The following is an invalid request body intended to demonstrate the validation behavior of sandbox mode for a bad request.
1{2"personalizations": [{3"to": [{4"email": "john@example.com"5}],6"subject": "Hello, World!"7}],8"from": {9"email": "John Doe"10},11"content": {12"type": "text",13"value": "Hello, World!"14},15"mail_settings": {16"sandbox_mode": {17"enable": true18}19}20}
Response
1{2"errors": [3{4"field": "from",5"message": "The from object must at least have an 'email'6parameter with a valid email address and may also contain a 'name' parameter. e.g. {"email": "example@example.com"} or {"email": "example@example.com", "name": "Example Recipient"}"7}8]9}