Issue
When using Twilio’s Voice Routing API to query the inbound processing region for a phone number, you may encounter an HTTP 404 error with Twilio error code 20404. This article explains why this occurs, what it means for your phone number’s configuration, and how to verify or set the inbound processing region.
Product
- Twilio programmable Voice
- Twilio Phone Number
Environment
Twilio REST APIs
Cause
- You purchased a phone number via the Twilio Console.
- You attempt to fetch its routing configuration using the Voice Routing API:
GET https://routes.twilio.com/v2/PhoneNumbers/%2B{E.164}- The API returns:
- HTTP 404
- Twilio error 20404: "The requested resource /PhoneNumbers/{E.164} was not found"
Twilio phone numbers do not always have an explicit inbound Voice Region routing configuration set. If a routing configuration has not been explicitly set (either via API or Console), the Routing API will return a 404/20404 error. In this case, inbound voice traffic defaults to the US1 region.
This behavior applies even to numbers purchased through the Console. The absence of a routing configuration object is expected unless you have manually set the region.
Resolution
How to Check the Current Region
-
API Method:
Attempt a GET request to the Routing API for your phone number.- If you receive a 404/20404, the region defaults to US1.
- If you receive a valid response, the region is explicitly set.
-
Console Method:
You can view and set the inbound processing region in the Twilio Console under the phone number’s configuration.
How to Set the Inbound Processing Region
- API Example:
curl -X POST "https://routes.twilio.com/v2/PhoneNumbers/%2B18001234567" \ --data-urlencode "VoiceRegion=au1" \ -u $TWILIO_API_KEY:$TWILIO_API_SECRET
- Changes may take up to 5 minutes to take effect.
-
Console Example:
Navigate to the phone number in the Console and select the desired region.
Key Takeaways
- A 404/20404 error from the Routing API means no explicit region is set; inbound calls default to US1.
- This is expected for numbers without a manual region configuration, regardless of purchase method.
- You can set or verify the region via API or Console.
- No changes are made to your configuration unless you explicitly set the region.