SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Error 20003 and HTTP 401 Unauthorized Error

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.

  1. Identify Legacy Endpoints: Search your codebase or configuration files for any hardcoded references to regional domains such as:
    • api.ie1.twilio.com
    • api.au1.twilio.com
    • api.br1.twilio.com
    • api.de1.twilio.com
    • api.jp1.twilio.com
    • api.sg1.twilio.com
    • api.us2.twilio.com

       

  2. Update to Valid Domains: Replace legacy endpoints with the standard global endpoint or the new regional format. Note that api.us1.twilio.com remains valid for US-based traffic.
     
  3. Update Helper Library Configurations: If using a Twilio SDK, ensure you are setting both edge and region  parameter.
     

    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 region parameter without the edge parameter routes requests to US1, not the specified region. Always specify both edge and region parameters together for regional processing.

     

  4. Verify Credentials: Double-check that your Account SID and Auth Token are correctly copied from the Twilio Console.
  5. Test the Migration: Run a simple GET request to the Accounts endpoint to confirm the 401 error is resolved.
Have more questions? Submit a request
Powered by Zendesk