Issue a challenge

Called from the visitor's browser, on the page that embeds the widget — not from your server, and not from inside an iframe on our origin. The request must be cross-origin so the browser attaches Origin, which is what the domain allowlist is checked against.

POST /api/v1/challenge

Rate limited to about 10 requests per second per IP. Also answers OPTIONS.

Parameter Type Required Description
sitekey string yes your public sitekey, max 64 characters. May also be sent as a query parameter.
accessible 1/true/yes no ask for the non-visual path. Honoured only if the site allows it; see Accessibility.

The request must carry an Origin header whose hostname is covered by the site's domain allowlist. Do not send cookies.

curl -X POST https://privcaptcha.com/api/v1/challenge \
  -H "Origin: https://example.com"; \
  -d "sitekey=pk_your_sitekey"
{
  "success": true,
  "challenge_id": "8Zq4...opaque...",
  "type": "slider",
  "prompt": "captcha.prompt.slider",
  "hint": { "width": 320, "height": 200, "piece": 56, "piece_y": 74 },
  "images": ["scene", "piece"],
  "pow": { "challenge": "9f3c...", "bits": 14 },
  "ttl": 120
}
Field Meaning
challenge_id opaque handle. Pass it to /api/v1/solve and use it to fetch images.
type slider, rotate, pick or powonly. Chosen server-side; you cannot request one.
prompt translation key for the instruction text, resolved client-side.
hint public layout facts needed to draw and interact. Never contains the answer.
images image names to fetch, e.g. ["scene", "piece"]. Empty for powonly.
pow.challenge the proof-of-work challenge string.
pow.bits required leading zero bits.
ttl seconds the challenge stays solvable (120 by default).

The hint differs per type: slider gives width, height, piece, piece_y; rotate gives size; pick gives width, height and the target shape name; powonly gives an empty object.

Out of quota

When the account has exhausted both its monthly quota and its credits, no challenge is issued:

{ "success": false, "error-codes": ["quota-exhausted"], "unavailable": true }

Treat unavailable as "not an error": show a quiet state rather than a failure, so the host page keeps working.

Failures

missing-input-sitekey, invalid-input-sitekey, invalid-input-origin. See Error codes.

GET /api/v1/challenge/{cid}/{name}

The challenge image, as WebP.

Path parameter Description
cid the challenge_id, max 64 characters
name an entry from images, max 16 characters. A trailing .webp is accepted and stripped.

Returns image/webp, or 404 with an empty body if the challenge has expired, been solved, or never existed. Images are single-use and are not cached — the response carries Cache-Control: no-store. They are served with Access-Control-Allow-Origin: *, which is safe because the image is opaque: it carries no secret and no cookie.