diff --git a/fern/phone-numbers/import-twilio.mdx b/fern/phone-numbers/import-twilio.mdx index bcf9404fb..2d76b93ba 100644 --- a/fern/phone-numbers/import-twilio.mdx +++ b/fern/phone-numbers/import-twilio.mdx @@ -1,12 +1,12 @@ --- title: Import number from Twilio -subtitle: Import a new or existing number from Twilio +subtitle: Import a new or existing number from Twilio using API Keys slug: phone-numbers/import-twilio --- ## Overview -As you scale your agents, you may want to use other telephony providers, like Twilio. In this guide, you'll learn how to add a new or existing Twilio number to Vapi. +As you scale your agents, you may want to use other telephony providers, like Twilio. In this guide, you'll learn how to add a new or existing Twilio number to Vapi using a Twilio API Key (recommended) instead of an Auth Token. Restricted API Keys are supported and preferred for least‑privilege access. ## Prerequisites @@ -15,35 +15,76 @@ As you scale your agents, you may want to use other telephony providers, like Tw ## Get started - + If you don't have a Twilio number, purchase one in your Twilio console's "Buy a number" section. - - In your Twilio console, go to "API keys & tokens" to find your Account SID and Auth Token. - + + Use a Restricted API Key for least‑privilege access. You'll provide this key to Vapi when importing your number. + Restricted keys are available to all Twilio users—no access request needed. + + 1. In the Twilio console, open API keys & tokens and click Create new API key. + - + + 2. Give the key a friendly name and choose Restricted (Beta) as the type. + 3. Grant the following permissions: + + - Voice → Calls: Read, List, Create, Update, Delete + - Voice → Conferences: Read, List, Create, Update, Delete + - Phone Numbers → Active Numbers: Read, List, Create, Update, Delete + + + + + + + + + 4. Click Create, then securely copy the API Key SID and Secret. + The Secret is shown only once. Store it in a secure location. + + + - - 1. Go to the "Phone Numbers" section in Vapi and click "Import". + + 1. Go to the Phone numbers section in Vapi and click Import. - 2. Enter your phone number and Twilio credentials, then click "Import". + 2. Enter your phone number, Twilio Account SID, API Key SID, and API Secret, then click Import. - - You can use the number with an assistant for inbound or outbound calls. + + Use the API to import your Twilio number programmatically using your API Key SID/Secret. + +```bash title="Import Twilio number with API Key" +curl -X POST https://api.vapi.ai/phone-number \ + -H "Authorization: Bearer " \ + -H "Content-Type: application/json" \ + -d '{ + "provider": "twilio", + "number": "+15551234567", + "twilioAccountSid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "smsEnabled": false, + "twilioApiKey": "SKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "twilioApiSecret": "" + }' +``` + + + You can now use the number with an assistant for inbound or outbound calls. - \ No newline at end of file + + +If you previously imported numbers using an Auth Token, you can continue doing so. However, using a Restricted API Key is recommended for better security and tighter scope. \ No newline at end of file