Invalid Key
# support
s
The key was copied from the public api keys Example: curl -X POST https://api.vapi.ai/call \ -H "Authorization: Bearer 77a1c44a-9a1....b557f7628ad7" \ -H "Content-Type: application/json" \ -d '{ "assistantId": "ebdc9c40-6b0d-4ff3-99e0-9dddb2718067" }' { "message": "Invalid Key. Hot tip, you may be using the private key instead of the public key, or vice versa.", "error": "Unauthorized", "statusCode": 401 } https://cdn.discordapp.com/attachments/1487787644296630393/1487787644607004783/image.png?ex=69ca69b8&is=69c91838&hm=953bec3e3999f883a3035f521183ee9f81ba5bb36f633955be12eda383c7eda2&
c
Hi there, Thank you for your message. Our team is currently out of the office. We operate Monday through Friday, from 9:00 AM to 8:00 PM Pacific Standard Time (PST). We’ll get back to you as soon as possible during our normal business hours. If your message is urgent, please mark it accordingly or include “URGENT” in the subject line, and we’ll do our best to respond promptly. Warm regards, Vapi Customer Support Team
v
You are getting the "Invalid Key" error because the
/call
endpoint requires a private JWT token, not a public API key.
To fix this, generate a private JWT token using your organization ID and private key, then use it in your request. Here’s an example of how to generate and use the token:
Copy code
js
// Generate a private JWT token (Node.js example)
const payload = { orgId: process.env.ORG_ID, token: { tag: "private" } };
const key = process.env.PRIVATE_KEY;
const options = { expiresIn: "1h" };
const token = generateJWT(payload, key, options);

// Use the token in your cURL request
curl -X POST https://api.vapi.ai/call \
  -H "Authorization: Bearer <your-private-jwt-token>" \
  -H "Content-Type: application/json" \
  -d '{ "assistantId": "ebdc9c40-6b0d-4ff3-99e0-9dddb2718067" }'
Replace
<your-private-jwt-token>
with the token you generate.
For more details, see the [JWT Authentication documentation](https://docs.vapi.ai/customization/jwt-authentication). Source: - [JWT Authentication documentation](https://docs.vapi.ai/customization/jwt-authentication)
v
Message marked as helpful by @szekler! 🎉
s
Thank you, it can be closed now