Quick start
Solve your first reCAPTCHA with the NeuroCaptcha API: get a key, create a task, fetch the token.
本节内容以英文显示。
NeuroCaptcha is an HTTP API that returns reCAPTCHA tokens. It speaks the Anti-Captcha JSON protocol (createTask → getTaskResult) and the 2Captcha in.php / res.php protocol, so most existing integrations only need a new host.
| API host | https://neurocaptcha.com |
| Format | POST with a JSON body; every answer is HTTP 200 with errorId (0 = success) |
| Authentication | clientKey in the body — see Authentication |
| Specification | OpenAPI 3.1 · all methods |
1. Get an API key#
Sign up and open Dashboard → API keys. Create a test key first: its tasks are free and come back in a couple of seconds with a fake token that starts with TEST_ — enough to build and test the whole integration. Switch to a live key when it works.
2. Create a task#
Send the page address and the reCAPTCHA site key. The answer comes at once with taskId. The price is held on your balance and charged only if the task is solved.
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://www.google.com/recaptcha/api2/demo",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
}
}{
"errorId": 0,
"taskId": 7781
}3. Get the token#
Call getTaskResult every 2–3 seconds. While the task is in progress you get "status": "processing", then "ready" with the token in solution.gRecaptchaResponse.
{
"clientKey": "YOUR_API_KEY",
"taskId": 7781
}{
"errorId": 0,
"status": "ready",
"solution": {
"gRecaptchaResponse": "03AFcWeA6Z3vq0VhGm1oS8r0bAxKk4…",
"userAgent": ""
},
"cost": "0.000600",
"ip": "198.51.100.7",
"createTime": 1793370000,
"endTime": 1793370007,
"solveCount": 1
}Put the token into the g-recaptcha-response field of the form (or pass it to the page's callback) and submit it within about 2 minutes — Google tokens expire quickly. The result itself is kept for 10 minutes.
Complete example#
import os
import time
import requests
API = "https://neurocaptcha.com"
KEY = os.environ["API_KEY"]
def call(method, payload):
data = requests.post(f"{API}/{method}", json={"clientKey": KEY, **payload}, timeout=30).json()
if data.get("errorId"):
raise RuntimeError(f'{data["errorCode"]}: {data.get("errorDescription", "")}')
return data
task = {
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://www.google.com/recaptcha/api2/demo",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
}
# 1. create the task: its price is held, not charged
task_id = call("createTask", {"task": task})["taskId"]
# 2. poll every 2 s; a failed task raises with its error code and costs nothing
deadline = time.time() + 300
while time.time() < deadline:
time.sleep(2)
result = call("getTaskResult", {"taskId": task_id})
if result["status"] == "ready":
print(result["solution"]["gRecaptchaResponse"])
break
else:
raise TimeoutError("the task was not solved in time")Errors#
Any errorId other than 0 is an error; the answer then has errorCode and errorDescription. A task that failed (ERROR_CAPTCHA_UNSOLVABLE, ERROR_RECAPTCHA_TIMEOUT, proxy errors) is not charged — just create a new one. All codes: Errors.
{
"errorId": 1,
"errorCode": "ERROR_KEY_DOES_NOT_EXIST",
"errorDescription": "Account authorization key not found in the system."
}