Skip to main content
Use a Mobilerun mailbox and an optional phone number to test verification in your own application.
These examples require an active mailbox or number. This walkthrough was not verified end to end: the test account required payment checkout before either resource could be activated. Never log verification codes or use this flow on accounts without permission.

Read an email code

Request a fresh code from a test app you control, then wait for it with mailbox.waitForOtp() (Python wait_for_otp). The API returns the most likely code, not proof that a sign-up succeeded. Needs: A Mobilerun API key and an active mailbox; included mailbox entitlement or paid rental after checkout. Check the displayed checkout price before confirming. No device or third-party account is needed. Set MOBILERUN_API_KEY and MAILBOX_ID. This is a one-shot wait for up to two minutes; message allowance and mailbox rental may apply. Create a mailbox with mobilerun.mailboxes.create() and check that mailbox.status is active (mailbox.refresh() updates it). If it is awaiting_payment, complete checkout from its checkoutUrl before continuing. Reuse the active mailbox ID; do not create a mailbox on every run. Configure your test app to send a code to that mailbox, and trigger it after the script starts. The test app must be able to send real email; this example does not send email itself.
MCP prompt: Find my active test mailbox, wait for a new verification code from my test app, and report only whether a code arrived. Do not disclose the code.

Complete test sign-up verification

The first task requests a code; the script fetches it and starts a second task to enter it. Point the URL at your own test build. The second task assumes the verification form is still open on the same device. Needs: the mailbox from above, plus a ready Cloud Android device with Chrome, device minutes and agent credits; set DEVICE_ID and TEST_SIGNUP_URL to an HTTPS test form reachable by the device. No consumer-service account. One-shot; each task can take up to six minutes, then up to two minutes waiting for the email. Agent task instructions contain the mailbox address and verification code: use only test data and restrict access to task history.

Read an SMS code

Use a number that has already been provisioned. Poll inbound messages after the script starts, looking for a six-digit code. Adapt the expression and filter sender or message content for your own app; an unrelated message may otherwise match. Needs: A Mobilerun API key, an active SMS-capable number, and a test service you control that can send SMS to it. Set MOBILERUN_API_KEY and NUMBER_ID. No device is needed. Number entitlement or rental, checkout, and sender SMS charges may apply; confirm the displayed price. The script polls for up to two minutes; stop early with Ctrl+C. Use mobilerun.numbers.countries() to find available countries, then mobilerun.numbers.create(country=...) (Python) or mobilerun.numbers.create({ country: ... }) (TypeScript). number.waitUntilActive() (Python wait_until_active) returns once the number is active; a paid rental can require checkout. Reuse the number rather than purchasing one on each run. Start the script before triggering your test SMS. SMS delivery and code extraction were not live-tested here.

Run it on many devices

Use a separate test mailbox and device for each parallel sign-up.
These examples run one verification at a time; coordinate separate runs for parallel tests. Needs: A separate ready device and active test mailbox per sign-up ยท device minutes and task credits per run.

Next steps

  • Review the API key guide for mailbox and number endpoints.
  • Use a dedicated test mailbox and number. Release rentals when you no longer need them.
Start with the first example on a ready device the user names. Uses mailbox.waitForOtp, number messages, and optionally device.run. Ask before creating or renting mailboxes/numbers or completing a test sign-up; never purchase resources or use real accounts. Report the result and any failed step.