Guys there is ANYBODY here who could connect a Tel...
# support
v
Hi there! I understand you're having trouble connecting a Telnyx number to VAPI using the API and encountering error messages about invalid credentials and a 422 error. This can be frustrating, especially when you've been stuck for weeks! Unfortunately, I can't provide the exact cause of the "Couldn't find existing Vapi application after 422 error" message as I don't have specific information on this error. However, I can help with the steps to connect Telnyx to VAPI and troubleshoot the invalid credentials issue. ## Connecting Telnyx to VAPI using the API According to the [Vapi API documentation](https://docs.vapi.ai/advanced/sip/telnyx), here's how to connect a Telnyx number to VAPI: 1. Create a SIP Trunk Credential using the Vapi API:
Copy code
curl -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**:
Copy code
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>
.
2. **Check Endpoint Paths**: Make sure you're using the correct API endpoint URL provided by VAPI. 3. **Content-Type Header**: Include the
Content-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)
v
checking if this is resolved/solved for you?