API documentation

Everything you need to send your first challenge.

Quickstart

The API is wire-compatible with the standard recognition protocol: you POST a challenge, get a job id back immediately, then GET that id until the answer is ready. Two calls, no websockets.

Base URL — every path below is relative to this host.

1. Submit the challenge

curl -X POST "$BASE/v1/recognition/hcaptcha" \
  -H "X-API-Key: sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{"data": {"request_type": "image_label_binary", "tasklist": [...]}}'

# → {"data": "9f2c1e40-5b7a-4c3d-8e11-2a6f0b9d4c88"}

2. Poll until it resolves

curl "$BASE/v1/recognition/hcaptcha?id=9f2c1e40-…" \
  -H "X-API-Key: sk_your_key"

# still working → {"error": "pending"}
# done         → {"data": [[true, false, true, …]]}

Poll every 200–500 ms. Most challenges resolve in well under a second.

Authentication

Send your key in whichever way suits your client — all four are accepted:

MethodExample
Header (recommended)X-API-Key: sk_…
Query string?key=sk_…
Body field{"apikey": "sk_…"}
Inside data{"data": {"apikey": "sk_…"}}
Treat your key like a password. It spends your credits and cannot be rotated by you — ask an administrator if it leaks.

Keys are issued from the admin panel. Track usage on your dashboard.

Credits & threads

Credits

  • 1 credit = 1 solve. One credit is deducted the moment a job is accepted.
  • Failures are refunded. If the solver errors out, the credit returns to your balance — you only pay for answers.
  • At zero credits, submissions are rejected with 402 Payment Required.
  • Keys marked unlimited (∞ in the dashboard) are never charged.

Thread limit

  • Each key has a maximum number of jobs that may run at the same time.
  • Submitting past that limit returns 429 Too Many Requests — the request is not queued.
  • A slot frees up as soon as a job finishes, successfully or not.
  • A limit of 0 means unlimited concurrency.
Sizing tip. Run roughly as many worker threads as your key's limit. Higher just produces 429s; lower leaves throughput on the table.

Submit a challenge

POST/v1/recognition/hcaptcha

Request body

FieldTypeDescription
dataobjectThe raw challenge object from hCaptcha.
data.request_typestringChallenge type — see below.
data.tasklistarrayTasks, each with a datapoint_uri.
data.requester_questionobjectPrompt text, keyed by language (en preferred).

datapoint_uri accepts both an external URL and an inline data: URI — remote images are downloaded server-side.

Response

{ "data": "9f2c1e40-5b7a-4c3d-8e11-2a6f0b9d4c88" }

The string is your job id. It stays valid for 10 minutes.

Poll for the result

GET/v1/recognition/hcaptcha?id=<job_id>
StateResponse
pending{"error": "pending"}
done{"data": <answer>}
error{"error": "<message>"}

The shape of data depends on the challenge type — see the next section. An unknown job id returns 404.

Report the outcome

POST/v1/feedback

Tell the solver whether hCaptcha accepted the answer. Nothing else in the pipeline carries this information — without it the solver cannot tell a correct answer from a confident wrong one, so reporting is the single biggest thing you can do to improve accuracy on your own traffic.

{ "job_id": "<the id returned by submit>", "ok": true }

Challenges with more than one slide

Some challenges show two or more slides in a row, and hCaptcha returns a single verdict at the end covering all of them. Report them together, in one call, using job_ids:

{ "job_ids": ["<slide 1 id>", "<slide 2 id>"], "ok": false }

This matters: a pass means every slide was answered correctly, while a failure only means at least one of them was wrong. Sent together, we can tell the two cases apart. Sent as separate calls, a single bad slide would be blamed on every challenge type in the session.

FieldTypeNotes
job_idstringThe id you received from submit. Use this for a single-slide challenge.
job_idsstring[]All slide ids of one challenge, in order. Use instead of job_id when the challenge had more than one slide.
okbooleanRequired. true if hCaptcha accepted, false if it rejected. success and passed are accepted as aliases.

Response

{ "ok": true, "stored": 2, "boards": 2 }

boards is how many ids you sent, stored how many were still on record. Always returns 200, including for an unknown or expired id — reporting must never be able to break your client. Send the call after hCaptcha has returned its verdict; it is fire-and-forget, so you do not need to wait for the response.

Health check

GET/health

Unauthenticated. Useful for load balancers and uptime monitors.

{ "status": "ok", "jobs": 3 }

Challenge types

image_label_binary

Yes/no per image — "select each image containing a bus".

// one boolean per task, wrapped in an outer array
{ "data": [[true, false, true, true, false]] }

image_drag_drop

Drag each entity onto its target. Coordinates are percentages of the background image; w and h echo the entity size in pixels.

{ "data": [[
  {
    "entity_id": "e0",
    "entity_name": "e0",
    "x": 62.4, "y": 38.1,
    "w": 63,   "h": 63
  }
]] }
"Drag the shape into / to its matching outline" needs the piece image in entity_uri. These boards show only the empty outlines; the solid shape you drag is a separate hCaptcha sprite that is not part of the background datapoint, so the solver cannot see it. Capture that sprite (the draggable element) and send it on the entity as entity_uri — a base64 data-URI (same form as example_uri) or an https URL:
{ "request_type": "image_drag_drop",
  "entities": [
    { "entity_id": "e0",
      "entity_uri": "data:image/png;base64,iVBOR…" // the shape sprite
    }
  ], … }
With the sprite present the solver matches the shape to the correct outline. If the entity arrives empty (entity_uri missing, size: null) it can only drop on an outline, not reliably the right one.

area_select · image_label_area_select

A list of points per image, in percentages. Most tasks need one click (list of one), but some — e.g. "click the TWO identical elements" — need several clicks in the same image, returned as multiple points.

{ "data": [
  [ { "x": 47.2, "y": 51.8, "w": 0, "h": 0 } ],
  [ { "x": 14.4, "y": 15.4, "w": 0, "h": 0 },
    { "x": 88.1, "y": 15.0, "w": 0, "h": 0 } ]
] }
Any other request_type fails the job with unsupported request_type — and refunds your credit.

Animated challenges (video)

Some challenges are animations, not still images — for example "click the animal the ball never touches" (the ball bounces between the animals) or "click the flower the bee never lands on". The answer depends on what happens over time, so a single screenshot is only a guess (about 1 in 5). To get a real answer, send several frames of the same animation.

Update your client. If you send one screenshot per request for these challenges, accuracy stays at ~20%. With 15–20 frames it is close to 100%.

Option A — one request with all frames (recommended)

  1. When the challenge appears, capture the whole canvas (same size every time, banner included) every ~200 ms for 3–4 seconds → 15–20 frames.
  2. Send them in order in a frames array on the task. Keep datapoint_uri = the last frame.
  3. Click the returned point. Do not click before you have the answer.
{ "data": {
  "request_type": "image_label_area_select",
  "tasklist": [{
    "task_key": "t0",
    "question": "click the animal the ball never touches",
    "datapoint_uri": "data:image/png;base64,…(last frame)",
    "frames": [
      "data:image/png;base64,…(frame 1)",
      "data:image/png;base64,…(frame 2)",
      "…",
      "data:image/png;base64,…(frame 18)"
    ]
  }]
} }

Up to 40 frames are used. datapoint_uris is accepted as an alias of frames, and a direct link to a video file in datapoint_uri also works (it is split into frames server-side). One request = one credit.

Option B — one frame per request, repeated

If your client can only send one image per request, send the same challenge again every ~300 ms, each time with a new screenshot. The server recognises the scene and accumulates what it has seen (memory: 4 minutes). Stop as soon as the answer says need_frames: false, then click. Each request costs one credit, so option A is cheaper.

Reading the answer

For these challenges every returned point carries extra fields:

{ "data": [[ {
  "x": 80.45, "y": 66.27, "w": 0, "h": 0,
  "confidence": 0.9,
  "need_frames": false,   // true = still a guess, send more frames
  "frames_seen": 18,      // frames of this scene the server has seen
  "untouched": 1          // candidates left (1 = decided)
} ]] }
need_framesWhat to do
falseThe answer is decided — click it.
trueSend more frames of the same animation (option A: a longer burst; option B: the next screenshot). If it is still true after ~6 seconds of frames, click the returned point anyway (best guess).

Older clients that ignore these fields keep working — they just get the guess. need_frames is currently reported for the ball challenge; for the bee challenge send frames the same way (option A).

Python example (option A)

import base64, time, requests

def capture_frames(grab, n=18, every=0.2):
    # grab() returns PNG bytes of the whole challenge canvas
    out = []
    for _ in range(n):
        out.append("data:image/png;base64," + base64.b64encode(grab()).decode())
        time.sleep(every)
    return out

frames = capture_frames(grab)
task = {"task_key": "t0", "question": question,
        "datapoint_uri": frames[-1], "frames": frames}
job = requests.post(BASE + "/v1/recognition/hcaptcha", headers={"X-API-Key": KEY},
                    json={"data": {"request_type": "image_label_area_select",
                                   "tasklist": [task]}}).json()["data"]
while True:
    r = requests.get(BASE + "/v1/recognition/hcaptcha", params={"id": job},
                     headers={"X-API-Key": KEY}).json()
    if r.get("error") != "pending": break
    time.sleep(0.3)
p = r["data"][0][0]
if p.get("need_frames"):
    pass   # optional: capture more frames and resend, or click p anyway
click(p["x"], p["y"])   # percentages of the canvas

Error codes

StatusMeaningWhat to do
401 Invalid or missing API key Check the key; it may have been disabled.
402 No credits left Top up before retrying — retries won't succeed.
404 Job not found The id is wrong or older than 10 minutes.
429 Thread limit reached Wait for an in-flight job, then retry.

Error bodies always carry a detail string explaining the cause.

Code examples

Python

import time, requests

BASE = "$BASE"
KEY  = "sk_your_key"
H    = {"X-API-Key": KEY}

def solve(challenge, timeout=30):
    r = requests.post(f"{BASE}/v1/recognition/hcaptcha",
                      json={"data": challenge}, headers=H)
    r.raise_for_status()
    job_id = r.json()["data"]

    deadline = time.time() + timeout
    while time.time() < deadline:
        res = requests.get(f"{BASE}/v1/recognition/hcaptcha",
                           params={"id": job_id}, headers=H).json()
        if "data" in res:
            return res["data"]
        if res.get("error") != "pending":
            raise RuntimeError(res["error"])
        time.sleep(0.3)

    raise TimeoutError("solve timed out")

Node.js

const BASE = "$BASE";
const KEY  = "sk_your_key";
const H    = { "X-API-Key": KEY, "Content-Type": "application/json" };

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function solve(challenge, timeoutMs = 30000) {
  const res = await fetch(`${BASE}/v1/recognition/hcaptcha`, {
    method: "POST", headers: H,
    body: JSON.stringify({ data: challenge }),
  });
  if (!res.ok) throw new Error(`submit failed: ${res.status}`);
  const { data: jobId } = await res.json();

  const deadline = Date.now() + timeoutMs;
  while (Date.now() < deadline) {
    const out = await (await fetch(
      `${BASE}/v1/recognition/hcaptcha?id=${jobId}`, { headers: H })).json();
    if (out.data !== undefined) return out.data;
    if (out.error !== "pending") throw new Error(out.error);
    await sleep(300);
  }
  throw new Error("solve timed out");
}
Handling 429. Both examples throw on a thread-limit rejection. In production, catch it and retry with a short backoff instead of failing the whole task.