Try the Demo
Verification Successful
The CAPTCHA API returned a success callback.
Documentation
Embed the Ghost Captcha widget on any website using a single script tag and HTML data attributes. The API automatically builds the UI, applies your custom styling, and handles verification.
1. Include the Script
Place this right before your closing </body> tag. It contains everything needed.
<script src="https://api.ghostcaptcha.com/v2/widget.js"></script>
2. Add Data Attributes to your Button
Add data-ghost-captcha="true" to any button. You can fully customize the modal using the attributes below. The moving static noise will always remain black/white.
| Attribute | Description | Example |
|---|---|---|
| data-ghost-captcha | Required trigger flag. | "true" |
| data-callback | Global JS function to call on success. | "myFunction" |
| data-bg | Modal background color (HEX/RGB). | "#1e293b" |
| data-text | Main text color. | "#ffffff" |
| data-btn-bg | Verify button background color. | "#3b82f6" |
| data-btn-text | Verify button text color. | "#ffffff" |
| data-outline | Color for modal/canvas borders & inputs. | "#475569" |
| data-font | Font family for modal text and buttons. | "'Courier New', monospace" |
3. Example Integration
<button
data-ghost-captcha="true"
data-callback="handleSuccess"
data-bg="#ffffff"
data-text="#ffffff"
data-btn-bg="#000000"
data-btn-text="#ffffff"
data-outline="#e2e8f0"
data-font="'Inter', sans-serif">
Submit Form
</button>
<script>
function handleSuccess() {
alert("User verified as human!");
// Submit your form via AJAX or update UI
}
</script>