Twilio provides you with a set of test credentials so you can exercise parts of the REST API without charging your account. You can find your credentials in the Auth Tokens page of your Console

You use these credentials in the same way as your live credentials, with one restriction being that you cannot log in to the Twilio CLI with your test credentials. However, when you authenticate with your test credentials, we will not charge your account, update the state of your account, or connect to real phone numbers. You can now pretend to buy a phone number or send an SMS, without actually doing so.

To protect your production data, your test credentials can't interact with the data in your real account. For example, you can't use phone numbers from your real account as the 'From' number in requests made with your test credentials.
.

Resources to Test

Your test credentials can currently be used to interact with the following three resources:

You can test the endpoints with the magic numbers.

Magic Numbers

When you make an API request with your test credentials, Twilio will validate all input as though the request were made with your real credentials. However, there are some cases when a request's validity depends on the state of Twilio. For instance, if you are trying to buy a phone number and that phone number is no longer available, Twilio will return an error.

To write test cases that expect and handle errors which depend on the state of Twilio, we provide magic inputs. For the case mentioned above, there is a magic phone number +15005550000 which if you pass it as the 'PhoneNumber' parameter in a POST to IncomingPhoneNumbers, will always return an error saying the number is unavailable.

The full set of magic inputs is detailed below:

ValueDescriptionError code
+15005550000This phone number is unavailable.21422
+15005550001This phone number is invalid.21421
+15005550006This phone number is valid and available.No error

You can also use the following AreaCode to generate the numbers in particular locations.

ValueDescriptionError code
533This area code doesn't have any available phone numbers.21452
500This area code has an available number.No error