Test inputs for SMS

You can use your test credentials to send test SMS messages without charging your account or actually sending an SMS.

Send a POST request to the SMS API endpoint using your test credentials to authenticate and your TestAccountSid in the URL as seen below:

POST https://api.twilio.com/2010-04-01/Accounts/{TestAccountSid}/Messages

Parameters

All the existing outbound SMS parameters will work, except for MessagingServiceSid. In addition, we provide some specific values for certain parameters to help you generate success and failure cases.

From

Your test credentials don't have access to any valid From phone numbers on your real account. Therefore, the only phone numbers you should use as From numbers are the magic numbers listed below:

ValueDescriptionError Code
+15005550001This phone number is invalid.21212
+15005550007This phone number is not owned by your account or is not SMS-capable.21606
+15005550008This number has an SMS message queue that is full.21611
+15005550006This number passes all validation.No error
All OthersThis phone number is not owned by your account or is not SMS-capable.21606

To

ValueDescriptionError Code
+15005550001This phone number is invalid.21211
+15005550002Twilio cannot route to this number.21612
+15005550003Your account doesn't have the international permissions necessary to SMS this number.21408
+15005550004This number is blocked for your account.21610
+15005550009This number is incapable of receiving SMS messages.21614
All OthersAny other phone number is validated normally.Input-dependent

Use the API playground in this page to test each magic number.

Encoding-type

The body parameters must be encoded using the application/x-www-form-urlencoded encoding type. This means that the request headers must use this encoding-type for the content-type field. Here is an example below:

content-type: application/x-www-form-urlencoded.