Quickstart

Protect a form in four steps. You will need a free account.

1. Create a site

Open the dashboard, choose New site, enter your domain and select a mode. You will receive a site key and a secret key. Copy the secret immediately, it is shown only once.

2. Add the widget

Pick the option that matches your stack. Replace YOUR_SITE_KEY with your site key.

<script src="https://recloud-turnstile.bunowave.shop/recloud.js" async defer></script>

<form method="POST" action="/submit">
  <div class="recloud" data-sitekey="YOUR_SITE_KEY"></div>
  <button type="submit">Send</button>
</form>

When verification succeeds, a hidden input named recloud-response is added to the form automatically.

Install the package once:

composer config repositories.recloud composer https://recloud-turnstile.bunowave.shop/packages/composer
composer require bunowave/recloud-laravel

Add your keys to .env:

RECLOUD_SITE_KEY=YOUR_SITE_KEY
RECLOUD_SECRET=YOUR_SECRET_KEY

Render the widget in your Blade form:

<form method="POST" action="/contact">
    @csrf
    <x-recloud theme="dark" size="flexible" />
    <button type="submit">Send</button>
</form>

Install the package:

npm install https://recloud-turnstile.bunowave.shop/packages/npm/bunowaveltd-recloud-1.0.0.tgz

Use the component in a client component:

'use client';

import { useState } from 'react';
import { ReCloud } from '@bunowaveltd/recloud/react';

export function ContactForm() {
  const [token, setToken] = useState('');

  async function submit(event) {
    event.preventDefault();
    await fetch('/api/contact', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ token }),
    });
  }

  return (
    <form onSubmit={submit}>
      <ReCloud siteKey="YOUR_SITE_KEY" theme="auto" onVerify={setToken} />
      <button disabled={!token}>Send</button>
    </form>
  );
}

3. Verify the token on your server

Send the token and your secret key to the siteverify endpoint before you process the form. Never skip this step, the client side alone is not enough.

use BunoWave\ReCloud\Rules\ReCloudRule;

$request->validate([
    'recloud-response' => ['required', new ReCloudRule()],
]);
import { verify } from '@bunowaveltd/recloud';

const result = await verify(token, {
  secret: process.env.RECLOUD_SECRET,
  remoteip: ip,
});

if (!result.success) {
  throw new Error('Verification failed');
}

Install with pip as shown on the SDKs page, then:

from recloud import verify

result = verify(token, secret="YOUR_SECRET_KEY", remoteip=ip)

if not result:
    abort(400)
<?php
$ch = curl_init('https://recloud-turnstile.bunowave.shop/api/v1/siteverify');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => http_build_query([
        'secret' => 'YOUR_SECRET_KEY',
        'response' => $_POST['recloud-response'] ?? '',
        'remoteip' => $_SERVER['REMOTE_ADDR'],
    ]),
]);
$result = json_decode(curl_exec($ch), true);
if (empty($result['success'])) {
    http_response_code(400);
    exit('Verification failed');
}
curl -X POST https://recloud-turnstile.bunowave.shop/api/v1/siteverify \
  -d "secret=YOUR_SECRET_KEY" \
  -d "response=TOKEN_FROM_FORM"

4. Test it

Open your page, wait for the widget to show Success, then submit the form. In your dashboard, the Logs page shows the attempt with its risk score and the signals behind it.

Tip. A token can be verified only once and expires after five minutes. If a visitor stays on the page longer, the widget refreshes the token automatically.