Keys / Google reCAPTCHA

RECAPTCHA_SECRET_KEY

The legacy secret key your server sends to reCAPTCHA's siteverify endpoint with each token to check a user's response. The site key is the public half.

Expires
the docs don't say
API
create, retrieve the legacy secret, and delete keys, with the reCAPTCHA Enterprise API

Get it

Create one on console.cloud.google.com/security/recaptcha. The steps aren't recorded yet.

Set it

RECAPTCHA_SECRET_KEY=...

No official Google library reads this variable; your app passes the key in. Google's PHP library examples read RECAPTCHA_V3_SECRET and similar names. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. The secret belongs to one site key, and Google documents no way to rotate it. In the console's Keys tab, create a new key of the same type and version, with the same domains.
  2. The console can't create Invisible v2 keys. For one, run gcloud recaptcha keys create with --web --integration-type=invisible and the same domains.
  3. Open the new key, go to Integration, and click Use legacy key to copy its secret. Deploy the new site key and secret together, everywhere that reads RECAPTCHA_SECRET_KEY.
  4. Check that nothing still uses the old key, then delete it. A deleted key can't be recovered.

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