A one-time passcode autofills when the text follows the format the phone expects and the input field is marked as a code field. On iOS, that means a recognizable code, ideally with a domain-bound last line. On Android, it means either the SMS User Consent prompt or an app-hash message for the SMS Retriever. Get the text and the field right and users skip typing the code.
This post covers the message side. For the sending side, see our SMS OTP and verification API guide.
The iOS format
iOS reads codes from incoming texts and offers them above the keyboard when the field is marked as a one-time code. In an app, set the field's content type to one-time code. On the web, use the autocomplete="one-time-code" attribute on the input.
To tie a code to a site, Apple supports a domain-bound format. The code line stays readable, and the last line names the domain and repeats the code:
123456 is your Example App code.
@example.com #123456 A domain-bound code is offered only on the site it names, which helps against phishing. Check Apple's current documentation for the exact rules, since they change.
The Android formats
Android has two paths:
- SMS User Consent. The app asks the user to allow reading one message. The text needs no special format, but the sender must be one the user can recognize.
- SMS Retriever. The app reads a message that starts with a marker and ends with an 11-character hash of your app. Because the app never asks for permission, it's the smoother path. The hash comes from your app's signing key, so generate it with Google's tooling and keep one per build.
For a web app on Android Chrome, the same domain-bound format used on iOS works with the browser's autofill support.
A format that works on all three
| Part | Rule |
|---|---|
| First line | The code and your app name, plain text |
| Code | 4 to 8 digits, no spaces inside |
| Last line | @yourdomain.com #code for domain binding |
| Length | Keep it in one segment |
| Links | None |
Skipping links matters, because OTP texts with URLs get filtered more often.
Watch out for the opt-out footer
Unless the account turns it off, Ready adds "Reply STOP to opt out" and the business name to the first text a contact gets, and again from time to time. If it lands on a code message, it can push your domain line off the end, and the phone won't read it as bound. Test your real message from your own number before launch, on a fresh contact and on a repeat. Verification messages also need a campaign registered for them: see bulk SMS OTP and verification sending rules.
Sending it with Ready
You send the body as written. One call to the messages endpoint with to, body and consent_attested does it, and the docs at docs.tryready.com/api/messages show the request. Use a new Idempotency-Key for each code, since a resend of an undelivered code is a new send. Add a login and verification campaign from Registration once your brand is approved.
A checklist before launch
- The input field is marked as a one-time code.
- The text works on a recent iPhone and an Android phone.
- The code line comes first, the domain line last.
- No links and one segment.
- A footer test on first and repeat sends.
Expiry matters too: keep codes valid for a few minutes, and never reuse one.