Try it live
Feel it in 30 seconds. No signup.
Click the button and get a real inbox address. Send any email with a code to that address, and watch wait_for_otp extract the OTP live.
Your test address
Send any email with a code to this address, then watch the panel below. No email handy?
Live wait_for_otp
Calling wait_for_otp (long-poll, timeout=25s)…
- OTP
- —
- From
- —
- Context
- —
- Provider
- —
Next step
Run the same wait from your own test or agent. Free plan, no card: your first inbox is created when you verify your email, and the dashboard gives you a ready-to-run snippet with your key.
The same call with your own key
The demo above uses a short-lived demo inbox. With your own API key and inbox, the equivalent call is:
curl
# remember the newest message id (0 if the inbox is empty) BEFORE
# you send the code, so a fast email still matches (needs jq)
SINCE=$(curl -s "https://dash.mailsocket.app/api/v1/inboxes/inbox_xxx/messages/latest" \
-H "Authorization: Bearer $MAILSOCKET_API_KEY" | jq -r '.data.id // 0')
# send a code to your inbox, then wait up to 25s (204 = call again)
curl "https://dash.mailsocket.app/api/v1/inboxes/inbox_xxx/messages/wait?require=otp&since=${SINCE:?no cutoff, install jq and rerun the first line}&timeout=25" \
-H "Authorization: Bearer $MAILSOCKET_API_KEY"
When you're ready, Start free to keep an inbox, create an API key, and use wait_for_otp in your tests. The demo inboxes here are short-lived and cleared automatically.