How to Generate reCAPTCHA Keys
This guide will walk you through the process of creating reCAPTCHA keys for your Static Forms account. You'll need both a Site Key (for your website) and a Secret Key (for your Static Forms account).
Why You Need reCAPTCHA
reCAPTCHA helps protect your forms from spam and abuse by verifying that submissions are coming from real humans, not bots. This is essential for:
- Preventing spam submissions to your email
- Protecting your forms from automated attacks
- Ensuring the quality of the data you receive
- Maintaining the security of your website
Static Forms requires reCAPTCHA integration to ensure all form submissions are legitimate.
Step 1: Access the reCAPTCHA Admin Console
Go to the Google reCAPTCHA Admin Console
Sign in with your Google account. If you don't have one, you'll need to create one.
Note: The reCAPTCHA Admin Console is part of Google's services, so you'll need a Google account to access it.
Step 2: Register a New Site
Once logged in, click the + Add button to register a new site.
Enter a Label for your site (e.g., "My Website Forms")
This is for your reference only and helps you identify this reCAPTCHA configuration later.
Select reCAPTCHA v2 as the type
Specifically, choose "I'm not a robot" Checkbox for the best compatibility with Static Forms.
Add your Domains where the reCAPTCHA will be used
Enter all domains where your forms will be embedded, one per line (e.g., example.com, www.example.com)
For testing locally, you can add "localhost" as a domain.
Accept the Terms of Service and click Submit
Step 3: Get Your reCAPTCHA Keys
After registering your site, you'll be provided with two important keys:
Site Key
This key is used in your HTML form and is visible to users. It looks something like:
The Site Key is used to display the reCAPTCHA widget on your website.
Secret Key
This key must be kept confidential and is used for communication between your server and Google. It looks something like:
Important: This is the key you'll need to enter in your Static Forms account registration.
Step 4: Add the Secret Key to Your Static Forms Account
During registration on Static Forms, you'll be asked for your reCAPTCHA Secret Key.
Enter the Secret Key you obtained from the reCAPTCHA Admin Console.
Complete your registration to create your Static Forms account.
Step 5: Implement reCAPTCHA on Your Website
To add reCAPTCHA to your form, you'll need to include the following elements in your HTML:
<form action="https://api.staticforms.xyz/submit" method="POST"> <input type="hidden" name="apiKey" value="your-api-key" /> <!-- Your form fields --> <input type="text" name="name" placeholder="Name" required /> <input type="email" name="email" placeholder="Email" required /> <textarea name="message" placeholder="Message" required></textarea> <!-- reCAPTCHA widget --> <div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div> <button type="submit">Send</button> <!-- Include reCAPTCHA JavaScript --> <script src="https://www.google.com/recaptcha/api.js" async defer></script> </form>
Replace "YOUR_SITE_KEY" with the Site Key you obtained from the reCAPTCHA Admin Console.
Troubleshooting
reCAPTCHA Not Displaying
If the reCAPTCHA widget isn't appearing on your form:
- Verify that you've included the correct Site Key
- Check that you've added the reCAPTCHA JavaScript
- Ensure your domain is listed in the reCAPTCHA Admin Console
Form Submissions Failing
If your form submissions are being rejected:
- Confirm you've entered the correct Secret Key in your Static Forms account
- Verify that your form is correctly sending the reCAPTCHA response token
- Check that your domain is properly configured in the reCAPTCHA settings
Need More Help?
If you're still having trouble setting up reCAPTCHA, you can: