Skip to content

Create Challenge

POST /api/v1/captcha/challenge

Creates a new CAPTCHA challenge for the specified site. The client solves the returned proof-of-work and then submits the solution to /verify.

Request Body

json
{
  "siteKey": "site1",
  "siteSecret": "secret1",
  "clientAddress": "192.168.1.100"
}
FieldRequiredDescription
siteKeyyesKey of the configured site (see Site Configuration).
siteSecretyesMatching site secret. Issued out-of-band to the calling backend.
clientAddressyesSource IP of the end user. Used by SourceAddressService for allow-list checks and difficulty calc.

Response

json
{
  "challenge": {
    "parameters": {
      "algorithm": "SHA-256",
      "nonce": "abc123...",
      "salt": "def456...",
      "cost": 1000,
      "keyLength": 32,
      "keyPrefix": "00",
      "keySignature": null,
      "memoryCost": null,
      "parallelism": null,
      "expiresAt": 1778916660,
      "data": null
    },
    "signature": "ghi789..."
  }
}

This is the standard ALTCHA challenge object, ready to be passed to the ALTCHA widget or any ALTCHA-compatible solver.

FieldDescription
challengeALTCHA challenge object. Pass it to the widget or solver unchanged.
challenge.parametersProof-of-work parameters the client must satisfy.
challenge.parameters.algorithmKey-derivation algorithm. CaptchaService uses SHA-256 (iterative SHA-256).
challenge.parameters.nonceRandom server-issued nonce used as part of the proof-of-work input.
challenge.parameters.saltRandom salt for key derivation. Must be echoed back on /verify unchanged.
challenge.parameters.costWork factor (KDF iterations). Larger = harder. Set via the site's difficulty map.
challenge.parameters.keyLengthLength of the derived key in bytes.
challenge.parameters.keyPrefixHex prefix the derived key must start with.
challenge.parameters.keySignatureOptional HMAC of the expected derived key (deterministic verification). Not used by CaptchaService (null).
challenge.parameters.memoryCostMemory cost for memory-hard algorithms (e.g. Argon2). null for SHA-256.
challenge.parameters.parallelismParallelism for memory-hard algorithms. null for SHA-256.
challenge.parameters.expiresAtUnix timestamp (seconds) after which verification fails. Set from captcha.captcha-timeout-seconds (default 300).
challenge.parameters.dataOptional custom metadata attached to the challenge. null unless configured.
challenge.signatureHMAC signature over the parameters. Proves the challenge was minted by this CaptchaService. Verified on /verify.

The challenge is valid for captcha.captcha-timeout-seconds (default 300). After that, verification will return valid: false.