Twilio will not charge you for a message if your API request returns an HTTP error, or if the message status on Twilio is "failed." Twilio will charge you for messages where delivery was attempted. Read on for details.
Delivery attempts
Twilio will charge you for a message if delivery was attempted, i.e. the message status is "sent," "delivered," "undelivered," or "delivery unknown." For more details on possible message statuses, see
What are the Possible SMS and MMS Message Statuses, and What do They Mean?
In some cases, messages may be sent from Twilio to the carrier, but are not received at the end user's handset. Check out our SMS troubleshooting guide for detailed troubleshooting steps.
API-level errors (HTTP response errors)
If you make an API request to Twilio to send a message, and Twilio returns an HTTP response error (for example, an HTTP 400), this means that Twilio was unable to process your request. You will not be charged for failed API requests.
API requests to Twilio may fail for a variety of reasons, usually due to something malformed or incorrect in your API request. A few examples of API-level errors include: an invalid To number, your SMS Geo-Permissions not being enabled for the country you are attempting to send to, or a user who has previously unsubscribed from your messages. API level errors are typically in the 2XXXX error range (e.g. 21612). Check out the error and warning code reference page to learn more.
"Failed" messages
A message that is marked with the status "failed" did not leave Twilio and you will not be charged. "Failed" messages can happen for various reasons including queue overflows, account suspensions and media errors (in the case of MMS).
A note about WhatsApp and other non-SMS channels
Messaging channels other than SMS and MMS may have slightly different billing behavior. For example, undelivered WhatsApp messages are not charged. Refer to the pricing documentation for the messaging channel you are using for more information.