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 that is no longer available, Twilio will return an error.
To write test cases that expect and handle errors that depend on the state of Twilio, we provide magic inputs. Magic inputs allow you to test for both success and error cases.
Check the full list of available magic numbers for the following resources: