Key takeaways
- E.164 is the international format: a plus sign, the country code and the number, with no spaces or punctuation.
- National numbers often start with a zero that must be dropped when you add the country code.
- Format checking and number lookup answer different questions.
- Validate at sign-up, not only when you send.
What E.164 looks like
E.164 is the international numbering standard. A number is written as a plus sign, the country code and the national number, up to 15 digits in total, with no spaces, dashes or brackets. A Danish mobile number becomes +45 followed by its eight digits.
Use this one format everywhere in your database. It is what messaging APIs expect, and it removes guesswork about where a number comes from.
The mistakes that cause most failures
- Keeping the national leading zero after the country code
- Storing numbers as integers, which drops leading zeros and the plus sign
- Letting users type spaces, dashes or brackets and saving them as typed
- Assuming the country from the user’s location instead of asking
- Sending to landlines, which cannot receive text messages
Format check or number lookup?
A library such as libphonenumber can tell you whether a number is plausible for a country and can format it, without any network call. That catches typos and wrong lengths.
A number lookup goes further. It can tell you whether the number is a mobile or a landline and which network it belongs to. Use the first at sign-up and the second where the cost of a failed message or a fraud attempt justifies it.
Where to validate
- In the sign-up form, with a country selector and instant feedback
- On the server, never only in the browser
- Again before large campaigns, to remove numbers that are clearly wrong
- When a number changes, since people also change numbers
How ZafeConnect fits
ZafeConnect offers Numbers Lookup as a product, and its SMS API takes recipient numbers in international format. The API documentation lists the fields and the error responses.