Java Documentation

Send and receive emails in Java applications and tests. Create real email addresses on demand.


MailSlurp API

  • API version: 0.0.1-alpha

    • Build date: 2019-09-02T13:41:51.935+02:00[Europe/Berlin]

For documentation see developer guide. Create an account in the MailSlurp Dashboard to view your API Key. For all bugs, feature requests, or help please see support.

For more information, please visit

Automatically generated by the OpenAPI Generator


Building the API client library requires: 1. Java 1.7+ 2. Maven/Gradle


To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:


Gradle users

Add this dependency to your project's build file:

compile "com.mailslurp:mailslurp-client:4.4.0"


At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/mailslurp-client-4.4.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import com.mailslurp.client.*;
import com.mailslurp.client.auth.*;
import com.mailslurp.models.*;
import com.mailslurp.api.api.CommonOperationsApi;

import java.util.*;

public class CommonOperationsApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure API key authorization: API_KEY
        ApiKeyAuth API_KEY = (ApiKeyAuth) defaultClient.getAuthentication("API_KEY");
        API_KEY.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)

        CommonOperationsApi apiInstance = new CommonOperationsApi();
        try {
            Inbox result = apiInstance.createNewEmailAddress();
        } catch (ApiException e) {
            System.err.println("Exception when calling CommonOperationsApi#createNewEmailAddress");

Documentation for API Endpoints

All URIs are relative to

Class Method HTTP request Description
CommonOperationsApi createNewEmailAddress POST /newEmailAddress Create new email address
CommonOperationsApi deleteEmailAddress DELETE /deleteEmailAddress Delete email address and its emails
CommonOperationsApi sendEmailSimple POST /sendEmail Send an email from a random email address
CommonOperationsApi waitForLatestEmail GET /fetchLatestEmail Fetch inbox's latest email or if empty wait for email to arrive
CommonOperationsApi waitForNthEmail GET /waitForNthEmail Wait for or fetch the email with a given index in the inbox specified
ExtraOperationsApi bulkCreateInboxes POST /bulk/inboxes Bulk create Inboxes (email addresses)
ExtraOperationsApi bulkDeleteInboxes DELETE /bulk/inboxes Bulk Delete Inboxes
ExtraOperationsApi bulkSendEmails POST /bulk/send Bulk Send Emails
ExtraOperationsApi createInbox POST /inboxes Create an Inbox (email address)
ExtraOperationsApi createWebhook POST /inboxes/{inboxId}/webhooks Attach a WebHook URL to an inbox
ExtraOperationsApi deleteEmail DELETE /emails/{emailId} Delete Email
ExtraOperationsApi deleteInbox DELETE /inboxes/{inboxId} Delete Inbox / Email Address
ExtraOperationsApi deleteWebhook DELETE /inboxes/{inboxId}/webhooks/{webhookId} Delete and disable a WebHook for an Inbox
ExtraOperationsApi downloadAttachment GET /emails/{emailId}/attachments/{attachmentId} Get email attachment
ExtraOperationsApi getEmail GET /emails/{emailId} Get Email Content
ExtraOperationsApi getEmails GET /inboxes/{inboxId}/emails List Emails in an Inbox / EmailAddress
ExtraOperationsApi getInbox GET /inboxes/{inboxId} Get Inbox / EmailAddress
ExtraOperationsApi getInboxes GET /inboxes List Inboxes / Email Addresses
ExtraOperationsApi getRawEmailContents GET /emails/{emailId}/raw Get Raw Email Content
ExtraOperationsApi getWebhooks GET /inboxes/{inboxId}/webhooks Get all WebHooks for an Inbox
ExtraOperationsApi sendEmail POST /inboxes/{inboxId} Send Email

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:


  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header


It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.