Wait for Message
Long-poll for the newest message matching the supplied filters.
Long-poll for the newest message matching the supplied filters.
Scope: email_testing.messages.read
Request Body
timeout_msintegeroptionalHow long to wait for a matching message, in milliseconds. Defaults to 20,000 (20 seconds), up to 40,000. If nothing arrives in time, the response is 204 No Content.
mailbox_idstringoptionalOnly wait for messages that arrive in this test inbox.
credential_idstringoptionalOnly wait for messages sent through this SMTP sink credential. Use the id from List SMTP Sink Credentials. Handy when parallel CI jobs each use their own credential.
recipientstringoptionalOnly match messages sent to exactly this recipient address.
senderstringoptionalOnly match messages from exactly this sender address.
subject_containsstringoptionalOnly match messages whose subject contains this text.
header_namestringoptionalOnly match messages that have this header, for example X-Test-Run. Combine with header_value to match its value too.
header_valuestringoptionalOnly match messages where the header named in header_name has this value, for example the ID of your CI run.
received_afterstringoptionalOnly match messages received after this time, as an RFC 3339 timestamp such as 2025-01-01T12:00:00Z. Set it to when your test started, so emails from earlier runs are ignored.
Sample Request
curl -X POST "https://api.maileroo.com/v1/email-testing/wait/messages" \
-H "Authorization: Bearer roo_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"mailbox_id":"35a3cb89-ea59-4ea3-8edc-a5c5f7bf0bda","subject_contains":"Verify","timeout_ms":40000}'Sample Response
The response is wrapped in a data object.
{
"data": {
"id": "d5949378-3069-4d8f-a8f3-6e5edf5d6060",
"mailbox_id": "35a3cb89-ea59-4ea3-8edc-a5c5f7bf0bda",
"subject": "Verify",
"received_at": "2025-01-01T12:00:00Z"
}
}If no matching message arrives before the timeout, the response is 204 No Content with an empty body.