Skip to content

Documentation, API v1

API reference

How to send PopularCaptcha image challenges to STACK and submit the answers it returns.

Base URLhttp://stack.local

Introduction

What STACK does

STACK answers PopularCaptcha image challenges. Your client fetches a challenge from PopularCaptcha as usual (the getcaptcha response), sends that object and its images to STACK, and gets back an answers object to submit to PopularCaptcha's checkcaptcha.

STACK does not issue captcha tokens: your client stays in control of the session and submits the answers itself. All requests and responses are JSON over HTTPS, and every endpoint lives under http://stack.local/v1.

Billed only when solved
A challenge that comes back unsolved, an error, a timeout or a busy response is never charged.
Pay as you go or plans
$0.50 per 1,000 solves, or a daily plan with a solve quota at a lower price per solve. See pricing.

Authentication

Send your API key

Every request needs your API key. Find it in the dashboard after signing up; keys start with stk_. Send it in the Authorization header:

Authorization: Bearer stk_your_api_key

A missing or wrong key returns 401 invalid_key. Repeated invalid keys from the same network are throttled with 429 rate_limited.

Warning

Keep your key on the server

Never ship the key in browser code or a public repository. If it leaks, reset it from the dashboard: the old key stops working immediately, and your balance, plan and history stay on your account.

Quick start

First solve in four steps

Create an account
Sign up, then top up from $5.00 or pick a daily plan in the dashboard. Solves are paid from your plan quota or your balance.
Copy your API key
Copy it from the dashboard and export it as STACK_API_KEY.
Send a challenge
Fetch a challenge from PopularCaptcha with your client, then send it with its images to POST /v1/recognition.
Submit the answers
If status is "solved", submit answers to checkcaptcha. If it is "unsolved", fetch a new challenge: you were not charged.
Solve a challenge
curl http://stack.local/v1/recognition \
  -H "Authorization: Bearer $STACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "challenge": {
      "key": "E0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
      "request_type": "image_label_binary",
      "requester_question": { "en": "Please click each image containing a bicycle" },
      "tasklist": [
        { "datapoint_uri": "https://imgs.popularcaptcha.com/a1f3...", "task_key": "6f1c2b9e-..." },
        { "datapoint_uri": "https://imgs.popularcaptcha.com/c47d...", "task_key": "9a0e5d14-..." }
      ]
    },
    "images": {
      "https://imgs.popularcaptcha.com/a1f3...": "/9j/4AAQSkZJRgABAQ...",
      "https://imgs.popularcaptcha.com/c47d...": "/9j/4AAQSkZJRgABAQ..."
    }
  }'

POST /v1/recognition

Recognize a challenge

POST/v1/recognitionAuth: API key

Answers one PopularCaptcha image challenge. The call returns when the challenge is answered (or found unanswerable), so a single request covers the whole challenge.

Request

Headers: Authorization: Bearer stk_... (or X-API-Key) and Content-Type: application/json.

Request body fields
FieldTypeRequiredDescription
challengeobjectyesThe JSON object returned by PopularCaptcha's getcaptcha, unchanged. It must contain request_type and a tasklist of 1 to 40 tasks.
imagesobjectnoMap of image URL to base64-encoded image bytes for the images the challenge references (up to 80 images, 6 MB each). May be omitted when every URL in the challenge is on the captcha provider's image host: STACK then downloads the images itself, which is slower.
Example request
curl http://stack.local/v1/recognition \
  -H "Authorization: Bearer $STACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "challenge": {
      "key": "E0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
      "request_type": "image_label_binary",
      "requester_question": { "en": "Please click each image containing a bicycle" },
      "tasklist": [
        { "datapoint_uri": "https://imgs.popularcaptcha.com/a1f3...", "task_key": "6f1c2b9e-..." },
        { "datapoint_uri": "https://imgs.popularcaptcha.com/c47d...", "task_key": "9a0e5d14-..." }
      ]
    },
    "images": {
      "https://imgs.popularcaptcha.com/a1f3...": "/9j/4AAQSkZJRgABAQ...",
      "https://imgs.popularcaptcha.com/c47d...": "/9j/4AAQSkZJRgABAQ..."
    }
  }'

Response

200 OK means the request was processed. Check status to see whether you got answers.

Response fields
FieldTypeDescription
idstring (uuid)Task id. The same id is listed in the solve log on your dashboard's Usage page.
status"solved" | "unsolved"solved: answers are included and the solve is billed once. unsolved: the recognizer was not confident; answers is null and nothing is charged.
answersobject | nullExactly what goes into checkcaptcha. Submit it as is.
request_typestringThe challenge type, echoed from the challenge.
billed"plan" | "free" | "balance" | nullWhat paid for this solve: your plan's daily quota, a free solve credited by support, or your balance. null when nothing was charged.
costnumberUSD taken from your balance for this request. 0 unless billed is balance.
msnumberTime spent on the request on our side, in milliseconds.
reasonstringOnly on unsolved: why no answers were returned.
Example response
{
  "id": "3d6f0a52-8c1e-4b7a-9f2d-5e8c1a7b4d90",
  "status": "solved",
  "answers": {
    "6f1c2b9e-...": "true",
    "9a0e5d14-...": "false"
  },
  "request_type": "image_label_binary",
  "billed": "balance",
  "cost": 0.0005,
  "ms": 412
}

POST /v1/funcaptcha

Answer a FunCaptcha

POST/v1/funcaptchaAuth: API key

Answers one wave of a FunCaptcha: the game that shows a small puzzle and a pair of arrows, and asks you to cycle to the right picture. Send the game's image, get back the index of the frame to answer with. The endpoint's earlier name, /v1/gamecaptcha, still works.

Warning

It declines rather than guesses

A game STACK cannot read with confidence comes back as status: "unsolved" with a null index, and is not charged. Keep a fallback for declined waves and you lose nothing by trying STACK first.

Supported games

Send the game's own name in variant exactly as the game data gives it; respellings and version suffixes are recognised. Accuracy below was measured on real waves of each game, every answer checked by hand at full size, and is updated as live results come in.

FunCaptcha games STACK answers
GamevariantWhat it asksRightTypical time
Claw machineclaw_machinePick the claw holding the prize shown on the left.35 of 360.4 s
Hopscotchhopscotch_v2Move the person onto the spot the cross marks.7 of 70.7 s
Conveyor beltconveyor_belt_V2The object directly under the claw matches the left image.38 of 460.3 s
PathfinderpathfinderThe character points at the shortest road.8 of 90.1 s
Water cupswaterIconCupThe icon on the left sits on the cup with the most liquid.10 of 130.3 s
Icon matchicon_match, match_game, tile*The frame matching the reference panel.not yet measured live0.2 s
Dice and card pairsdice_pair, card*, numerical*The two matching cells of a six-cell grid.not yet measured live0.2 s
Rotate uprightrotatedTurn the picture the right way up.not yet measured live0.2 s

Every answer carries a confidence. On the checked waves no wrong answer came with a high one, so a caller with a fallback can set min_confidence to 0.5: claw machine was then right on every wave it answered, conveyor belt on 33 of 37.

FunCaptcha games STACK declines today
GamevariantWhy
Dice countMatchDiceIconCountCounting one small symbol across every die's top face is not yet reliable enough to answer.
Rollball3DRollball_v2_*Reading which way the reference animal faces is not yet reliable enough to answer.
Rock groupsrockgroup, rockstackCounting touching rocks is not yet reliable enough to answer.

Request

Every field except game_type and image is optional, and every size is a hint: the recognizer measures the image itself and uses these only as a cross-check. Pass them through from the game data when you have them.

Request body fields
FieldTypeRequiredDescription
game_type1 | 3 | 4yesWhich family the game belongs to. 4 and 1 are strips you arrow through; 3 is a six-cell grid you click once.
imagestring (base64)yesThe game image exactly as it was served, base64-encoded. Up to 8 MB.
variantstringnoThe game's own name for itself, when it gives one. This is the strongest routing signal there is, so send it whenever you have it.
questionstringnoThe instruction text shown to the user, in English, with any markup stripped.
key_size[number, number]noWidth and height of the reference panel, when the game declares one.
answer_size[number, number]noWidth and height of a single answer frame.
wavesnumbernoHow many waves the whole challenge has. One request answers one wave.
wave_indexnumbernoWhich wave this is, counting from 0.
min_confidencenumber (0-1)noDecline rather than answer when the winning margin is below this. Leave it unset to take every answer; raise it only once you have measured how confidence tracks your own pass rate.
always_answerbooleannoReturn a best guess instead of declining. Only worth setting when STACK is your last resort for that wave: a guess costs the wave just as a decline does, but it is charged.
require_validatedbooleannoDecline any game whose reader has never been graded against the captcha's own verdicts. Those games are answered by default and flagged with validated: false; set this when you keep another solver behind STACK and would rather spend money than a wave on an unproven reader.
Answer a wave
curl http://stack.local/v1/funcaptcha \
  -H "Authorization: Bearer $STACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "game_type": 4,
    "variant": "hopscotchv2",
    "question": "Use the arrows to move the person until they are standing on the same icon",
    "image": "<base64 of the game image>",
    "key_size": [125, 200],
    "answer_size": [200, 200],
    "waves": 5,
    "wave_index": 0
  }'

Response

Response fields
FieldTypeDescription
status"solved" | "unsolved"solved: index is set and the wave is billed once. unsolved: the game was declined, index is null and nothing is charged.
indexnumber | nullThe answer, counting from 0. For a strip it is the answer frame to land on (the reference panel is not counted). For a grid it is the cell, left to right then top to bottom.
confidencenumber | nullHow far the winning frame beat the runner-up, from 0 to 1. Useful for logging and for setting min_confidence; it is a margin, not a probability of being right.
validatedbooleanWhether the reader that answered has been graded against the captcha's own verdicts. false means a real reader read the art but nothing has scored it yet. The answer is a genuine attempt, not a guess. Use require_validated to decline these instead.
grid_cellobjectGrid games only: the pixel box of the chosen cell, with its centre as cx and cy, so you can click inside it without recomputing the grid.
billed, cost, ms, idas aboveSame meaning as on /v1/recognition.
Example responses
{
  "id": "7c9a1e40-5b2d-4f81-a3c6-0d7e2f9b4a15",
  "status": "solved",
  "index": 2,
  "confidence": 0.84,
  "validated": true,
  "variant": "hopscotchv2",
  "game_type": 4,
  "billed": "balance",
  "cost": 0.0005,
  "ms": 196
}
A game STACK will not guess at
{
  "id": "4a1d9c73-2f85-4e60-9b17-6c0a8e5d2f39",
  "status": "unsolved",
  "index": null,
  "confidence": null,
  "validated": false,
  "variant": "3d_rollball_animals",
  "game_type": 4,
  "billed": null,
  "cost": 0,
  "ms": 8,
  "reason": "This game could not be answered confidently, so no answer was returned and you were not charged."
}

GET /v1/me

Account and limits

GET/v1/meAuth: API key

Your balance, free solves, current plan and thread usage. Free to call.

GET /v1/me response fields
FieldTypeDescription
balancenumberBalance in USD.
free_solvesnumberFree solves left, when support has credited any (usually 0).
planobject | nullActive plan: id, name, daily_limit, used_today and ends_at (ISO 8601). null on pay as you go.
threadsobjectlimit: concurrent requests allowed; in_use: requests in flight right now.
Example request
curl http://stack.local/v1/me \
  -H "Authorization: Bearer $STACK_API_KEY"
Response
{
  "balance": 12.4805,
  "free_solves": 0,
  "plan": {
    "id": "pro",
    "name": "Pro",
    "daily_limit": 75000,
    "used_today": 18342,
    "ends_at": "2026-11-11T09:30:00+00:00"
  },
  "threads": { "limit": 25, "in_use": 3 }
}

Challenge types

Supported challenge types

STACK reads the type from challenge.request_type; you never have to pick a solver. Every PopularCaptcha image type is covered:

Supported challenge types
Challengerequest_typeWhat you do
Binary selectimage_label_binarySelect every image that matches the prompt.
Area selectimage_label_area_selectClick the point(s) on an image that match the prompt.
Drag and dropimage_drag_dropDrag pieces to the right place.
Video variantsas sent by PopularCaptchaThe video versions of these challenges, sent the same way.
FunCaptcha/v1/funcaptchaArrow-through puzzles and six-cell grids. A separate endpoint, because the answer is one index rather than a set of clicks.

Note

FunCaptcha coverage

The image types above are fully covered. FunCaptcha is covered game by game: see Supported games. The few STACK cannot read yet are declined rather than guessed, and a declined wave is free, so a fallback costs you nothing. New games are added on the server, with no change to your integration.

In every case answers comes back in the shape checkcaptcha expects for that type. A challenge that cannot be answered confidently is returned as unsolved and not charged.

Errors

Error responses

Errors use standard HTTP status codes and always have the same JSON shape. Branch on error.code; the message is meant for humans and may change. Nothing that fails is charged.

Error body
{
  "error": {
    "code": "thread_limit",
    "message": "Thread limit reached: 25 concurrent requests on your plan."
  }
}
Error codes
StatusCodeMeaningCharged
400bad_requestA field is missing or invalid (for example no challenge.tasklist). The message says which.no
400bad_jsonThe body is not a JSON object.no
401invalid_keyThe API key is missing, malformed or has been reset.no
402insufficient_balanceNo plan quota left and the balance cannot pay for a solve.no
402quota_exhaustedToday's plan quota is used up and the balance cannot cover overflow solves.no
403account_bannedThe account is suspended.no
413too_largeThe request body is over 20 MB.no
429thread_limitYour account already has as many requests in flight as it has threads.no
429rate_limitedToo many requests with an invalid API key from your network.no
500internal_errorUnexpected error on our side. Safe to retry.no
502upstream_errorThe recognizer failed on this challenge (other recognizer codes are possible).no
503busyAll solvers are busy. Retry after the Retry-After header.no
504timeoutRecognition took too long.no

Limits and priority

Limits, threads and queue priority

Request limits
LimitValue
Request body20 MB
Tasks per challenge40
Images per request80
Size per image6 MB

Threads

Threads are the number of requests your account can have in flight at once. A request beyond the limit is not queued: it fails immediately with 429 thread_limit (free). Read your limit from GET /v1/me and size your worker pool to match.

Threads and queue priority per option
OptionThreadsDaily solvesQueue priority
Pay as you go10Pay per solve4 of 4, top
Starter55,0001 of 4
Basic1025,0002 of 4
Pro2575,0003 of 4
Enterprise50200,0004 of 4, top

Queue priority

When every solver is busy, requests wait briefly in a queue. Pay as you go and Enterprise share the top level and are served first, then Pro, Basic and Starter, in that order. Within the same level it is first come, first served. If no solver frees up in time you get 503 busy with a Retry-After header, and nothing is charged.

Billing rules

How solves are billed

What is charged
Only solved challenges, once per challenge. Unsolved, errors, timeouts and busy responses are free.
Billing order
Your plan's daily quota (billed: "plan"), then any free solves credited by support ("free"), then your balance at $0.50 per 1,000 ("balance").
Daily reset
Plan quotas reset every day at 00:00 UTC. Solves beyond the quota bill from your balance, so you are never cut off; 402 quota_exhausted appears only when the balance cannot cover them.
Plans
Bought from your balance, monthly or quarterly (3 months for the price of 2). Switching plans credits the unused part of the current one; buying the same plan extends it. Auto-renew renews from balance.
Deposits
From $5.00 in Litecoin, sent straight to STACK and credited after 1 confirmation, or in other crypto through OxaPay. Your balance never expires.

Best practices

Integration checklist

Send images inline
Include every image as base64 in images. Letting STACK download them works for images on the captcha provider's image host but adds latency.
Reuse connections
Keep one HTTP client (a requests.Session, or Node's built-in fetch) for all calls so TLS handshakes are not repeated.
Retry 503 with backoff
Honour Retry-After when present, otherwise back off exponentially with a little jitter. Busy responses are free.
Respect your thread limit
Cap concurrency at threads.limit from /v1/me instead of running into 429 thread_limit.
Use generous timeouts
Allow at least 60 seconds per recognition request.
Retry with backoff
import random
import time


def recognize(payload: dict, attempts: int = 4) -> dict:
    for attempt in range(attempts):
        r = session.post(API, json=payload, timeout=90)
        if r.status_code not in (429, 503) or attempt == attempts - 1:
            break
        # honour Retry-After when present, otherwise back off exponentially with jitter
        wait = float(r.headers.get("Retry-After", 0)) or min(8, 0.5 * 2 ** attempt)
        time.sleep(wait + random.random() * 0.25)
    body = r.json()
    if not r.ok:
        raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
    return body

Support

Getting help

Questions about an integration, a payment or your account? Reach us from your dashboard while signed in. If something looks wrong right now, check the live status page first.