Installation
Switch from reCAPTCHA / hCaptcha
Already protecting a form with Google reCAPTCHA or hCaptcha? Moving to aiCaptcha is a handful of edits — the integration shape is deliberately similar. Budget five minutes.
Migration overview
- Register your domain as a site in the aiCaptcha dashboard and copy the new keys.
- Replace the old script tag and rename the widget class on your page.
- Rename the POST field your backend reads (
g-recaptcha-response→ai-captcha-response). - Swap the verification endpoint and secret in your backend.
- Test before deploying.
Client-side changes
The data-sitekey attribute keeps its name — only its value changes, plus the CSS class on the div:
before — reCAPTCHA
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="YOUR_RECAPTCHA_SITE_KEY"></div>after — aiCaptcha
<script src="https://your-instance.com/api/api.js" async></script>
<div class="ai-captcha" data-sitekey="YOUR_AICAPTCHA_SITE_KEY"></div>Coming from hCaptcha it's the same swap: h-captcha → ai-captcha.
Invisible / badge-in-corner setups
aiCaptcha always runs invisibly and is placed inline in the form — there is no separate "invisible" mode to configure. If your reCAPTCHA badge was floated in a corner, just move the div into the form where the result should appear.
Server-side changes
| reCAPTCHA / hCaptcha | aiCaptcha | |
|---|---|---|
| Widget class | g-recaptcha / h-captcha | ai-captcha |
| POST field | g-recaptcha-response / h-captcha-response | ai-captcha-response |
| Verify endpoint | google.com/recaptcha/api/siteverify | your-instance.com/api/verify-token |
| Credentials | RECAPTCHA_SECRET | AICAPTCHA_SECRET (dIZAAAAA…) |
| Extras | — | score + risk_level on every response |
before — reCAPTCHA (PHP)
$result = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?' . http_build_query([
'secret' => getenv('RECAPTCHA_SECRET'),
'response' => $_POST['g-recaptcha-response'] ?? '',
])), true);
if (!($result['success'] ?? false)) { /* reject */ }after — aiCaptcha (PHP)
$result = json_decode(file_get_contents('https://your-instance.com/api/verify-token?' . http_build_query([
'secret' => getenv('AICAPTCHA_SECRET'),
'response' => $_POST['ai-captcha-response'] ?? '',
])), true);
if (!($result['success'] ?? false)) { /* reject */ }
// bonus: $result['score'] and $result['risk_level'] are includedThe response keeps a success boolean as its main field, so most branching logic survives the migration unchanged. Full response shapes: API Reference.
Test before going live
- Load the page and confirm the aiCaptcha badge reaches Success!.
- Submit the form and confirm your backend accepts it (watch for the renamed POST field — a missed rename shows up as
Missing parameters). - Check the Verifications page in the dashboard for the new traffic.
- Remove the old provider's script tag and keys so you don't load two captchas.