Skip to content

Captcha

Use layer captcha sitekeys after a direct Cloudflare deploy to read Captcha site keys from the current project and local deployment state.

Terminal window
layer captcha sitekeys [project] [options]

The command reads the current app, finds Captcha sitekey bindings, and prints the public site key for each configured Captcha instance. Managed Cloudflare Turnstile site keys come from the local deployment state that layer deploy cloudflare records after Cloudflare creates the widget. Google reCAPTCHA and adopted Turnstile site keys come from the explicit sitekey in app code.

The output includes public site keys only.

OptionValueNotes
--env<name>Local state scope name. Defaults to default.
--namespace<name>Captcha namespace filter.
--name<name>Captcha instance name filter.
--jsonPrint JSON records.
-h, --helpShow help.

Print all Captcha site keys for the default environment:

Terminal window
layer captcha sitekeys

Print the site key for the production signup Captcha:

Terminal window
layer captcha sitekeys --env production --name signup

Print JSON for a frontend build script:

Terminal window
layer captcha sitekeys --env production --json
FieldMeaning
namespaceCaptcha namespace.
nameCaptcha instance name.
providerCaptcha provider.
bindingNameWorker environment binding name.
sitekeyPublic site key when the key is ready.
sourceThe source used to resolve the site key.
stateready when a site key is available, or pending when a managed widget has not been deployed yet.

(deploy pending) means the current app declares a managed Turnstile widget and the local deployment state is waiting for the Cloudflare-generated site key. Run layer deploy for that environment and rerun layer captcha sitekeys.