Get started
This guide will get you started on setting up the Turnstile widget.
If you are currently using a CAPTCHA service, you can copy and paste our script wherever you have deployed the existing script today.
To start using the Turnstile widget, you will need to obtain a sitekey and a secret key. The sitekey and secret key are always associated with one widget and cannot be reused for other widgets.
The sitekey is public and used to invoke the Turnstile widget on your site.
The sitekey and secret key are generated upon the creation of a widget, allowing communication between your site and Cloudflare to verify responses for a solved challenge from Turnstile. Make sure you keep the secret key safe for security reasons.
- Log in to the Cloudflare dashboard ↗ and select your account.
- Go to Turnstile.
- Select Add a site and fill out the site name and your website’s hostname or select from your existing websites on Cloudflare.
- Select the widget mode.
- (Optional) Opt in for pre-clearance support.
- Copy your sitekey and secret key.
- Log in to the Cloudflare dashboard ↗ and select your account.
- Go to Turnstile.
- In the widget overview, select Settings.
- (Optional) Opt in for pre-clearance support.
- Copy your sitekey and secret key.
To add the Turnstile widget:
- Insert the Turnstile script snippet in your HTML’s
<head>
element:
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
After you have installed the Turnstile widget on your site, you must configure your server to validate the Turnstile response. Refer to Server-side validation.