Vapi AI 401 Unauthorized Error - All Credentials C...
# support
d
Summary I'm trying to use Vapi AI but keep getting "401 Unauthorized" errors even though I'm doing everything right. What I have: Private API key: 1ccbaa08-5fa8-44d9-a0fa-5d179674bcde Phone number ID: 9188c463-d168-40cf-b5aa-a7bc1e9fe6a8 Account email: ashah6@chewy.com Account has credits (not in trial mode) What happens: Every time I make an API call, I get: 401 Unauthorized "Invalid Key. Hot tip, you may be using the private key instead of the public key, or vice versa." What I've tried: Using the private key as Bearer token (as docs say) Regenerating new private keys Different phone number formats
s
Hi dark, To resolve the "401 Unauthorized" error you're encountering, verify the following steps: 1. **API Key Type**: Ensure you're using the correct type of API key for the endpoint you're accessing. For public endpoints, use a public key, and for endpoints that require authentication, use a private key. 2. **Correct Endpoint**: Double-check that the endpoint you are calling requires the key you are using (public or private). Each endpoint may have different authentication requirements. 3. **Dashboard Settings**: Visit the Vapi dashboard to manage and verify your API keys. Ensure they are active and correctly configured for the endpoints you are accessing. 4. **Token Inclusion**: Make sure that your API request includes the correct headers:
Copy code
Authorization: Bearer your-api-key
Please ensure these steps are correctly implemented. If the error persists, consider generating a new API key from your Vapi dashboard to ensure your keys are up-to-date and troubleshoot further. For more information on server authentication, refer to the [Server Authentication](https://docs.vapi.ai/server-url/server-authentication) documentation. Also could you please send your request payload and the endpoint URL you are using?