Web - Forms

Free Captcha API Endpoint

The free captcha API endpoint gives your form a picture of shapes, digits and letters to click in an order, at one of four levels. At normal the question names three of six symbols, and the browser finds a number whose SHA-256 starts with 18 zero bits. The levels hard and harder ask for more work and give a rule for the order of the digits and letters the question names, and at hardest the picture comes turned and is turned upright first. Your server checks the clicks and the number together, once. There is no cookie, no key and no third party.

  • No API key
  • Four levels
  • No cookie
  • Checked once

Make a challenge

GET/captcha

https://aisenseapi.com/services/v1/captcha

Call the free captcha API endpoint

curl https://aisenseapi.com/services/v1/captcha

{"id":"3f2b8c1e-7a4d-4e9b-9c3a-5d6e7f8a9b0c","level":"normal","expires_at":"2026-11-20T15:42:07Z","expires_in":1800,"proof_of_work":{"algorithm":"SHA-256","salt":"9f86d081884c7d659a2feaa0c55ad015","bits":18,"task":"Find a whole number nonce from 0 to 9007199254740991 so that SHA-256 of the salt followed by the nonce in decimal starts with 18 zero bits."},"verify":"https://aisenseapi.com/services/v1/captcha_verify/3f2b8c1e-7a4d-4e9b-9c3a-5d6e7f8a9b0c/{nonce}","click":{"question":"Click in this order: 6, P, square","targets":["6","P","square"],"count":3,"image":"data:image/png;base64,iVBORw0KGgo...","width":360,"height":240,"clicks":"The three points clicked, in the order asked, in picture pixels: x-y joined by _, for example 120-45_200-130_30-90.","verify":"https://aisenseapi.com/services/v1/captcha_verify/3f2b8c1e-7a4d-4e9b-9c3a-5d6e7f8a9b0c/{nonce}/{clicks}"}}

curl https://aisenseapi.com/services/v1/captcha_verify/3f2b8c1e-7a4d-4e9b-9c3a-5d6e7f8a9b0c/57473/293-186_72-171_61-67

{"valid":true,"checked":["proof_of_work","click"],"level":"normal"}

Two calls. The first makes a challenge with its picture, the second checks a nonce and the clicks against it once. Between them, the person clicks the symbols the question asks for, and their browser does the work while they fill in the form: at normal 262,144 SHA-256 tries on average, about a second on a desktop and a few seconds on an older phone.

Try it

Try it here. Your browser fetches a challenge and solves its proof of work while you click the three symbols the question names. Then it checks both once.

Four levels

The level is the one path argument, and /captcha is the same as /captcha/normal. Each level gives a harder click task than the one before, and up to harder more work too.

LevelProof of workPictureWhat to click
/captcha
normal
18 bits, 262,144 tries on averageSix symbols, 360 by 240The three symbols the question names, in its order
/captcha/hard
hard
19 bits, twice the workSix symbols, 360 by 240Four symbols by a rule: the two digits and the two letters, each group in the order the question gives
/captcha/harder
harder
20 bits, four times the workNine symbols, 360 by 360Five symbols by a rule that also picks: the three digits in an order, and the two letters that come first, or last, in the alphabet
/captcha/hardest
hardest
20 bits, the same as harderNine symbols, 360 by 360, turned by one to four steps of 72 degreesAs at harder, on the picture turned upright first

A question at hard reads, for example, "Click the digits from smallest to largest, then the letters from Z to A. The digits are 7 and 3, the letters K and E.", and one at harder "Click the digits from largest to smallest, then the two letters that come first in the alphabet, from A to Z. The digits are 4, 9 and 2, the letters R, F and K." The question names the digits and letters in the order they were drawn, so the person knows what to look for, and the rule decides the order to click them in. The shapes are there to be left alone. At hard, harder and hardest the answer leaves out click.targets, which would give the rule away, and click.count says how many points to click.

At hardest the picture comes turned clockwise by one to four steps of 72 degrees, and never upright, and the question starts "Turn the picture upright first." The answer gives the step as click.turn_step and never says how far the picture is turned. Show the picture round, so its corners do not show as it turns, let the person turn it in steps of click.turn_step degrees with buttons or the arrow keys, and clear the clicks at every turn. The clicks are the points of the upright picture, measured from the middle of the picture as it is shown, so a picture clicked while still turned gives wrong_clicks. The digits and letters at hardest leave out 6, 9, M, W and N, which can be taken for others when turned, and the shapes lie at any angle, so none of them points the way up.

Measured in a desktop browser, the proof of work takes 0.9 s on average at normal, 1.9 s at hard and 3.7 s at harder and hardest, and it runs while the person clicks. Every challenge counts once toward the 500 an address may make a day, whatever its level.

How it fits a form

  1. Your page fetches a challenge from /captcha, /captcha/hard, /captcha/harder or /captcha/hardest, or your server fetches one and puts it in the page.
  2. The page shows click.image under click.question and records as many clicks as click.count, in picture pixels. A picture shown at another size scales its clicks back to click.width by click.height. At hardest the page first lets the person turn the picture upright in steps of click.turn_step degrees.
  3. A short script in the page solves the proof of work meanwhile, and puts the id, the nonce and the clicks, written x-y joined by _, in three hidden fields.
  4. Your server calls /captcha_verify/{id}/{nonce}/{clicks} and accepts the form only on "valid": true with click in checked and the level it asks for. The browser chose which challenge to fetch, so a bot could fetch a normal one where you want harder. A check made in the browser proves nothing, since anyone can skip it.

A challenge can be checked once, within 30 minutes. A wrong answer uses it up as well, so the check cannot be used to test guesses. Without the clicks, the call checks the proof of work only.

The script for your page

async function solve(salt, bits) {
  const enc = new TextEncoder();
  const channel = new MessageChannel();
  const turn = () => new Promise(resolve => { channel.port1.onmessage = () => resolve(); channel.port2.postMessage(0); });
  let last = performance.now();
  try {
    for (let nonce = 0; nonce <= Number.MAX_SAFE_INTEGER; nonce++) {
      const d = new Uint8Array(await crypto.subtle.digest('SHA-256', enc.encode(salt + nonce)));
      let zero = 0;
      for (const b of d) { if (b === 0) { zero += 8; continue; } zero += Math.clz32(b) - 24; break; }
      if (zero >= bits) return nonce;
      if (performance.now() - last > 10) { await turn(); last = performance.now(); }
    }
    return null;
  } finally {
    channel.port1.close();
  }
}

const { width, height, count } = challenge.click;
const turnStep = challenge.click.turn_step || 0;
let turned = 0;
const clicks = [];
// At hardest: buttons or the arrow keys call turnBy(1) or turnBy(-1).
function turnBy(steps) {
  turned = (turned + steps * turnStep + 360) % 360;
  image.style.transform = 'rotate(' + turned + 'deg)';
  clicks.length = 0;
}
image.addEventListener('click', function (event) {
  const box = image.getBoundingClientRect();
  const x = Math.round((event.clientX - box.left - box.width / 2) / image.clientWidth * width + width / 2);
  const y = Math.round((event.clientY - box.top - box.height / 2) / image.clientHeight * height + height / 2);
  if (clicks.length < count) clicks.push(x + '-' + y);
});

The solver: awaiting a digest does not give the page a turn, so a loop of digests alone holds the page until it is done. About every 10 ms the solver hands the page a turn through a MessageChannel, which keeps typing and clicking smooth at the same hash rate. It runs on the page itself, so a strict Content Security Policy needs no worker rule. crypto.subtle needs a page served over HTTPS. Read bits from the answer every time, since it can change. A test vector for a solver of your own: with the salt 9f86d081884c7d659a2feaa0c55ad015 and 18 bits, the smallest nonce is 57473, and with 19 or 20 bits it is 255819, whose digest starts with 21 zero bits.

The clicks: the handler measures a click from the middle of the picture, which stays where it is when the picture turns, maps it from the size the picture is shown at back to its click.width by click.height pixels, takes as many as click.count, and the form sends clicks.join('_'). At hardest the page's turn buttons and arrow keys call turnBy, which clears the clicks. A page with a Content Security Policy needs img-src data: for the picture.

What the two calls return

GET /captcha

FieldTypeDescription
idstringThe challenge, a version 4 UUID. It works as a key to the challenge until it is checked or expires.
levelstringnormal, hard, harder or hardest.
expires_atstringWhen the challenge can no longer be checked, ISO 8601 in UTC.
expires_inintegerThe same in seconds from now: 1800.
proof_of_work.algorithmstringSHA-256.
proof_of_work.saltstring32 hexadecimal characters, new for every challenge.
proof_of_work.bitsintegerHow many zero bits the digest must start with: 18 at normal, 19 at hard and 20 at harder and hardest.
proof_of_work.taskstringThe task in words.
verifystringThe link that checks a nonce alone, with {nonce} to fill in.
click.questionstringThe question. At normal it names three symbols in the order to click, at hard, harder and hardest it gives the rule. At hardest it starts "Turn the picture upright first."
click.targetsarrayOnly at normal: the same three names, a shape by its word, a digit or a letter by itself.
click.countintegerHow many points to click: 3 at normal, 4 at hard and 5 at harder and hardest.
click.imagestringThe picture, a PNG in color as a data URL: the six symbols, nine at harder and hardest, overlapping a little and blurred, among colored lines, fragments and clutter. At hardest it comes turned.
click.widthinteger360, the picture pixels the clicks are counted in.
click.heightinteger240, or 360 at harder and hardest.
click.turn_stepintegerOnly at hardest: 72, the degrees of one step. The picture comes turned by one to four steps, never upright, and the clicks are those of the picture turned upright.
click.clicksstringHow to write the clicks.
click.verifystringThe link that checks the nonce and the clicks, with {nonce} and {clicks} to fill in.

GET /captcha_verify/{id}/{nonce}/{clicks}

FieldTypeDescription
validbooleanTrue when the nonce solves the challenge, the clicks hit the symbols asked for in order, and this is the first check.
checkedarrayWhat was checked: proof_of_work, and click when clicks were sent.
reasonstringOnly when valid is false: wrong_nonce, wrong_clicks, expired, used or unknown.
levelstring or nullThe level of the challenge, to compare with the one your form asks for. Null when it was used or unknown.

Every well-formed path answers 200. A nonce in another spelling, such as 0079, one over 9007199254740991, clicks that are not three to five points inside the picture, an id that is not a version 4 UUID, or a level other than normal, hard, harder or hardest answers 400 with error and fix and uses nothing up. The id may come in any case.

What it stops, and what it does not

A bot that posts your form without running the script fails every time, and so does one that cannot tell which symbol is which. Every attempt costs the sender CPU time as well. The picture is noisy and blurred on purpose, so scripts and image models have a hard time reading it, and a person may need a new picture now and then. It does not tell a person from a machine for certain: a script with native SHA-256 solves 18 bits in milliseconds, and a guess of three symbols in order passes about one time in 120 at normal, of four in order one time in 360 at hard, and of five of nine in order one time in 15,120 at harder. Keep the limits of your own form beside it, such as attempts per address and accounts per day, and give people who cannot see the picture another way in, such as an email address to write to.

Privacy and limits

The challenge keeps no address and sets no cookie, and nothing goes to a third party. The clicks are checked once and not kept. The id works as a key until it is checked or 30 minutes have passed, so send it only to your own server.

The service-wide limit is 5000 requests per IP per day, with no key and no account behind it, and each of the two calls counts once. Each address may also make 500 challenges a day, and a Pro plan more by its tier; past that the answer is 429 until the daily reset. Every endpoint on the service is listed in the free public REST APIs reference.