Skip to content

Add to your Agent

Verify a response ​

Verification is a server-to-server POST using Content-Type: application/json. Store your operator-approved full URL as KATCHA_VERIFY_URL on the server. The local widget demo uses a legacy verification path; do not infer or rename the endpoint from product branding. The public Katcha origin is unconfirmed.

Request ​

JSON fieldRequiredDescription
challenge_idYesToken submitted in the browser's katcha-token field
site_keyYesExpected site key from trusted server configuration
secret_keyYesSecret for the same account/site, read only on the server
json
{
  "challenge_id": "TOKEN_FROM_FORM",
  "site_key": "YOUR_SITE_KEY",
  "secret_key": "YOUR_SERVER_ONLY_SECRET"
}

Do not accept a verification URL, expected site key, or success flag from the browser. Treat tokens as single-use and time-limited; verify during the protected request rather than caching a token for later actions.

Response ​

FieldMeaning
successBoolean; only the literal true permits the action
error-codesOptional list of verification errors

Illustrative responses from the v4 contract:

json
{ "success": true }
json
{ "success": false, "error-codes": ["invalid-input-response"] }

The local widget demo confirms request fields and the success check. Error identifiers also exist in the local API catalog. The verification service itself is not present in this workspace, so confirm its response serialization against staging before release. Do not substitute the separate /2/siteverify protocol (sitekey, secret, response) used by some older clients.

Node.js example ​

This framework-neutral helper uses server-side fetch. Supply the form token; it returns false on missing values, HTTP failure, timeout, malformed JSON, or any response without success: true.

js
export async function verifyKatcha(token) {
  const verifyUrl = process.env.KATCHA_VERIFY_URL;
  const siteKey = process.env.KATCHA_SITE_KEY;
  const secretKey = process.env.KATCHA_SECRET_KEY;
  if (typeof token !== 'string' || !token.trim()) return false;
  if (!verifyUrl || !siteKey || !secretKey) return false;
  try {
    const endpoint = new URL(verifyUrl);
    if (endpoint.protocol !== 'https:') return false;
    const response = await fetch(endpoint, {
      method: 'POST',
      redirect: 'error',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        challenge_id: token,
        site_key: siteKey,
        secret_key: secretKey
      }),
      signal: AbortSignal.timeout(5000)
    });
    if (!response.ok) return false;
    const result = await response.json();
    return result?.success === true;
  } catch (error) {
    return false;
  }
}

In your route, after parsing the form, call await verifyKatcha(request.body['katcha-token']). If it returns false, stop before any protected side effect. Otherwise apply normal authentication, authorization, input validation, and CSRF checks. Never log the token or secret, and do not automatically replay verification after a timeout.

Error code reference ​

Error codeMeaning
missing-input-sitekeysite_key is missing
missing-input-secretsecret_key is missing
missing-input-responsechallenge_id is missing
bad-requestInvalid or malformed request
invalid-input-sitekeyInvalid site key
invalid-input-secretInvalid secret
invalid-input-responseInvalid token
timeout-or-duplicateExpired or already used token

Ask for a fresh challenge after expiry or duplicate use. Correct server configuration errors rather than bypassing verification. Do not assume a precise token lifetime without confirmation from your deployment.