Create new email addresses and mailboxes in MailSlurp using the API

How to create email addresses and mailboxes using MailSlurp's API. Custom email inboxes and disposable email accounts.

  • Table of contents

You can create MailSlurp inboxes on demand using the API, dashboard or SDK libraries.


MailSlurp's API provides a simple and convenient way to create email addresses and mailboxes for your application. With MailSlurp, developers can easily create custom email inboxes and generate disposable email accounts to test email functionality in their applications.

To create an email address using MailSlurp's API, developers can send a POST request to the MailSlurp API endpoint with the desired parameters such as username and domain name. Once the email address is created, developers can use it to send and receive emails in their application. MailSlurp also provides features to fetch email contents, track email events, and automate email workflows.

In addition to custom email inboxes, MailSlurp allows developers to generate disposable email accounts for testing purposes. Disposable email accounts are temporary email addresses that can be used for testing without revealing the user's personal email address. This is particularly useful for developers who need to test their application's email functionality without exposing real email addresses to potential spam or other security risks.

To create a disposable email account using MailSlurp's API, developers can use the "createInbox" function and set the "expiresAt" parameter to a specific time or date. This will automatically delete the disposable email account after the specified time has elapsed, ensuring that the inbox is no longer accessible and the data is securely disposed of.

Overall, MailSlurp's API provides a powerful set of tools for developers to create custom email inboxes and generate disposable email accounts for testing purposes. By using MailSlurp, developers can streamline their testing workflows and ensure that their application's email functionality is fully functional and secure.

Randomized addresses

The simplest way to create an inbox is to use a createInbox() method. When passed no parameters MailSlurp will randomly assigned the inbox an email address ending in The returned object looks like this:

  "id": "32f88182-3b6a-4f6e-8a53-59819931033a",
  "userId": "6f68f0cc-4760-4e82-87ad-449c9037773b",
  "created": "2019-12-06T13:04:13.998Z",
  "emailAddress": ""

In the above example the inbox's ID is 32f88182-3b6a-4f6e-8a53-59819931033a. The inbox's email address is Any emails sent to this address will be parsed and stored under that inbox ID.

Specific addresses

You can also create inboxes using specific addresses. Simply pass the address you wish to use as an emailAddress parameter. For example: createInbox('')

Note specific email addresses must use a domain that you have created.


For most paid plans email addresses are permanent. Some unpaid options expire after a month. For automated tests it is recommended that you create new inboxes each test run and clean up afterwards using deleteInbox methods.

Next steps

Now lets look at how to receive emails with an inbox you have created.