Persistent 401 “Invalid Key” on /call/web despite ...
# support
e
Hi Vapi Support, I'm consistently getting a 401 Unauthorized error with the message "Invalid Key. Hot tip, you may be using the private key instead of the public key, or vice versa." when calling the /call/web endpoint. What I've done: • I am using the public key, not the private key. • The assistant ID is correctly set and from the same organization as the key. • I've tried multiple regenerated public keys — all return the same 401 error. • I've confirmed that allowed assistants and allowed origins are blank (default, unrestricted). • I tested from both the frontend browser dev tools and backend At this point, I'm unsure why the request is still unauthorized. Request: Could someone please help me identify what’s causing the 401 and resolve it Thanks
v
Thank you for the detailed troubleshooting steps. To help narrow this down: Can you confirm exactly how you are passing your authentication credentials in the request to
/call/web
(e.g., are you using an
Authorization: Bearer <token>
header, or sending the public key in a different way)?
This will help determine if the issue is with the authentication method or the key itself. If possible, please share a (redacted) example of your request headers. Source: - [Vapi Server Authentication Documentation](https://docs.vapi.ai/server-url/server-authentication)
e
Yes, I can confirm that I am passing the authentication credentials via the Authorization header using the correct Bearer token format. Here’s exactly how the request is being made: POST https://api.vapi.ai/call/web Authorization: Bearer pbk_live_my key Content-Type: application/json And here is a redacted example of the full request: curl -i https://api.vapi.ai/call/web \ -H 'Authorization: Bearer pbk_live_my key' \ -H 'Content-Type: application/json' \ --data '{ "assistantId": "asst_6450e619-6972-4130-95c9-5896f446e3e4", "metadata": {} }'
@Vapi Support Bot
v
Suggestion: Please double-check that your public key is both enabled and active in the [Vapi dashboard API Keys page](https://dashboard.vapi.ai/keys), and that it is not restricted by any organization or assistant-level settings. As a test, try generating a brand new public key, ensure it is enabled, and use it in a minimal request like below:
Copy code
bash
curl -i https://api.vapi.ai/call/web \
  -H 'Authorization: Bearer pbk_live_your_new_key' \
  -H 'Content-Type: application/json' \
  --data '{"assistantId": "asst_6450e619-6972-4130-95c9-5896f446e3e4"}'
If this still returns a 401, please confirm the new key is visible and enabled in your dashboard, as key status is a common cause for this error ([see docs](https://docs.vapi.ai/server-url/server-authentication)). Source: - [Vapi Server Authentication Documentation](https://docs.vapi.ai/server-url/server-authentication)
e
yes ive tested witrh multiple new keys and i can see it in my dashboard
tried it once again just now with a brand new key and still got the 401
@Vapi Support Bot help
v
Since you've confirmed your public key is enabled, visible, and unrestricted, but still receive a 401, **try creating a new API key, then immediately log out and back into the Vapi dashboard before using the new key**—this can refresh key permissions and resolve sync issues. After re-logging in, use the following minimal request to test:
Copy code
bash
curl -i https://api.vapi.ai/call/web \
  -H 'Authorization: Bearer pbk_live_your_new_key' \
  -H 'Content-Type: application/json' \
  --data '{"assistantId": "asst_6450e619-6972-4130-95c9-5896f446e3e4"}'
If the issue persists, please contact Vapi support directly with your request ID and a screenshot of your API Keys dashboard for further investigation. Source: - [Vapi Server Authentication Documentation](https://docs.vapi.ai/server-url/server-authentication)
c
Could you try using this simple cURL request to make sure your key works?
Copy code
curl https://api.vapi.ai/assistant \
     -H "Authorization: Bearer <token>"
You can also use the documentation API request tool on this page --> If the public doesn't work, switch to the private key temporarily.
e
yeah i ran it in my terminal got the hot tip thing
i didnt run that exact command thought i can do that once im home
c
Could you also try the private key? That one usually works best for me in my own testing.
2 Views