← All errors · StripeStripe payments & webhook errors
Invalid API Key provided
Exact error
Invalid API Key provided: sk_test_****
What it means
Stripe rejected the secret key sent with the request (authentication_error).
Likely causes
- Typo, extra whitespace or quotes around the key in your env file.
- Key was rolled/deleted in the Dashboard.
- Using a publishable key (pk_) where a secret key (sk_ or rk_) is required.
How to fix it
Copy the secret key again from Dashboard → Developers → API keys, with no quotes or trailing spaces.
Keep secret keys server-side only:
# .env.local STRIPE_SECRET_KEY=sk_test_... NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...Update the variable on your host (e.g. Vercel) and redeploy.
Prevent this next time
- Test webhooks locally with `stripe listen` and the Stripe test cards before going live.
- Check webhook delivery attempts in the Stripe Dashboard after each deploy, and keep test and live keys clearly separated per environment.
FAQ
What does "Invalid API Key provided" mean?
Stripe rejected the secret key sent with the request (authentication_error).
What usually causes it?
Typo, extra whitespace or quotes around the key in your env file. Key was rolled/deleted in the Dashboard. Using a publishable key (pk_) where a secret key (sk_ or rk_) is required.
How do I fix it?
1. Copy the secret key again from Dashboard → Developers → API keys, with no quotes or trailing spaces. 2. Keep secret keys server-side only: 3. Update the variable on your host (e.g. Vercel) and redeploy.
Related errors
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy