Websites · Mobile Apps · Web Apps & SaaS · AI
Home / Blog / Technology

Stripe Restricted API Keys: Why Your App Should Not Use the Full Secret Key

Vercel now creates a restricted Stripe key per agent or task. Here is what restricted keys are, why they limit damage and how to switch safely.

Stripe Restricted API Keys: Why Your App Should Not Use the Full Secret Key
Quick answer

A Stripe restricted API key lets you give each part of your app only the permissions it needs, instead of the default secret key that has full access to the account. Stripe recommends restricted keys, a secrets vault, regular rotation and request-log checks. On 23 October 2026 Vercel added a Managed API Key option that creates a separate restricted Stripe key per agent or task. Whatever platform you use, list your keys, replace broad ones with restricted ones and rotate one at a time.

If your website takes payments through Stripe, one setting is worth ten minutes this week: the permissions on the API key your server uses. Many sites run on the default secret key, which can do almost anything in the Stripe account. A restricted key can do only what you allow, so a leak does less damage.

What happened this week

On 23 October 2026 Vercel announced that Vercel Connect can create a separate restricted Stripe API key for each agent or task. When you create a Stripe connector you can choose Managed API Key as the connection method. Vercel creates the key in your Stripe account with the permissions you pick, stores it, and lets you rotate it from the connector settings without redeploying. Vercel says the old key stays valid for up to 24 hours while you switch.

Vercel's own example is useful for any business: a daily revenue report can be limited to read-only access to charges, and an onboarding step can be limited to writing customers.

Why this matters even if you do not use Vercel

Stripe's documentation treats secret keys like account credentials. If an unauthorized party gets one, Stripe says they can make unauthorized charges, access customer data or disrupt your integration. Its advice has four parts:

  • Use restricted API keys with limited permissions instead of unrestricted secret keys.
  • Keep keys in a secrets vault, or in environment variables marked sensitive, and never in source code or in apps.
  • Rotate keys periodically so you know where each one is used and can replace it fast.
  • Audit API request logs for unusual activity.

Stripe also says it will notify you and may deactivate a key if it detects exposure, but it does not guarantee detection, so you cannot rely on that. We saw the same lesson in the Railway incident, where users were told to rotate every stored secret.

A practical checklist

  1. List every place a Stripe key lives. Hosting variables, CI settings, plugins, no-code tools and contractors' laptops.
  2. Note what each one needs to do. A reporting tool needs read access. A checkout page needs to create payments. A support tool may only need customers.
  3. Create a restricted key per job in your Stripe Dashboard with only those permissions.
  4. Replace one key at a time. Put the new key in your secrets store, deploy, test a real payment flow in test mode first, then revoke the old key.
  5. Never use live keys where test keys will do. Stripe recommends using sandbox keys when appropriate.
  6. Limit who can create or read keys, and check that list quarterly.
  7. Add a scanner or pre-commit check that rejects code containing keys.
  8. Check API request logs after the change, and again monthly.
  9. Write down your rotation steps so a leak is a ten-minute job.

If your hosting platform offers managed Stripe keys, Stripe says to mark them as sensitive where supported, never expose environment variables on error pages, and expect to redeploy after a rotation unless the platform does it for you.

For other upkeep tasks that stop small problems becoming big ones, see our website maintenance guide and the mobile app security checklist. Need help auditing the keys behind your checkout? Talk to Susraj Tech.

Frequently asked questions

What is a Stripe restricted API key?

A key with only the permissions you choose, so a leak can only make those calls.

Do I need Vercel to use restricted keys?

No. They are a Stripe feature and work with any hosting setup.

Sources

Last reviewed 23 October 2026. This article is general security information, not a guarantee of protection. Check Stripe's and your platform's documentation for current options.

Frequently asked questions

What is a Stripe restricted API key?

It is a Stripe API key with limited permissions that you choose. Stripe gives the example of an invoicing system that can manage invoices and nothing else. If such a key leaks, an attacker can only make the calls that key allows.

Why is the default secret key risky?

Vercel notes that most apps and agents run on Stripe's default secret key, which has full access to the account. Stripe says that if an unauthorized party obtains it, they can make unauthorized charges, access customer data or disrupt your integration.

What did Vercel announce on 23 October 2026?

Vercel Connect can now create a separate restricted Stripe API key for each agent or task. You choose Managed API Key when you create a Stripe connector, pick the permissions, and rotate the key from the connector settings without redeploying. The old key stays valid for up to 24 hours.

Do I need Vercel to use restricted keys?

No. Restricted keys are a Stripe feature that you can create in your Stripe account and store in any secrets vault or environment variable system.

Where should I keep Stripe keys?

Stripe says never to put secret keys in source code or embed them in apps. Keep them in a secrets vault, or in environment variables marked sensitive if your platform lacks a vault, and share them only through those tools.

Written by the Susraj Tech team

We design and build websites, mobile apps, SaaS products and AI solutions. Have a project in mind? Tell us about it and we’ll send a clear, written quote.

Have an idea? Let’s build it.

Tell us what you need and we’ll reply with a clear, written quote. No pressure, no jargon.