> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/developers/inbound/inboxes.md).

# Inboxes

An inbox is the destination for inbound email. Each inbox is created inside a folder and gets a unique generated address that can receive mail from any sender.

## List inboxes

> Returns all inboxes in a folder.

```json
{"openapi":"3.1.0","info":{"title":"Inbound","version":"2.0.0"},"tags":[{"name":"inboxes","description":"An inbox is the destination for inbound email. Each inbox is created\ninside a folder and gets a unique generated address that can receive\nmail from any sender.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"parameters":{"folder_id":{"name":"folder_id","in":"path","required":true,"description":"Inbound folder ID","schema":{"type":"integer"}}},"schemas":{"Inbox":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"address":{"type":"string","format":"email","description":"Generated inbound address. Mail sent to this address is delivered\nto the inbox.\n"}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/inbound/folders/{folder_id}/inboxes":{"get":{"operationId":"listInboundInboxes","summary":"List inboxes","description":"Returns all inboxes in a folder.","tags":["inboxes"],"parameters":[{"$ref":"#/components/parameters/folder_id"}],"responses":{"200":{"description":"List of inboxes","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Inbox"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
```

## Create an inbox

> Create a new inbox in a folder. Mailtrap generates the inbox \`address\`\
> automatically based on the \`name\`.<br>

```json
{"openapi":"3.1.0","info":{"title":"Inbound","version":"2.0.0"},"tags":[{"name":"inboxes","description":"An inbox is the destination for inbound email. Each inbox is created\ninside a folder and gets a unique generated address that can receive\nmail from any sender.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"parameters":{"folder_id":{"name":"folder_id","in":"path","required":true,"description":"Inbound folder ID","schema":{"type":"integer"}}},"schemas":{"InboxInput":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":100}}},"Inbox":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"address":{"type":"string","format":"email","description":"Generated inbound address. Mail sent to this address is delivered\nto the inbox.\n"}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"string"}}},"UnprocessableEntity":{"type":"object","properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableEntity"}}}}}},"paths":{"/api/inbound/folders/{folder_id}/inboxes":{"post":{"operationId":"createInboundInbox","summary":"Create an inbox","description":"Create a new inbox in a folder. Mailtrap generates the inbox `address`\nautomatically based on the `name`.\n","tags":["inboxes"],"parameters":[{"$ref":"#/components/parameters/folder_id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxInput"}}}},"responses":{"201":{"description":"Inbox created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"}}}}}}
```

## Get an inbox

> Returns a single inbox.

```json
{"openapi":"3.1.0","info":{"title":"Inbound","version":"2.0.0"},"tags":[{"name":"inboxes","description":"An inbox is the destination for inbound email. Each inbox is created\ninside a folder and gets a unique generated address that can receive\nmail from any sender.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"parameters":{"folder_id":{"name":"folder_id","in":"path","required":true,"description":"Inbound folder ID","schema":{"type":"integer"}},"inbox_id":{"name":"inbox_id","in":"path","required":true,"description":"Inbound inbox ID","schema":{"type":"integer"}}},"schemas":{"Inbox":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"address":{"type":"string","format":"email","description":"Generated inbound address. Mail sent to this address is delivered\nto the inbox.\n"}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/inbound/folders/{folder_id}/inboxes/{inbox_id}":{"get":{"operationId":"getInboundInbox","summary":"Get an inbox","description":"Returns a single inbox.","tags":["inboxes"],"parameters":[{"$ref":"#/components/parameters/folder_id"},{"$ref":"#/components/parameters/inbox_id"}],"responses":{"200":{"description":"Inbox details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
```

## Delete an inbox

> Permanently delete an inbox and all its received messages.<br>

```json
{"openapi":"3.1.0","info":{"title":"Inbound","version":"2.0.0"},"tags":[{"name":"inboxes","description":"An inbox is the destination for inbound email. Each inbox is created\ninside a folder and gets a unique generated address that can receive\nmail from any sender.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"parameters":{"folder_id":{"name":"folder_id","in":"path","required":true,"description":"Inbound folder ID","schema":{"type":"integer"}},"inbox_id":{"name":"inbox_id","in":"path","required":true,"description":"Inbound inbox ID","schema":{"type":"integer"}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"string"}}}}},"paths":{"/api/inbound/folders/{folder_id}/inboxes/{inbox_id}":{"delete":{"operationId":"deleteInboundInbox","summary":"Delete an inbox","description":"Permanently delete an inbox and all its received messages.\n","tags":["inboxes"],"parameters":[{"$ref":"#/components/parameters/folder_id"},{"$ref":"#/components/parameters/inbox_id"}],"responses":{"204":{"description":"Inbox deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
```

## Update an inbox

> Rename an inbox. The generated \`address\` does not change.<br>

```json
{"openapi":"3.1.0","info":{"title":"Inbound","version":"2.0.0"},"tags":[{"name":"inboxes","description":"An inbox is the destination for inbound email. Each inbox is created\ninside a folder and gets a unique generated address that can receive\nmail from any sender.\n"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"parameters":{"folder_id":{"name":"folder_id","in":"path","required":true,"description":"Inbound folder ID","schema":{"type":"integer"}},"inbox_id":{"name":"inbox_id","in":"path","required":true,"description":"Inbound inbox ID","schema":{"type":"integer"}}},"schemas":{"InboxInput":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":100}}},"Inbox":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"address":{"type":"string","format":"email","description":"Generated inbound address. Mail sent to this address is delivered\nto the inbox.\n"}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ForbiddenError":{"type":"object","properties":{"errors":{"type":"string"}}},"UnprocessableEntity":{"type":"object","properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableEntity"}}}}}},"paths":{"/api/inbound/folders/{folder_id}/inboxes/{inbox_id}":{"patch":{"operationId":"updateInboundInbox","summary":"Update an inbox","description":"Rename an inbox. The generated `address` does not change.\n","tags":["inboxes"],"parameters":[{"$ref":"#/components/parameters/folder_id"},{"$ref":"#/components/parameters/inbox_id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxInput"}}}},"responses":{"200":{"description":"Inbox updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Inbox"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/inbound/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.
