MailSlurp logo

Microsoft Power Automate integration

Integrate MailSlurp email and SMS APIs with Power Automate

View Markdown Agent setup
Power Automate and MailSlurp integration banner

MailSlurp integrates with Power Automate via REST API to provide email and SMS actions. Create and control real phone numbers and email accounts directly in your flows.

Get JSON to import

If you want a reusable custom connector, import the MailSlurp OpenAPI JSON definition.

You can either import directly from URL in Power Automate, or download JSON first:

curl -L "https://api.mailslurp.com/v2/api-docs/" -o mailslurp-openapi.json

Then in Power Automate:

  1. Go to Custom connectors.
  2. Select New custom connector.
  3. Choose Import an OpenAPI file (or import from URL).
  4. Upload mailslurp-openapi.json or paste the OpenAPI URL.
  5. Configure API key auth using header name x-api-key.
  6. Save and test the connector actions.

HTTP Request integration

You can also call MailSlurp directly with built-in HTTP actions (without a custom connector):

  1. Add an HTTP action.
  2. Set method and URL for the MailSlurp endpoint.
  3. Add x-api-key in request headers.
  4. Use Parse JSON on the response body for typed outputs.

How to get JSON for Parse JSON

  1. Run the HTTP action once with sample input.
  2. Open the run history and copy the response body JSON.
  3. Add a Parse JSON action and choose Generate from sample.
  4. Paste the copied JSON.

Typical flow for OTP or email verification

  1. Create an inbox for the current run.
  2. Submit that email address to your app workflow.
  3. Wait for the latest matching email.
  4. Extract code or link content.
  5. Continue flow logic and assertions.

Important actions

Here are common actions for creating inboxes, waiting for messages, and extracting codes:

Create inboxes

POST /inboxes/withDefaults

Create an inbox with default options. Uses MailSlurp domain pool address and is private.

Request, parameters, and responses

Responses

StatusSchemaDescription
201InboxDtoCreated
HTTP and SDK snippets

HTTP

HTTP
POST /inboxes/withDefaults HTTP/1.1
Host: api.mailslurp.com
x-api-key: YOUR_API_KEY
Accept: application/json

cURL

cURL
curl -X POST "https://api.mailslurp.com/inboxes/withDefaults" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"

JavaScript SDK

JavaScript SDK
import { Configuration, InboxControllerApi } from "mailslurp-client";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });
const inboxController = new InboxControllerApi(config);

const result = await inboxController.createInboxWithDefaults();

Python SDK

Python SDK
import mailslurp_client
from mailslurp_client.api.inbox_controller_api import InboxControllerApi

configuration = mailslurp_client.Configuration()
configuration.api_key["x-api-key"] = "YOUR_API_KEY"

with mailslurp_client.ApiClient(configuration) as api_client:
    inboxController = InboxControllerApi(api_client)
    result = inboxController.create_inbox_with_defaults()

Wait for email

GET /waitForLatestEmail

Fetch inbox's latest email or if empty wait for an email to arrive

Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox set `unreadOnly=true` or see the other receive methods such as `waitForNthEmail` or `waitForEmailCount`.

Request, parameters, and responses

Query parameters

NameTypeRequiredDescription
inboxIdstring:uuidNoId of the inbox we are fetching emails from
timeoutinteger:int64NoMax milliseconds to wait
unreadOnlybooleanNoOptional filter for unread only.
beforestring:date-timeNoFilter for emails that were before after the given timestamp
sincestring:date-timeNoFilter for emails that were received after the given timestamp
sortenum: ASC | DESCNoSort directionValues: ASC, DESC
delayinteger:int64NoMax milliseconds delay between calls

Responses

StatusSchemaDescription
200EmailOK
HTTP and SDK snippets

HTTP

HTTP
GET /waitForLatestEmail?inboxId=00000000-0000-4000-8000-000000000000&timeout=value&unreadOnly=true HTTP/1.1
Host: api.mailslurp.com
x-api-key: YOUR_API_KEY
Accept: application/json

cURL

cURL
curl -X GET "https://api.mailslurp.com/waitForLatestEmail?inboxId=00000000-0000-4000-8000-000000000000&timeout=value&unreadOnly=true" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json"

JavaScript SDK

JavaScript SDK
import { Configuration, WaitForControllerApi } from "mailslurp-client";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });
const waitForController = new WaitForControllerApi(config);
const request = {
  "inboxId": "00000000-0000-4000-8000-000000000000",
  "timeout": null,
  "unreadOnly": true
};

const result = await waitForController.waitForLatestEmail(request);

Python SDK

Python SDK
import mailslurp_client
from mailslurp_client.api.wait_for_controller_api import WaitForControllerApi

configuration = mailslurp_client.Configuration()
configuration.api_key["x-api-key"] = "YOUR_API_KEY"

with mailslurp_client.ApiClient(configuration) as api_client:
    waitForController = WaitForControllerApi(api_client)
    result = waitForController.wait_for_latest_email(inbox_id="00000000-0000-4000-8000-000000000000", timeout=NaN, unread_only=True)

Extract content

POST /emails/{emailId}/contentMatch

Run regex against hydrated email body and return matches

Executes a Java regex pattern over hydrated email body text and returns the full match plus capture groups. Pattern syntax follows Java `Pattern` rules.

Request, parameters, and responses

Path parameters

NameTypeRequiredDescription
emailIdstring:uuidYesID of email to match against

Request body (required)

ContentMatchOptions application/json
FieldTypeRequiredDescription
patternstringYesJava style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See htt...
Request example
{
  "pattern": "value"
}

Responses

StatusSchemaDescription
200EmailContentMatchResultOK
HTTP and SDK snippets

HTTP

HTTP
POST /emails/00000000-0000-4000-8000-000000000000/contentMatch HTTP/1.1
Host: api.mailslurp.com
x-api-key: YOUR_API_KEY
Accept: application/json
Content-Type: application/json

{
  "pattern": "value"
}

cURL

cURL
curl -X POST "https://api.mailslurp.com/emails/00000000-0000-4000-8000-000000000000/contentMatch" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  --data '{"pattern":"value"}'

JavaScript SDK

JavaScript SDK
import { Configuration, EmailControllerApi } from "mailslurp-client";

const config = new Configuration({ apiKey: "YOUR_API_KEY" });
const emailController = new EmailControllerApi(config);
const request = {
  "emailId": "00000000-0000-4000-8000-000000000000",
  "contentMatchOptions": {
    "pattern": "value"
  }
};

const result = await emailController.getEmailContentMatch(request);

Python SDK

Python SDK
import mailslurp_client
from mailslurp_client.api.email_controller_api import EmailControllerApi

configuration = mailslurp_client.Configuration()
configuration.api_key["x-api-key"] = "YOUR_API_KEY"

with mailslurp_client.ApiClient(configuration) as api_client:
    emailController = EmailControllerApi(api_client)
    content_match_options = {
      "pattern": "value"
    }
    result = emailController.get_email_content_match("00000000-0000-4000-8000-000000000000", content_match_options)

Reliability tips

  • Create a fresh inbox per run to avoid cross-test message collisions.
  • Use bounded timeouts and branch on timeout/failure conditions.
  • Keep API keys in environment/connection secrets, not inline flow steps.
  • Add retries only for transient failures, not for invalid input errors.