Developer Documentation
Everything you need to integrate doCaptcha into your application. Get up and running in under 5 minutes.
Quick Start Guide
1
Get Your API Key
Sign up and get your API key from the dashboard
dc_live_xxxxxxxxxxxxxxxx
2
Add the Script
Include our JavaScript library in your HTML
<script src="https://api.
docaptcha.com/v1/widget.js"
></script>
3
Initialize
Configure and initialize the CAPTCHA widget
doCaptcha.init({
apiKey: 'your_api_key',
element: '#captcha'
});
Complete Example
<!DOCTYPE html>
<html>
<head>
<title>doCaptcha Integration</title>
</head>
<body>
<!-- Your form -->
<form id="myForm" action="/submit" method="post">
<input type="email" name="email" placeholder="Email" required>
<!-- CAPTCHA container -->
<div id="captcha-container"></div>
<button type="submit">Submit</button>
</form>
<!-- doCaptcha Script -->
<script src="https://widget.docaptcha.com/v1/widget.min.js" async></script>
<script>
doCaptcha.init({
apiKey: 'dc_live_1234567890abcdef',
element: '#captcha-container',
theme: 'light',
challengeTypes: ['click-sequence', 'slide-verification'],
onSuccess: function(token) {
// Add token to form
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'captcha_token';
input.value = token;
document.getElementById('myForm').appendChild(input);
// Enable submit button
document.querySelector('button[type="submit"]').disabled = false;
},
onError: function(error) {
console.error('CAPTCHA failed:', error);
alert('Please complete the CAPTCHA challenge');
}
});
</script>
</body>
</html>
Complete HTML integration example
API Reference
POST
/v1/verifyVerify a CAPTCHA token
{
"token": "captcha_token_here",
"secret": "your_secret_key"
}
GET
/v1/challengeGet a new challenge
{
"challenge_type": "click-sequence",
"difficulty": "medium"
}
POST
/v1/configUpdate widget configuration
{
"theme": "dark",
"challenge_types": ["slide", "click"]
}
Smart Form Protection
Protect forms from spam & abuse
Beyond CAPTCHA — SmartFormGuard detects gibberish, blocks disposable emails, enforces fill-time minimums, and rate-limits repeat submissions. Available on Pro and Enterprise plans.
<!-- 1. Include the SDK -->
<script type="module">
import { SmartFormGuard } from 'https://api.docaptcha.com/sdk/smart-form-guard.js';
const guard = new SmartFormGuard({
siteKey: 'dc_live_1234567890abcdef',
apiUrl: 'https://api.docaptcha.com',
minFillTime: 3000, // 3 seconds minimum
maxSubmissions: 3, // per 5-minute window
});
// Auto-protect: injects honeypot, tracks timing, validates on submit
guard.protect(document.getElementById('contactForm'));
// Listen for validation results
document.getElementById('contactForm')
.addEventListener('dcFormError', (e) => {
console.log('Blocked:', e.detail.errors);
});
</script>
<!-- 2. Your form (no changes needed) -->
<form id="contactForm" action="/submit" method="post">
<input type="text" name="name" placeholder="Name" required>
<input type="email" name="email" placeholder="Email" required>
<textarea name="message" placeholder="Message" required></textarea>
<button type="submit">Send</button>
</form>
Client-side checks
- Honeypot field injection
- Fill-time enforcement
- Gibberish & name validation
- Disposable email blocking
- Local rate limiting
Server-side validation
- POST /api/v2/form/validate
- Content quality scoring
- Redis-backed rate limiting
- Configurable per-site thresholds
- Silent honeypot acceptance