# Sandboxes (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/sandboxes/2564102/settings>
* 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 a list of inboxes.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxesResponse":{"description":"Returns the list of inboxes in the account to which the API token has access.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TestingInbox"}}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes":{"get":{"summary":"Get a list of inboxes","description":"Get a list of inboxes.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxesResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"}},"operationId":"getInboxes"}}}}
```

## Create an inbox

> Create an inbox in a project.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/projects/{project_id}/inboxes":{"post":{"summary":"Create an inbox","description":"Create an inbox in a project.","tags":["Sandboxes (Inboxes)"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"inbox":{"type":"object","properties":{"name":{"type":"string"}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"createInbox"}}}}
```

## Get inbox attributes

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

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}":{"get":{"summary":"Get inbox attributes","description":"Get inbox attributes by inbox id. See the list of attributes in the example","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"getInboxAttributes"}}}}
```

## Delete an inbox

> Delete an inbox with all its emails.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}":{"delete":{"summary":"Delete an inbox","description":"Delete an inbox with all its emails.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"deleteInbox"}}}}
```

## Update an inbox

> Update inbox name, inbox email username.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}":{"patch":{"summary":"Update an inbox","description":"Update inbox name, inbox email username.","tags":["Sandboxes (Inboxes)"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"inbox":{"type":"object","properties":{"name":{"type":"string"},"email_username":{"type":"string"}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"updateInbox"}}}}
```

## Clean inbox

> Delete all messages (emails) from inbox.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}/clean":{"patch":{"summary":"Clean inbox","description":"Delete all messages (emails) from inbox.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"cleanInbox"}}}}
```

## Mark as read

> Mark all messages in the inbox as read.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}/all_read":{"patch":{"summary":"Mark as read","description":"Mark all messages in the inbox as read.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"markAsReadInbox"}}}}
```

## Reset credentials

> Reset SMTP credentials of the inbox.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}/reset_credentials":{"patch":{"summary":"Reset credentials","description":"Reset SMTP credentials of the inbox.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"resetInboxCredentials"}}}}
```

## Enable email address

> Turn the email address of the inbox on/off.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}/toggle_email_username":{"patch":{"summary":"Enable email address","description":"Turn the email address of the inbox on/off.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"enableInboxEmailAddresses"}}}}
```

## Reset email address

> Reset username of email address per inbox.

```json
{"openapi":"3.1.0","info":{"title":"Email Sandbox","version":"2.0.0"},"tags":[{"name":"Sandboxes (Inboxes)","description":"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.\n\n### Get your Sandbox ID\n\nTo use the Sandbox API, you need a Sandbox (Inbox) ID. You can get it in one of the following ways.\n\n#### Option 1: From the inbox URL\n\n1. Open your Sandbox in Mailtrap.\n2. Copy the ID from the inbox URL.\n\nExample:\n  - URL: https://mailtrap.io/sandboxes/2564102/settings\n  - Sandbox ID: 2564102\n\n#### Option 2: Via the API\n\nUse the `Get a list of inboxes` endpoint to retrieve all Sandboxes in your account.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"InboxResponse":{"description":"Returns attributes of the inbox.\n- **permissions** returns the permissions of the token for the inbox.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestingInbox"}}}},"UNAUTHENTICATED":{"description":"Returns unauthorized error message. Check your credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"Returns forbidden error message. Check your permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsDeniedResponse"}}}},"NOT_FOUND":{"description":"Returns not found error message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"schemas":{"TestingInbox":{"title":"Testing Inbox","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string","nullable":true,"description":"Password is only available if you have admin permissions for the inbox."},"max_size":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"email_username":{"type":"string"},"email_username_enabled":{"type":"boolean"},"sent_messages_count":{"type":"integer"},"forwarded_messages_count":{"type":"integer"},"used":{"type":"boolean"},"forward_from_email_address":{"type":"string"},"project_id":{"type":"integer"},"domain":{"type":"string"},"pop3_domain":{"type":"string"},"email_domain":{"type":"string"},"api_domain":{"type":"string"},"emails_count":{"type":"integer"},"emails_unread_count":{"type":"integer"},"last_message_sent_at":{"nullable":true,"type":"string"},"smtp_ports":{"type":"array","items":{"type":"integer"}},"pop3_ports":{"type":"array","items":{"type":"integer"}},"max_message_size":{"type":"integer"},"permissions":{"type":"object","properties":{"can_read":{"type":"boolean"},"can_update":{"type":"boolean"},"can_destroy":{"type":"boolean"},"can_leave":{"type":"boolean"}}}}},"UnauthenticatedResponse":{"title":"UnauthenticatedResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"PermissionsDeniedResponse":{"title":"PermissionsDeniedResponse","type":"object","properties":{"errors":{"type":"string","description":"Error message"}}},"NotFoundResponse":{"title":"NotFoundResponse","type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"paths":{"/api/accounts/{account_id}/inboxes/{inbox_id}/reset_email_username":{"patch":{"summary":"Reset email address","description":"Reset username of email address per inbox.","tags":["Sandboxes (Inboxes)"],"responses":{"200":{"$ref":"#/components/responses/InboxResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"}},"operationId":"resetEmailUserNamePerInbox"}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mailtrap.io/developers/email-sandbox/sandboxes-inboxes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
