Where to find the Stripe webhook secret (Dashboard, CLI, API)
The Stripe webhook secret is on the endpoint itself. In the Dashboard, open Workbench, go to the Webhooks tab, select your endpoint and click "Click to reveal." For local testing, the Stripe CLI prints a separate secret when you run stripe listen, and the API returns the secret only once, in the response that creates the endpoint.
Every secret starts with whsec_, and there is more than one of them: each endpoint, each mode and each CLI session has its own. A common cause of "signature verification failed" errors is a valid secret used in the wrong place. Details below are from Stripe's webhook docs, read on 29 November 2026.
Which secret goes where
| Where events come from | Where to get the secret | Notes |
|---|---|---|
| Live-mode endpoint in the Dashboard | Workbench > Webhooks > endpoint > Click to reveal | Use in production only |
| Test-mode or sandbox endpoint | Same place, while in test mode or the sandbox | Different value from live, even for the same URL |
| Stripe CLI forwarding to localhost | stripe listen --print-secret | Belongs to the CLI, not to any Dashboard endpoint |
| Endpoint created through the API | The secret field in the create response | Not returned again later; store it right away |
Stripe's docs state that it generates a unique secret for each endpoint, and that if you use the same endpoint for test and live keys, the secret differs for each. If you run several endpoints, you need a secret per endpoint you verify.
Get it from the Dashboard
- Open the Webhooks tab in Workbench.
- Check the mode toggle. A test or sandbox endpoint and a live endpoint are listed separately.
- Select the endpoint you are configuring.
- Click "Click to reveal" next to the signing secret and copy the
whsec_value. - Put it in your server's environment, for example
STRIPE_WEBHOOK_SECRET, and redeploy so the process reads it.
If the endpoint does not exist yet, create it from the same tab first. A new endpoint gets its own secret; it does not reuse an old one.
Get it from the Stripe CLI
For local work, the CLI is quicker than registering an endpoint:
stripe listen --print-secret
The CLI reference describes --print-secret as printing only the signing secret and exiting. When you run stripe listen with --forward-to, it prints the same kind of secret at the top of its output. That value only verifies events forwarded by the CLI. Copying it into production is a common cause of failures after deploy. The full local loop is in how to test Stripe webhooks locally.
Get it from the API
If you create endpoints in code, for example one per staging environment, the secret comes back in the creation response. Stripe's API spec describes the secret field as "Only returned at creation." Retrieving the endpoint later does not show it, so write it to your secrets manager in the same script:
curl https://api.stripe.com/v1/webhook_endpoints \
-u "sk_test_...:" \
-d url="https://staging.example.com/webhook" \
-d "enabled_events[]"="customer.subscription.deleted"
If you lose it, reveal it in the Dashboard or roll a new one. How to set up a staging environment for a small SaaS covers keeping staging and production keys apart.
Use it to verify the signature
The secret is one of three inputs to verification, together with the raw request body and the Stripe-Signature header. A Node example with the official library:
const event = stripe.webhooks.constructEvent(
req.body, // raw body, not parsed JSON
req.headers['stripe-signature'],
process.env.STRIPE_WEBHOOK_SECRET
);
Stripe's libraries reject events whose timestamp is more than 5 minutes off by default, which protects against replayed requests. If verification fails with a secret you know is correct, check that a JSON parser has not already changed the body.
Roll the secret safely
Stripe recommends rolling secrets periodically, or whenever one might have leaked. In the Webhooks tab, open the endpoint, use the overflow menu and click Roll secret. You can expire the old secret immediately or delay expiry for up to 7 days. During that window Stripe signs each event once per active secret, so your server can switch over without dropping events.
A safe order:
- Roll with a delay (a day is usually enough).
- Deploy the new secret to your server.
- Confirm events still verify in your logs.
- Let the old secret expire.
Never commit the secret to git or paste it into a frontend bundle. It belongs only on the server that receives events. If your product sends its own webhooks to customers, how to add webhooks to a SaaS API shows how to apply the same signing pattern.
Frequently asked questions
Where is the webhook signing secret in the Stripe Dashboard?
In Workbench, open the Webhooks tab, select the endpoint and click "Click to reveal." Make sure you are in the right mode, because test and live endpoints have different secrets.
Is the Stripe webhook secret the same as my API secret key?
No. The API secret key starts with sk_ and authenticates your calls to Stripe. The webhook secret starts with whsec_ and only verifies that incoming events came from Stripe.
Why does my webhook work locally but fail in production?
Locally you are using the secret printed by the Stripe CLI. Production events are signed with the Dashboard endpoint's secret, so set that value in your production environment.
Can I get the webhook secret again through the API?
No. The API returns the secret field only when the endpoint is created. Reveal it in the Dashboard, or roll it to get a new one.