stevechef_
04/02/2025, 5:37 PMVapi Support Bot
04/02/2025, 5:39 PMcurl -X POST https://api.vapi.ai/credential \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-vapi-private-api-key" \
-d '{
"provider": "byo-sip-trunk",
"name": "Telnyx Trunk",
"gateways": [
{
"ip": "sip.telnyx.com"
}
]
}'
2. **Create a Phone Number Associated with the SIP Trunk**:
curl -X POST https://api.vapi.ai/phone-number \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-vapi-private-api-key" \
-d '{
"provider": "byo-phone-number",
"name": "Telnyx SIP Number",
"number": "your-sip-phone-number",
"numberE164CheckEnabled": false,
"credentialId": "your-new-trunk-credential-id-which-you-got-from-previous-step"
}'
## Troubleshooting "Invalid Credentials" Error
Based on information from [Discord threads](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334207101970677771), here are some troubleshooting steps:
1. **Verify API Keys**: Ensure you're using the correct API key for Telnyx in the Authorization
header. The header should be in the format Bearer <token>
.Vapi Support Bot
04/02/2025, 5:39 PMContent-Type: application/json
header in your requests.
4. **SIP Trunk Credentials**: Double-check the SIP Trunk URI and credentials.
5. **Public vs. Private Key**: Verify that you're using the correct key (public or private) in your API request. According to [this source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1340769075294634156), an "Invalid Key" error can occur if you're "using the private key instead of the public key, or vice versa."
## Potential Causes of the 422 Error
The 422 error could be due to several reasons:
1. **Invalid Telnyx Credentials**: Your error messages indicate "The provided credentials are not valid" and "Incorrect Telnyx Credential", suggesting that the API key or other authentication details for Telnyx might be incorrect.
2. **Incorrect API Endpoint or Payload Structure**: The error might occur if you're using an incorrect API endpoint or providing the credentials in the wrong format.
3. **Misconfigured Inbound/Outbound Settings**: Setting up inbound and outbound configurations on the Telnyx platform, including adding the necessary IPs and setting up the SIP URI correctly, is crucial for calls to be properly routed to Vapi.
4. **VAPI Configuration**: Ensure both VAPI API key and Private key are configured in settings.
Is there any specific part of the configuration process you'd like me to elaborate on further?
Sources:
- [Vapi API Documentation](https://docs.vapi.ai/advanced/sip/telnyx)
- [Discord Thread on Invalid Credentials](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334207101970677771)
- [Discord Thread on API Keys](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1340769075294634156)Vapi
04/06/2025, 9:18 AM