Issue
If you are seeing failed REST API requests, specifically receiving HTTP 401 Unauthorized errors or Twilio Error 20003—it likely means you are making calls to regional endpoints that have been deprecated or are part of the ongoing domain pattern migration.
These errors usually indicate that your application is still attempting to connect via a legacy URL (like api.ie1.twilio.com) that no longer supports standard authentication for your region.
Product
Twilio REST API
Environment
Twilio Console / External Application Codebase
Cause
Twilio has updated the domain pattern for regional REST API endpoints to improve global infrastructure consistency as listed in our API domain migration guide. As of April 28, 2026, legacy domain patterns such as api.ie1.twilio.com, api.au1.twilio.com, and api.us2.twilio.com are no longer supported. Ensure that your outbound traffic is not restricted by firewalls that only whitelist the old IP ranges.
When an application attempts to authenticate against a deprecated endpoint, the request fails because the regional gateway no longer recognizes the routing or the credentials in that specific context, resulting in an authentication failure even if the Account SID and Auth Token are technically valid.
Resolution
To resolve these errors, you must update your application logic to use the current supported domain patterns.
-
Identify Legacy Endpoints: Search your codebase or configuration files for any hardcoded references to regional domains such as:
api.ie1.twilio.comapi.au1.twilio.comapi.br1.twilio.comapi.de1.twilio.comapi.jp1.twilio.comapi.sg1.twilio.com-
api.us2.twilio.com
-
Update to Valid Domains: Replace legacy endpoints with the standard global endpoint or the new regional format. Note that
api.us1.twilio.comremains valid for US-based traffic.
-
Update Helper Library Configurations: If using a Twilio SDK, ensure you are setting both
edgeandregionparameter.
Python Example:
# Legacy/Incorrect client = Client(account_sid, auth_token, region='ie1') # Updated/Correct client = Client(account_sid, auth_token) # Defaults to global/us1 # SDK initialization (non-US) # Processes in IE1 (requires IE1 credentials and data migration) client = Client( account_sid, auth_token, edge='dublin', region='ie1' )Node.js Example:
// Updated/Correct Defaults to global/us1 const client = require('twilio')(account_sid, auth_token); // SDK initialization (non-US) // Processes in IE1 (requires IE1 credentials and data migration) const twilio = require('twilio'); const client = twilio(accountSid, authToken, { edge: 'dublin', region: 'ie1' });Note: When using any SDK, specifying only the
regionparameter without theedgeparameter routes requests to US1, not the specified region. Always specify bothedgeandregionparameters together for regional processing. - Verify Credentials: Double-check that your Account SID and Auth Token are correctly copied from the Twilio Console.
-
Test the Migration: Run a simple GET request to the
Accountsendpoint to confirm the 401 error is resolved.