Skip to content

Captcha Verification ​

The /captcha endpoint verifies an answer submitted for a challenge-mode captcha: send back the token from the X-Captcha-Token header, along with the text the user typed.

Parameters ​

The request body must be JSON:

ParameterRequiredDescription
tokenYesToken from the X-Captcha-Token header
answerYesText typed by the user. Case-insensitive, trimmed

Response Fields ​

FieldTypeDescription
validbooleantrue if the answer matches
reasonstringWhy it was rejected — absent when valid is true

Rejection Reasons ​

ReasonMeaning
wrongThe answer does not match the image
expiredThe token is older than 5 minutes
usedThe token was already redeemed — each one works exactly once
invalidThe token is malformed

Code Examples ​

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "token": "eyJ...",
    "answer": "a4Kf2p"
  }' \
  "https://api.sylvain.sh/v6/captcha"

Try It ​

Error Handling ​

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
Please provide a token (?token={token})The token is missing
Please provide an answer (&answer={answer})The answer is missing
  • GET /v6/captcha - Generate a captcha in challenge mode
  • GET /v6/pow - Proof of work, the recommended alternative