Vladimir
03/11/2025, 2:03 PMVapi Support Bot
03/11/2025, 2:05 PMbash
curl -X POST https://api.vapi.ai/credential \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "byo-sip-trunk",
"name": "My SIP Trunk",
"gateways": [
{
"ip": "your.sip.provider.ip",
"port": 5060,
"inboundEnabled": true,
"outboundEnabled": true
}
],
"outboundAuthenticationPlan": {
"authUsername": "your_outbound_username",
"authPassword": "your_outbound_password",
"sipRegisterPlan": {
"realm": "your.sip.provider.domain",
"username": "your_register_username",
"domain": "your.sip.provider.domain",
"publicIpInContactEnabled": false
}
}
}'
The response will contain your credential_id
that you'll need for the next step.
## Step 2: Associate a Phone Number with the SIP Trunk
Once you have your credentialId
, you can associate a phone number with it:
bash
curl -X POST https://api.vapi.ai/phone-number \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "byo-phone-number",
"number": "+1234567890",
"numberE164CheckEnabled": false,
"credentialId": "credential_id_from_step_1"
}'
For the number
property, you should use the E.164 format (e.g., "+1234567890") rather than a SIP URI format.
I hope this helps! Let me know if you have any other questions. 😊
Sources:
- [Discord Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341469652366266408)Vapi Support Bot
03/11/2025, 2:05 PMVladimir
03/11/2025, 6:28 PMVladimir
03/11/2025, 6:28 PMVapi Support Bot
03/11/2025, 6:40 PMVladimir
03/11/2025, 6:41 PMVladimir
03/11/2025, 7:21 PMVladimir
03/12/2025, 5:56 AMShubham Bajaj
03/12/2025, 7:57 PMPOST https://api.vapi.ai/phone-number
The key points to remember:
1\. Use provider: "byo-phone-number"
when adding a phone number (not "byo-sip-trunk")
2\. Include the number
field with your phone number (this is required)
3\. The credentialId
must be an existing SIP trunk credential ID
4\. Set numberE164CheckEnabled: false
if you're using a non-E.164 format number (like "123" or "abc")
If you need to create a SIP trunk credential first, use a request like this:
\`\`\`json
{
"provider": "byo-sip-trunk",
"name": "My SIP Trunk",
"gateways": \[
{
"ip": "your.sip.provider.ip",
"port": 5060,
"inboundEnabled": true,
"outboundEnabled": true
}
\]
}
\`\`\`
Make this request to: POST https://api.vapi.ai/credential
The response will give you a credential ID that you can then use in the phone number creation request.
Would you like me to help with any other part of this process?Specialist
03/17/2025, 12:33 AMShubham Bajaj
03/18/2025, 11:16 PMcredentialId
) to identify your credential in Vapi's database
2. Creates an account, API key, application, and trunk in the SIP backend
3. Stores the external reference IDs in a configuration object called sbcAccountConfiguration
When associating a phone number with a SIP trunk, you need to use the id from the SIP trunk credential as the credentialId in your request - not the trunkId from inside the sbcAccountConfiguration.
Here's the correct way to create a BYO phone number:
json
{
"provider": "byo-phone-number",
"number": "+xxxxxxxxxxx", // Your phone number in E.164 format
"numberE164CheckEnabled": false, // Set to false if non-standard format
"credentialId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // The UUID of your SIP trunk credential
}
The credentialId should be the Vapi credential id value, which is the UUID you receive when creating a SIP trunk credential. This is NOT the same as the trunkId inside the sbcAccountConfiguration.
When you create a SIP trunk credential through the API, the response will include an id field - this is the value you need to use as the credentialId when creating a phone number.Shubham Bajaj
03/18/2025, 11:17 PMSpecialist
03/22/2025, 1:28 AM