Google reCAPTCHA protects you from fraudulent activities, spam, and abuse. There are two versions of reCAPTCHA and we support both clickable (v2) and invisible reCAPTCHA (v3).
We recommend going with v3 unless you'd like your users to click on cars and traffic lights before submitting!
Before getting started make sure to reference the reCAPTCHA documentation.
✨🤖🚦 reCAPTCHA is available on all paid plans
<head>
tag.<script src="https://www.google.com/recaptcha/api.js"></script>
Follow Google's instructions on how to integrate reCAPTCHA v2 or v3
⚡️ OR ⚡️ if you're using a JS framework there is likely a package that will make the integration easier:
Once the reCAPTCHA widget is setup, you can send the reCAPTCHA response token to our API in two ways.
g-recaptcha-response
property. This is the reCAPTCHA's default behavior and requires no additional config from you.document.getElementById('myForm').addEventListener('submit', async function (e) {
e.preventDefault()
const formData = new FormData(this);
const data = Object.fromEntries(formData)
// data is something like { ..., 'g-recaptcha-response': 'xxxxxx'}
const response = await fetch('https://api.submitjson.com/v1/submit/XxXx', {
method: 'POST',
headers: {
'content-type': 'application/json',
'X-API-Key': 'sjk_xxx',
},
body: { data },
})
const submission = await response.json()
})
recaptchaToken
key. For this example we'll use the JS client.await sj.submit({ name: 'Franky', loves: 'Vegapunk' }, {
recaptchaToken: 'xxxxxxxxxx'
})
Now that you've integrated reCAPTCHA with your front-end it's time to validate the token.
We've got you all covered here. Follow these instructions to set it and forget it:
🚛✨💚 Nice job, submissions to your endpoint are now validated with Google reCAPTCHA