Error in Importing the Phone Number
# support
a
Couldn't Get Twilio Number. Twilio Error: Authentication Error - invalid username. I am trying to import a Twilio number for my client, and am getting this error for some reason. They have upgraded the account and we have checked with 2 numbers but to no avail. How can I fix this?
v
Thanks for sharing the error details. To help troubleshoot, can you confirm whether you are entering your Twilio credentials as the Account SID and Auth Token, or are you using the newer API Key and API Secret method as recommended in the latest Vapi documentation? Sources: - [Vapi Documentation: Import Twilio Number](https://docs.vapi.ai/quickstart/import-twillio) - [Vapi Changelog: Twilio Authentication Using API Keys](https://docs.vapi.ai/changelog/2025/4/27)
a
The first option, I'm trying to import via the Vapi UI @User
@Vapi Support Bot The first option, I'm trying to import via the Vapi UI
v
Suggestion: To resolve the Twilio authentication error, switch to using your Twilio API Key and API Secret (instead of Account SID and Auth Token) when importing the number in the Vapi UI. This is now the recommended method and should fix the "invalid username" issue. You can generate these credentials in your Twilio Console under "API Keys & Tokens". [See the latest Vapi changelog for details.](https://docs.vapi.ai/changelog/2025/4/27) Source: - [Vapi Changelog: Twilio Authentication Using API Keys](https://docs.vapi.ai/changelog/2025/4/27)
a
@Vapi Support Bot But why don't I see these headings in the UI? The change was 4 months back
v
If you don't see the "API Key" and "API Secret" fields in the Vapi UI when importing your Twilio number, try the following: - Refresh the page or clear your browser cache to ensure you have the latest UI update. - If the fields are still missing, contact Vapi support directly, as the UI may not have rolled out to all users or there could be a display issue. This change is confirmed in the [Vapi changelog](https://docs.vapi.ai/changelog/2025/4/27), but UI updates can sometimes lag behind documentation. Source: - [Vapi Changelog: Twilio Authentication Using API Keys](https://docs.vapi.ai/changelog/2025/4/27)
a
@Vapi Support Bot I tried using api key api secret and all other relevant details for creating a number via an HTTp request but still the same 400 invalid username error
v
Thanks for the update. To help diagnose the "400 invalid username" error, could you please confirm the exact API endpoint and the JSON payload (with sensitive info redacted) you are using for the HTTP request? Source: - [Vapi Changelog: Twilio Authentication Using API Keys](https://docs.vapi.ai/changelog/2025/4/27)
a
@Vapi Support Bot a post to this: https://api.vapi.ai/phone-number with this JSON body: { "provider": "twilio", "number": "", "twilioAccountSid": "", "twilioApiKey": "", "twilioApiSecret": "" }
v
Double-check that your
twilioAccountSid
matches the Account SID associated with your API Key, and that both the API Key and API Secret are active in your Twilio Console.
Here’s the correct payload structure for importing a Twilio number:
Copy code
json
{
  "provider": "twilio",
  "number": "+1XXXXXXXXXX",
  "twilioAccountSid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "twilioApiKey": "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "twilioApiSecret": "your_api_secret"
}
Ensure there are no extra spaces or typos in any field. If the error persists, regenerate your API Key/Secret in Twilio and try again. [See the latest Vapi changelog for details.](https://docs.vapi.ai/changelog/2025/4/27) Source: - [Vapi Changelog: Twilio Authentication Using API Keys](https://docs.vapi.ai/changelog/2025/4/27)
c
Please follow the instructions above to import your Twilio number from your account into VAPI. Let us know if you run into any issues
a
Hey Kyle, I tried the UI method (SID + Auth Token) as well as the HTTP request. But I can't seem to be able to import my client's twilio number over to my VAPI account.
c
Could you please send a loom screen recording to @kylevapi showing the issue with phone number import from twilio?
a
Hey Kyle, I'm unable to record a loom doing this, as this will expose my client's sensitive info. But I can share the error popup within the UI as well. Hope this helps, and thanks for understanding. https://cdn.discordapp.com/attachments/1418423469040861256/1420654138273959956/691fa496c2af4587b8944d1ceedb089adc58de505e404051a346c9a7c979cfb3.png?ex=68d62ec5&is=68d4dd45&hm=a23d43b5768c754a38f026524d267ca29cf9009c3c3cf449077b02e098bd4876&
c
Please ensure that the Twilio API key has sufficient permissions to access the phone number and that the key is accurately typed in
3 Views