Keys / Cloudflare Turnstile

TURNSTILE_SECRET_KEY

The widget's secret key your server sends to Turnstile's siteverify endpoint with each token to check that a visitor passed. The sitekey is the public half.

Expires
the docs don't say
API
rotate, with a Cloudflare API token that has Turnstile Sites Write

Get it

Create one on dash.cloudflare.com. The steps aren't recorded yet.

Set it

TURNSTILE_SECRET_KEY=...

No official Cloudflare library reads it; your app passes it in. Cloudflare's docs use both TURNSTILE_SECRET_KEY and TURNSTILE_SECRET. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. On the Turnstile page, open the widget and select Settings, then Rotate Secret Key. The old secret keeps working for 2 hours.
  2. Deploy the new secret everywhere that reads TURNSTILE_SECRET_KEY within those 2 hours.
  3. You can't rotate again until the 2 hours pass. The API can also end the old secret at once with invalidate_immediately.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16