← 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

How to 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:

    # .env.local
    STRIPE_SECRET_KEY=sk_test_...
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
  3. Update the variable on your host (e.g. Vercel) and redeploy.

Prevent this next time

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