Twilio 401 in n8n: Error 20003 "invalid username" vs "No credentials provided" vs "No password provided"
Twilio returns error 20003 for every bad login, but the message changes. Fake-credential tests show what each wording means, plus an n8n checklist.
Short answer: Twilio uses the same error code, 20003, for almost every authentication failure, so the code tells you nothing. The message does. I sent read-only requests to the Twilio REST API with made-up credentials and recorded which message appeared in each case. No real Account SID or Auth Token was used, and nothing was sent or changed.
The messages I got
| What I sent | HTTP | message |
|---|---|---|
| No credentials at all | 401 | Authentication Error - No credentials provided |
| Empty username and empty password | 401 | Authentication Error - No credentials provided |
| A username but an empty password | 401 | Authentication Error - No password provided |
| A username and a password, both made up | 401 | Authentication Error - invalid username |
An Authorization: Bearer header instead of Basic auth | 401 | Authenticate |
Every body also had "code":20003 and "more_info":"https://www.twilio.com/docs/errors/20003". The response header was WWW-Authenticate: Basic realm="Twilio API", both with and without credentials.
What I tested
On November 13, 2026 I sent GET https://api.twilio.com/2010-04-01/Accounts.json (a read-only list call) with invented values. In the table below, "SID-shaped" means AC followed by 32 characters, which is 34 characters in total.
| Username sent | Result |
|---|---|
SID-shaped (AC + 32), any made-up password | "invalid username" |
| Same SID, short password versus a 32-character password | "invalid username" both times |
Wrong prefix (XX + 32) | "invalid username" |
API-key-shaped (SK + 32) | "invalid username" |
Too short (AC1234) or one character too long (35) | "invalid username" |
| A leading space in the username | "invalid username" |
| SID-shaped, empty password | "No password provided" |
- "invalid username" only means Twilio does not recognize the username. A made-up SID in perfect shape, a wrong prefix, a wrong length and a leading space all got the same message. So the message does not tell you whether your Account SID has a typo or whether it belongs to a different project.
- I could not see what a wrong password looks like. Because my usernames never existed, Twilio never got far enough to judge the password. The message for a real Account SID with a wrong Auth Token needs a real SID, which I did not use.
- "No password provided" meant the password was empty. In n8n that is what you would expect to see if the Auth Token field resolves to nothing, for example a credential saved with the token left blank. I did not test this inside n8n.
- The same messages appeared on other endpoints and hosts. A messages-list path under a made-up account, the Lookups v2 host, and the Ireland region host (
api.dublin.ie1.twilio.com) all returned "invalid username" for the made-up credentials. - A path that does not exist returned 404 before authentication was checked.
/2010-04-01/nonexistent.jsonreturned 404 with error code 20404 whether or not I sent credentials. A 404 therefore says nothing about your credentials.
What the docs say
The Twilio error 20003 page is titled "Permission Denied", even though the API responses I saw were 401 and said "Authentication Error". It lists many causes. The ones that matter most for an n8n user are that the Account SID and Auth Token do not match, the token was deleted or rotated, the credentials contain extra characters or spaces, test credentials were used on a live resource, subaccount credentials were used on the wrong account, a Standard API key was used on an endpoint that needs a Main API key such as /Accounts, the key was created in a different Twilio region than the request, the account is suspended or closed, or a proxy stripped the Authorization header.
The n8n Twilio credentials page says the credential has an Auth Type setting. Auth Token uses the Account SID as the username and the Auth Token as the password, and Twilio suggests it only for local testing. API Key uses the Account SID plus an API Key SID and Secret, which Twilio recommends for production. When creating the key, n8n says to choose Main or Standard, and that the Restricted type (in beta) is untested.
Checklist when you see 20003 in n8n
- Read the message, not the code. "No credentials provided" and "No password provided" mean the request carried nothing or an empty password, so check that the credential is selected on the node and that no field is blank.
- "invalid username": Twilio does not know that username. Check the Account SID (or API Key SID) for a typo, a copied space or line break, or a SID from another project. My tests could not separate these causes.
- Auth Type must match what you pasted. If the credential is set to API Key, the SID field expects the API Key SID and the secret, not the Account SID and Auth Token. I did not test this mismatch, so I do not know which message it produces.
- Endpoint and key type. The docs say a Standard API key cannot call endpoints such as
/Accounts, and that a key made in one region may not work against another. I could not test either with a real key. - Account state. The docs list a suspended or closed account as a cause. That is the one to check in the Twilio console if everything else looks right.
- Never paste real tokens into a public forum. The messages above are safe to share. The SID and token are not.
The same kind of split between "missing" and "invalid" shows up in other APIs. I wrote up Stripe API 401 and SendGrid API 401 from the same kind of fake-key tests.
What I did not test
- No real Twilio credentials were used. I did not see a successful response, a wrong Auth Token on a real Account SID, a deleted or rotated token, a Standard-versus-Main key error, a subaccount error, a suspended-account error, or a test-credentials error.
- Only read-only GET requests were sent, mostly to
/Accounts.json. I did not send an SMS, a call, or any POST request. - I did not test inside n8n. All requests were made with curl, so I cannot say how n8n displays these errors.
- I did not test OAuth bearer tokens beyond one fake Bearer header.
- This is one day of observation, and Twilio can change its messages.
Sources: Twilio error 20003 and n8n Twilio credentials. Tables and message wording are from my own requests on November 13, 2026.
Updated: Nov 13, 2026
Loading comments…