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

  1. Register your domain as a site in the aiCaptcha dashboard and copy the new keys.
  2. Replace the old script tag and rename the widget class on your page.
  3. Rename the POST field your backend reads (g-recaptcha-response → ai-captcha-response).
  4. Swap the verification endpoint and secret in your backend.
  5. 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 / hCaptchaaiCaptcha
Widget classg-recaptcha / h-captchaai-captcha
POST fieldg-recaptcha-response / h-captcha-responseai-captcha-response
Verify endpointgoogle.com/recaptcha/api/siteverifyyour-instance.com/api/verify-token
CredentialsRECAPTCHA_SECRETAICAPTCHA_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 included

The 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.