Twilio's API has some very basic phone number validation logic built in. We try to save you money by rejecting messages to numbers we are certain are incorrect. However, we trust that our users know more about the phone number they are trying to send a message to than we do. Our validation logic will only affect numbers which are unquestionably incorrect. It is your responsibility to provide accurate data.
Checking to see if the "To" number is potentially reachable
When you make a POST request to Twilio's REST API, Twilio will check the validity of the "To" phone number in the request. If Twilio discovers that the "To" phone number provided cannot possibly exist, Twilio will respond to your API request with an HTTP 400 response and flag your project with Error 21211. If there is a possibility that the phone number exists, Twilio will hand the message off to the carrier, and the message will be recorded in the SMS logs with a status of
Checking to see if the "To" number is a mobile number
Depending on the country, we may do an extra check to confirm that the "To" number is capable of receiving SMS messages.
Countries with a defined "Mobile Range": Most countries have a well defined "mobile range". Numbers within this range are almost always mobile numbers. When an API request is made to send an SMS to a number outside of this range, Twilio will respond with an HTTP 400 status and error 21614.
Countries without a defined "Mobile Range": In countries without a "mobile range," like the United States, Canada and most Caribbean nations, Twilio will attempt to send SMS messages from long code or Toll-Free numbers to any phone number in these countries. However, attempts to send from a Twilio short code number to a landline number will result in a 400 response to the API request with error 21614.
We recommend that your opt-in process also collect the phone type, and you should only be sending SMS messages to opted-in users who want to receive your messages.
Finally, a great tool to make sure that your number is valid is the free online Twilio Lookup tool. This simple tool will help validate any phone number to make sure it is correctly formatted to send or receive calls as well as other details such as carriers. Additionally, the Lookup Tool is also available as a part of Twilio’s API (which will incur a cost). Learn more about the Lookup API here.