Switchmast

Twilio error 21606: 'From' is not a valid message-capable number

Updated

Short answer

21606 means the sender in From isn't a message-capable Twilio sender for the account making the request. Usually the number belongs to another account or subaccount, has no SMS capability, isn't in E.164, or is a short code sending abroad. Check the number's account and capabilities in the Console, or send through a Messaging Service.

What Twilio says it means

Twilio's error reference names 21606 'From' number is not a valid message-capable Twilio number for this account, log type APPLICATION, level ERROR. You can only send from a sender your account is allowed to use for messaging:

Common causes, most likely first

  1. Wrong account. The number is on a subaccount and you're using the parent's credentials, or the other way round. The API key or Auth Token must belong to the account that owns the number.
  2. The number can't send SMS. Some numbers are voice-only, so their SMS capability is off.
  3. From isn't in E.164. 4155552671 instead of +14155552671.
  4. Porting or hosting isn't finished for a number you're bringing to Twilio.
  5. A short code sending to another country. Short codes only reach recipients in their own country.
  6. An Alphanumeric Sender ID used in a country that doesn't support it, or that needs pre-registration you haven't completed.
  7. Test credentials with a live From number.

How to check and fix it

  1. Read the error response. Twilio returns code 21606 with a more_info link. Note the exact From value and the Account SID in the request URL (/2010-04-01/Accounts/{AccountSid}/Messages.json).
  2. Find the number on that account. List IncomingPhoneNumbers.json for the same Account SID with PhoneNumber=+1… as a filter. No result means the number lives on another account or subaccount.
  3. Check capabilities. The number's capabilities object has sms, mms and voice flags. If sms is false, the number can't send texts; use or buy one that can. The Console's phone number pages show the same information.
  4. Fix the format: E.164, such as +14155552671.
  5. Ported or hosted number? Wait for provisioning to finish before sending.
  6. Short code or sender ID? Send only to the short code's country, and only use alphanumeric sender IDs where they're supported and registered.
  7. Testing? With test credentials, use +15005550006 as From.

How to prevent it

CodeMeaning
21211The To number is invalid, or To and From are the same number
21408The destination country is disabled in Geo Permissions
21614The To number isn't a mobile number
30007The message was sent but filtered by Twilio or the carrier

How Switchmast helps

Switchmast on iPhone showing one Twilio number's capabilities, webhooks and Messaging Service
One number's details in Switchmast, on sample data.

Switchmast's number screen shows each number's capabilities (Voice, SMS, MMS) and the Messaging Service it belongs to, and its account switcher moves between the subaccounts your key can see. That answers "is this number on this account, and can it text?" from your phone in a few taps. More codes are on the Twilio error codes hub.

Questions

What does Twilio error 21606 mean?

'From' number is not a valid message-capable Twilio number for this account. The sender in your From parameter isn't one your account can send messages from, or it can't send to that destination.

Which senders can I use in From?

An SMS-capable Twilio number on the same account or subaccount as your credentials, a hosted or ported number once provisioning is finished, an Alphanumeric Sender ID in a country that supports it, or a short code sending within its own country.

Why do I get 21606 with test credentials?

Test credentials can't send from your real numbers. Use the magic test number +15005550006 as From when testing with test credentials.

My number is on the account. Why still 21606?

Check that the API key or Auth Token belongs to the same account or subaccount as the number, that the number has SMS capability, and that From is in E.164 format. A short code sending to another country also returns 21606.

Sources