Invalid API Key: 401
# support
d
I'm attempting to fetch my call log data via api call to enrich my db with the call_cost, call_length, etc. When I create a new key and test both on VAPI and n8n, I get a 401 invalid key. I've tried this with both no scoped and scoped to specific agents/urls, but continue to run into this error. Any thoughts?
v
Try this: Double-check that your API call includes the correct Authorization header. For example:
Copy code
bash
curl https://api.vapi.ai/v2/call \
  -H "Authorization: Bearer YOUR_API_KEY"
Make sure there are no extra spaces or typos in your key, and that it's not expired or revoked. If you still get a 401, try refreshing your token or re-logging in via the Vapi CLI with
vapi login
.
For more, see the [authentication docs](https://docs.vapi.ai/cli/auth). Sources: - [Vapi CLI Authentication Documentation](https://docs.vapi.ai/cli/auth) - [Vapi API Reference: List Calls](https://docs.vapi.ai/api-reference/calls/call-controller-find-all-paginated)
v
Hi! I can help troubleshoot this. A 401 usually means the key isn’t being recognized, which can happen due to scoping, format, or how it’s sent in the request. Can you confirm if you’re passing it in the Authorization header exactly as Bearer YOUR_KEY? Also, are you testing the same endpoint in both VAPI and n8n? @Dan
3 Views