Appearance
Quick start
Integrate with AI Agents in Seconds
Building with Claude Code, Cursor, ChatGPT, or OpenCode? You can integrate Katcha automatically without writing integration boilerplate manually. Just copy this prompt to your agent:
text
Please read https://docs.katcha.eu/onboard.md and help me integrate Katcha into this project.Or jump to Section 3: Integrate with AI Agents / Dedicated Agent Docs, or click your assistant in the "Add to your Agent" sidebar widget!
The Katcha widget can protect your applications from bots, spam, SMS fraud, and other forms of automated abuse. Installing Katcha is fast and easy. It requires adding some simple HTML and server-side code.
- Katcha to website or app: Load Widget (Site Key)
- Website or app to Katcha: Request & Solve Challenge
- Katcha to website or app: Issue Token
katcha-token - Website or app to website server: Submit Form + Token
- Website server to Katcha: POST Verification (Token + Secret Key)
- Katcha to website server: Valid Token Response (success)
1. Get your Site Key and Secret Key
Before adding the widget, you need credentials from the Katcha dashboard:
- Sign up or log in to the Katcha dashboard.
- Create a new site (or select an existing one).
- Copy your site key, used client-side in
data-site-key. - Copy your secret key, used server-side when calling the verify API.
WARNING
Never expose your secret key in client-side code or public repositories.
2. How it works
You embed the Katcha widget on your site, for example, on a login or signup form.
Frontend
- You embed the Katcha widget on your website, for example, in a login form.
Frontend Code Example (Simple)
html
<html>
<head>
<title>Katcha Demo</title>
<script src="https://widget.katcha.eu/1/api.js" async defer></script>
</head>
<body>
<form method="POST" action="/login">
<!-- Your other fields, like email and password, go here -->
<input type="text" name="email" placeholder="Email" />
<input type="password" name="password" placeholder="Password" />
<!-- Katcha widget -->
<div class="katcha" data-site-key="YOUR_SITE_KEY"></div>
<br />
<!-- The hidden `katcha-token` is added automatically after solving -->
<input type="submit" value="Submit" />
</form>
</body>
</html>Frontend Code Example (Programmatic)
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Katcha Execute Example</title>
<!-- 1. Load Katcha Widget -->
<script src="https://widget.katcha.eu/1/api.js" async defer></script>
<script>
let widgetId = null;
// 2. Render invisible Katcha widget programmatically
function initKatcha() {
widgetId = katcha.render("#katcha-container", {
site_key: "YOUR_SITE_KEY",
size: "invisible",
callback: onSolve,
error_callback: onError,
expired_callback: onExpired,
});
}
function onSolve(token) {
// Called after successful challenge solve
console.log("Katcha solved:", token);
document.getElementById("demo-form").submit();
}
function onError(err) {
console.error("Katcha error:", err);
}
function onExpired() {
console.warn("Katcha token expired");
}
function onManualStep(event) {
event.preventDefault();
// 3. Trigger the Katcha workflow programmatically
if (widgetId === null) {
console.error("Widget not yet initialized");
} else {
katcha.execute(widgetId);
}
}
window.onload = initKatcha;
</script>
</head>
<body>
<form id="demo-form" action="/submit" method="POST">
<input type="text" name="name" placeholder="Name" required /><br /><br />
<!-- 4. Widget container -->
<div id="katcha-container"></div>
<br />
<button id="submit-btn" onclick="onManualStep(event)">Submit</button>
</form>
</body>
</html>- The user completes a Katcha challenge (checkbox or interactive challenge).
- Katcha returns a token, which is embedded in your form as
katcha-token. - The user submits the form. The token is sent to your server along with the form data.
Backend
- Your server sends the token, site key, and secret key to the Katcha verify API.
Backend Code Example (Python / Flask)
python
import os
import requests
from flask import Flask, request, jsonify
# Katcha verification API endpoint
KATCHA_VERIFY_URL = "https://api.katcha.eu/katcha/api/verify"
# Your credentials from the Katcha dashboard
SITE_KEY = os.getenv("KATCHA_SITE_KEY", "your_site_key")
SECRET_KEY = os.getenv("KATCHA_SECRET_KEY", "your_secret_key")
app = Flask(__name__)
def verify_katcha_token(token: str) -> dict:
"""
Sends a POST request to Katcha's verify endpoint
and returns a result dict including 'success' (bool)
and any error or response fields.
"""
payload = {
"secret_key": SECRET_KEY,
"site_key": SITE_KEY,
"challenge_id": token,
}
headers = {"Content-Type": "application/json"}
response = requests.post(KATCHA_VERIFY_URL, json=payload, headers=headers)
response.raise_for_status()
data = response.json()
return {
"success": data.get("success", False),
"data": data,
}
@app.route("/login", methods=["POST"])
def login():
# 1) Retrieve token from form POST
token = request.form.get("katcha-token")
if not token:
return jsonify({"error": "Missing Katcha token"}), 400
# 2) Verify token via Katcha API
result = verify_katcha_token(token)
# 3) Decision logic
if result["success"]:
# Token is valid -> proceed with your business logic
return jsonify({"status": "Logged in"}), 200
else:
# Verification failed
return jsonify({
"error": "Verification failed",
"details": result["data"],
}), 403
if __name__ == "__main__":
app.run(debug=True, port=5000)- Katcha verifies the token and returns whether it is valid, allowing your server to determine whether to accept the request.
- Based on the verification result, your server determines that the requester is not a bot and allows the request to proceed (e.g., login or signup). Pretty simple!
3. Integrate with AI Agents
Using an AI coding assistant like Claude Code, Cursor, ChatGPT, or OpenCode? You can integrate Katcha automatically without writing integration boilerplate manually.
1-Click Agent Prompt
Copy this prompt and provide it to your agent:
text
Please read https://docs.katcha.eu/onboard.md and help me integrate Katcha into this project.Machine-Readable Specifications
For deep technical specifications or full context ingestion:
- Agent Onboard Specification: Authoritative integration instructions detailing client script embedding, container placement, token extraction, server verification endpoints, and official SDKs.
- Documentation Index (llms.txt): High-density index of all documentation guides and resources.
- Consolidated Documentation (llms-full.txt): Full technical documentation in a single unified reference.
Desktop Sidebar Widget
You can also use the "Add to your Agent" widget in the right sidebar Table of Contents on any documentation page to launch Claude Code, Cursor, ChatGPT, or copy prompts in one click!