Sending
Phone numbers and country detection
Write numbers in E.164: a plus sign, the calling code and the national number without its trunk prefix, 7 to 15 digits in total. +14155550123, +447400123456 and +4915123456789 are all E.164.
Cleaning
- Spaces, dots, dashes, slashes and brackets are removed:
+44 (0)7400-123 456is not valid because of the (0), but+44 7400-123 456is. - A leading
00becomes+:004915123456789reads as+4915123456789. - Digits without a plus are read as international:
14155550123becomes+14155550123. Store numbers with their calling code. - Numbers that are still not + and 7 to 15 digits are set aside as
invalid_number. - The same number twice in one request is sent once; the second copy is set aside as
duplicate.
Country detection
Each number is priced by the country it belongs to, read from the longest matching calling code. Some calling codes are shared, and the API tells those countries apart by prefix:
| Calling code | How it is split |
|---|---|
| +1 | By area code: the Canadian codes price as Canada, Caribbean codes (809, 829, 849 Dominican Republic, 876 and 658 Jamaica, 787 and 939 Puerto Rico and the rest) price as their island, all other +1 numbers as the United States. |
| +44 | Guernsey (7781, 7839, 7911), Jersey (7509, 7700, 7797, 7829, 7937) and the Isle of Man (7524, 7624, 7924) mobile prefixes price as those islands; the rest as the United Kingdom. |
| +7 | +7 6 and +7 7 price as Kazakhstan, the rest as Russia. |
| +262 | +262 639 and +262 269 price as Mayotte, the rest as Reunion. |
| +39 | Italy, including Vatican City lines. |
The matched country is in the country field of every message, so you can check how a number was priced.