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
- 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.
- The console can't create Invisible v2 keys. For one, run
gcloud recaptcha keys createwith--web --integration-type=invisibleand the same domains. - 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. - 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
- Google Cloud: Create reCAPTCHA keys for websites
- Google Cloud: Verify user response tokens with legacy SiteVerify
- Google Cloud: Reconcile Admin Console and Google Cloud console terminology
- Google Cloud: Edit or delete reCAPTCHA keys
- reCAPTCHA Enterprise API: projects.keys
- google/recaptcha: PHP examples read RECAPTCHA_V3_SECRET
- gcloud recaptcha keys create