---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/api/errors/21401#article
headline: "21401: Invalid Phone Number"
url: https://www.twilio.com/docs/api/errors/21401
inLanguage: en
dateModified: 2026-06-09T11:00:42.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# 21401: Invalid Phone Number

Log Type: APPLICATION

Log Level: ERROR

## Description

You received this error when the sender you provided for an outbound SMS request is not valid. The `From` value must be a Twilio-hosted sender that belongs to your account. If you use a phone number, use a Twilio number that you purchased from or ported to Twilio in `E.164` format. If you use an alphanumeric sender ID, it must meet Twilio formatting requirements and be used only in supported countries.

### Possible causes

* You passed a `From` phone number that is not purchased from or ported to Twilio.
* You passed the `From` phone number in a format other than `E.164`.
* You used an alphanumeric sender ID for a destination where alphanumeric sender IDs are not supported, including the United States or Canada.
* Your alphanumeric sender ID does not meet sender ID requirements. For example, it is longer than 11 characters, uses unsupported characters, or contains only digits.
* You sent with `From` instead of `MessagingServiceSid`, and the sender you provided is not available to the account that is creating the message.

### Possible solutions

* Update `From` to a valid Twilio sender that belongs to the account sending the message.
* Format phone numbers in `E.164`, for example `+14155552671`.
* Buy a Twilio phone number or port an existing number to Twilio before using it as a sender.
* If you use an alphanumeric sender ID, confirm that the destination country supports it and complete registration when required.
* Keep alphanumeric sender IDs to 11 characters or fewer and include at least one letter.
* If you use a Messaging Service, send with `MessagingServiceSid` so Twilio can select a sender from your Sender Pool, or specify only a sender that is already in that pool.

#### Additional resources

* [Messages resource](/docs/messaging/api/message-resource)
* [Phone Numbers](/docs/phone-numbers)
* [Alphanumeric Sender IDs](/docs/numbers-and-senders/alphanumeric-senders)
