🪄 Magic Input

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.