Skip to content

Quickstart

This page solves a reCAPTCHA v2 task with a test key. Test keys (nop_test_…) run in the sandbox: nothing is charged, no real solver is called, and every example on this site works with them unchanged. Switch to a live key (nop_live_…) when you are ready.

  1. Create a test key in the console: API keys → Create key, mode Test. The key is shown only once; store it as an environment variable:

    Terminal window
    export NOPTCHA_KEY=nop_test_...
  2. Pick an API. If your software already speaks the anti-captcha protocol, use the compatibility API; otherwise the native API (v1) is simpler: one request can wait for the result.

  3. Run one of the examples below. The Python examples need pip install requests. The Node.js examples need Node.js 22 or later (they use the built-in fetch and top-level await); save them as .mjs files, for example node solve.mjs.

POST /v1/tasks with Prefer: wait=60 waits up to 60 seconds and returns the finished task (HTTP 200). If the task is not finished by then you get HTTP 202 and poll GET /v1/tasks/{id}. The Idempotency-Key header makes a retry after a network error return the same task instead of creating a second one.

Terminal window
export NOPTCHA_KEY=nop_test_... # your test or live key
# waits up to 60 s; 200 = finished (solved or failed), 202 = still processing
IDEMPOTENCY_KEY=$(uuidgen) # one key per task you want; a retry of the same request reuses it
curl -s -X POST "https://api.noptcha.com/v1/tasks" \
-H "Authorization: Bearer $NOPTCHA_KEY" \
-H 'Prefer: wait=60' \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"type": "recaptcha.v2",
"params": {
"website_url": "https://www.google.com/recaptcha/api2/demo",
"website_key": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
}
}
EOF
# on 202: long-poll with the "id" from the response
TASK_ID=...
curl -s "https://api.noptcha.com/v1/tasks/$TASK_ID?wait=60" \
-H "Authorization: Bearer $NOPTCHA_KEY"

A solved task looks like this (in the sandbox the token is NOPTCHA_TEST_TOKEN_<task id>):

{
"id": "7259140378796032",
"type": "recaptcha.v2",
"status": "solved",
"solution": { "token": "NOPTCHA_TEST_TOKEN_7259140378796032", "user_agent": "Mozilla/5.0 (Noptcha test)" },
"error": null,
"cost": { "amount": "0.000000", "currency": "USD" },
"sandbox": true
}

Fields left out here: params, metadata, created_at, completed_at. See the task object.

POST /createTask returns a taskId; then call POST /getTaskResult every 1–3 seconds until status is ready.

Terminal window
export NOPTCHA_KEY=nop_test_... # your test or live key
# 1. create the task
curl -s -X POST "https://api.noptcha.com/createTask" \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"clientKey": "$NOPTCHA_KEY",
"task": {
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://www.google.com/recaptcha/api2/demo",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
}
}
EOF
# 2. poll with the taskId from step 1 every few seconds until "status" is "ready"
TASK_ID=...
curl -s -X POST "https://api.noptcha.com/getTaskResult" \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"clientKey": "$NOPTCHA_KEY",
"taskId": $TASK_ID
}
EOF
{
"errorId": 0,
"status": "ready",
"solution": { "gRecaptchaResponse": "NOPTCHA_TEST_TOKEN_7259140378796032", "userAgent": "Mozilla/5.0 (Noptcha test)" },
"cost": "0.000000"
}

getTaskResult also returns createTime, endTime, solveCount and ip.

The sandbox simulates outcomes from magic values: set website_key (compatibility API: websiteKey) to test-unsolvable, test-timeout, test-proxy-error or test-slow-5 and run the same code. See Sandbox.

The Python and Node.js SDKs wrap the native API: one call creates the task and waits for the solution, with retries, idempotency keys and typed errors built in.