Sandboxes (Inboxes)

Manage test inboxes

Manage Sandboxes (Inboxes) for email testing. Capture and inspect emails without delivering them to real recipients. This is ideal for development, staging, and QA environments.

Get your Sandbox ID

To use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.

Option 1: From the inbox URL

  1. Open your Sandbox in Mailtrap.

  2. Copy the ID from the inbox URL.

Example:

  • URL: https://mailtrap.io/inboxes/2564102/messages

  • Sandbox ID: 2564102

Option 2: Via the API

Use the Get a list of inboxes endpoint to retrieve all Sandboxes in your account.

Get a list of inboxes

get

Get a list of inboxes.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
Responses
chevron-right
200

Returns the list of inboxes in the account to which the API token has access.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
get
/api/accounts/{account_id}/inboxes

Create an inbox

post

Create an inbox in a project.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
project_idinteger · int64 · min: 1Required

Unique project ID

Example: 4032
Body
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
post
/api/accounts/{account_id}/projects/{project_id}/inboxes

Get inbox attributes

get

Get inbox attributes by inbox id. See the list of attributes in the example

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
get
/api/accounts/{account_id}/inboxes/{inbox_id}

Delete an inbox

delete

Delete an inbox with all its emails.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
delete
/api/accounts/{account_id}/inboxes/{inbox_id}

Update an inbox

patch

Update inbox name, inbox email username.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Body
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
patch
/api/accounts/{account_id}/inboxes/{inbox_id}

Clean inbox

patch

Delete all messages (emails) from inbox.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
patch
/api/accounts/{account_id}/inboxes/{inbox_id}/clean

Mark as read

patch

Mark all messages in the inbox as read.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
patch
/api/accounts/{account_id}/inboxes/{inbox_id}/all_read

Reset credentials

patch

Reset SMTP credentials of the inbox.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
patch
/api/accounts/{account_id}/inboxes/{inbox_id}/reset_credentials

Enable email address

patch

Turn the email address of the inbox on/off.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
patch
/api/accounts/{account_id}/inboxes/{inbox_id}/toggle_email_username

Reset email address

patch

Reset username of email address per inbox.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
account_idinteger · int64 · min: 1Required

Unique account ID

Example: 3229
inbox_idinteger · int64 · min: 1Required

Unique inbox ID

Example: 4015
Responses
chevron-right
200

Returns attributes of the inbox.

  • permissions returns the permissions of the token for the inbox.
application/json
idintegerOptional
namestringOptional
usernamestringOptional
passwordstring · nullableOptional

Password is only available if you have admin permissions for the inbox.

max_sizeintegerOptional
statusstring · enumOptionalPossible values:
email_usernamestringOptional
email_username_enabledbooleanOptional
sent_messages_countintegerOptional
forwarded_messages_countintegerOptional
usedbooleanOptional
forward_from_email_addressstringOptional
project_idintegerOptional
domainstringOptional
pop3_domainstringOptional
email_domainstringOptional
api_domainstringOptional
emails_countintegerOptional
emails_unread_countintegerOptional
last_message_sent_atstring · nullableOptional
smtp_portsinteger[]Optional
pop3_portsinteger[]Optional
max_message_sizeintegerOptional
patch
/api/accounts/{account_id}/inboxes/{inbox_id}/reset_email_username

Last updated

Was this helpful?