Get Instant Solutions for Kubernetes, Databases, Docker and more
Twilio is a cloud communications platform that enables developers to programmatically send and receive SMS, make and receive phone calls, and perform other communication functions using its web service APIs. It is widely used in applications that require reliable and scalable communication solutions.
When using Twilio's SMS API, you might encounter the error code 21411. This error indicates that there is an issue with the phone number you are trying to send an SMS to.
While attempting to send an SMS, the operation fails, and you receive an error message stating: "The 'To' phone number is not a valid toll-free number."
Error 21411 occurs when the 'To' phone number provided in your API request is not recognized as a valid toll-free number. Twilio requires that toll-free numbers adhere to specific formats and regulations.
This error is typically caused by formatting issues or using a number that is not registered as toll-free. Toll-free numbers usually start with specific prefixes like 800, 888, 877, 866, 855, 844, or 833 in the United States.
To resolve Error 21411, follow these steps:
Twilio provides a Lookup API to verify phone numbers. Use this API to confirm that the number is valid and toll-free:
curl -X GET 'https://lookups.twilio.com/v1/PhoneNumbers/{PhoneNumber}?Type=carrier' \
--user 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
For more information on handling Twilio errors, visit the Twilio API Errors Documentation. To learn more about toll-free numbers, check out the Twilio Toll-Free Numbers Guide.
(Perfect for DevOps & SREs)
Try Doctor Droid — your AI SRE that auto-triages alerts, debugs issues, and finds the root cause for you.