概述
JSON 方法
令牌任务
- reCAPTCHA v2
- reCAPTCHA v2 Enterprise
- reCAPTCHA v3
- Cloudflare Turnstile
- GeeTest v3 / v4
- FunCaptcha (Arkose Labs)
- Amazon AWS WAF
- MTCaptcha
- Friendly Captcha
- Lemin Cropped Captcha
- DataDome
- KeyCaptcha
- Capy Puzzle
- Cloudflare Challenge 验证页
- Cutcaptcha
- CyberSiARA
- atbCAPTCHA
- Tencent Captcha
- Prosopo Procaptcha
- CaptchaFox
- Altcha
- NetEase Yidun
- Yandex SmartCaptcha
- VK Captcha
- Binance Captcha
- 自定义任务(Imperva、Temu 等)
UNLOCK API 文档
把验证码作为任务发送,然后取回答案。本 API 使用与其他验证码识别 API 相同的方法名、任务名和错误代码,所以大多数现有代码只需更换主机和密钥即可运行。
请求流程
- 1
createTask创建任务
使用您的密钥和任务对象发送POST /createTask请求。您将获得一个taskId。任务费用将从您的余额中扣除。
- 2
getTaskResult查询结果
等待约 5 秒,然后每 5 秒 POST 一次 /getTaskResult,直到 status 为 ready。
- 3
solution使用答案
将解决方案中的令牌或文本填入页面表单。如果任务失败,费用将退还至您的余额。
基本信息
- 基础 URL
https://unlock-api.com- API 密钥
- 32 个字符,在账户页面上。以 clientKey(JSON)或 key(in.php、res.php)发送。
- 格式
- JSON 方法:POST,请求体为 JSON。in.php 和 res.php:GET 或 POST 表单字段;加上 json=1 可获得 JSON 回复。
- 限制
- 每个账户每分钟 1,200 次请求,包含结果查询。创建任务后等待约 5 秒,然后每 5 秒查询一次。
- 时间限制
- 未在5分钟内解决的任务将失败,并返回ERROR_CAPTCHA_UNSOLVABLE错误,费用将退还至您的余额。
- 计费
- 任务费用在创建任务时扣除。失败任务自动退款。
快速开始
用 JSON 方法识别一个 reCAPTCHA v2。把 YOUR_API_KEY 换成你的密钥。
import time, requests
API = "https://unlock-api.com"
KEY = "YOUR_API_KEY"
task = requests.post(f"{API}/createTask", json={
"clientKey": KEY,
"task": {
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://example.com/login",
"websiteKey": "6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo"
}
}).json()
if task["errorId"]:
raise SystemExit(task["errorCode"])
for _ in range(60): # 60 x 5 s = the 5 minute task limit
time.sleep(5)
r = requests.post(f"{API}/getTaskResult", json={"clientKey": KEY, "taskId": task["taskId"]}).json()
if r["errorId"]:
raise SystemExit(f"{r['errorCode']}: {r.get('errorDescription', '')}") # failed tasks are refunded
if r["status"] == "ready":
print(r["solution"]["gRecaptchaResponse"])
break
else:
raise SystemExit("timed out")const API = "https://unlock-api.com";
const KEY = "YOUR_API_KEY";
const post = (path, body) => fetch(API + path, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) }).then((r) => r.json());
const task = await post("/createTask", {
clientKey: KEY,
task: {
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://example.com/login",
"websiteKey": "6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo"
},
});
if (task.errorId) throw new Error(task.errorCode);
let solution = null;
for (let n = 0; n < 60 && !solution; n++) { // 60 x 5 s = the 5 minute task limit
await new Promise((r) => setTimeout(r, 5000));
const r = await post("/getTaskResult", { clientKey: KEY, taskId: task.taskId });
if (r.errorId) throw new Error(r.errorCode + ": " + r.errorDescription); // failed tasks are refunded
if (r.status === "ready") solution = r.solution;
}
if (!solution) throw new Error("timed out");
console.log(solution.gRecaptchaResponse);<?php
$api = "https://unlock-api.com";
$key = "YOUR_API_KEY";
function post($url, $body) {
$c = curl_init($url);
curl_setopt_array($c, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode($body)]);
return json_decode(curl_exec($c), true);
}
$task = post("$api/createTask", ["clientKey" => $key, "task" => json_decode('{"type":"RecaptchaV2TaskProxyless","websiteURL":"https://example.com/login","websiteKey":"6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo"}', true)]);
if ($task["errorId"]) exit($task["errorCode"]);
for ($n = 0; $n < 60; $n++) { // 60 x 5 s = the 5 minute task limit
sleep(5);
$r = post("$api/getTaskResult", ["clientKey" => $key, "taskId" => $task["taskId"]]);
if ($r["errorId"]) exit($r["errorCode"] . ": " . $r["errorDescription"]); // failed tasks are refunded
if ($r["status"] === "ready") break;
}
if ($r["status"] !== "ready") exit("timed out");
print_r($r["solution"]["gRecaptchaResponse"]);package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
)
const api = "https://unlock-api.com"
const key = "YOUR_API_KEY"
func post(method string, body map[string]any) map[string]any {
b, _ := json.Marshal(body)
res, err := http.Post(api+"/"+method, "application/json", bytes.NewReader(b))
if err != nil {
panic(err)
}
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
return out
}
func main() {
task := post("createTask", map[string]any{
"clientKey": key,
"task": map[string]any{
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://example.com/login",
"websiteKey": "6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo",
},
})
if task["errorId"].(float64) != 0 {
panic(task["errorCode"])
}
for n := 0; n < 60; n++ { // 60 x 5 s = the 5 minute task limit
time.Sleep(5 * time.Second)
r := post("getTaskResult", map[string]any{"clientKey": key, "taskId": task["taskId"]})
if r["errorId"].(float64) != 0 {
panic(r["errorCode"]) // failed tasks are refunded
}
if r["status"] == "ready" {
fmt.Println(r["solution"])
return
}
}
panic("timed out")
}import java.net.URI;
import java.net.http.*;
import java.util.regex.*;
public class Solve {
static final String API = "https://unlock-api.com", KEY = "YOUR_API_KEY";
static final HttpClient HTTP = HttpClient.newHttpClient();
static String post(String method, String json) throws Exception {
var req = HttpRequest.newBuilder(URI.create(API + "/" + method))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json)).build();
return HTTP.send(req, HttpResponse.BodyHandlers.ofString()).body();
}
public static void main(String[] args) throws Exception {
String task = "{\"type\":\"RecaptchaV2TaskProxyless\",\"websiteURL\":\"https://example.com/login\",\"websiteKey\":\"6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo\"}";
String created = post("createTask", "{\"clientKey\":\"" + KEY + "\",\"task\":" + task + "}");
Matcher id = Pattern.compile("\"taskId\":(\\d+)").matcher(created);
if (!id.find()) throw new RuntimeException(created);
for (int n = 0; n < 60; n++) { // 60 x 5 s = the 5 minute task limit
Thread.sleep(5000);
String r = post("getTaskResult", "{\"clientKey\":\"" + KEY + "\",\"taskId\":" + id.group(1) + "}");
if (r.contains("\"errorId\":1")) throw new RuntimeException(r); // failed tasks are refunded
if (r.contains("\"status\":\"ready\"")) { System.out.println(r); return; }
}
throw new RuntimeException("timed out");
}
}using System.Net.Http.Json;
using System.Text.Json;
const string Api = "https://unlock-api.com";
const string Key = "YOUR_API_KEY";
var http = new HttpClient();
async Task<JsonElement> Post(string method, object body) =>
await (await http.PostAsJsonAsync($"{Api}/{method}", body)).Content.ReadFromJsonAsync<JsonElement>();
var task = await Post("createTask", new {
clientKey = Key,
task = JsonSerializer.Deserialize<JsonElement>("""
{"type":"RecaptchaV2TaskProxyless","websiteURL":"https://example.com/login","websiteKey":"6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo"}
""")
});
if (task.GetProperty("errorId").GetInt32() != 0) throw new Exception(task.GetProperty("errorCode").GetString());
for (var n = 0; n < 60; n++) { // 60 x 5 s = the 5 minute task limit
await Task.Delay(5000);
var r = await Post("getTaskResult", new { clientKey = Key, taskId = task.GetProperty("taskId").GetInt64() });
if (r.GetProperty("errorId").GetInt32() != 0) throw new Exception(r.GetProperty("errorCode").GetString()); // failed tasks are refunded
if (r.GetProperty("status").GetString() == "ready") { Console.WriteLine(r.GetProperty("solution")); return; }
}
throw new Exception("timed out");curl -s https://unlock-api.com/createTask \
-H "Content-Type: application/json" \
-d '{"clientKey":"YOUR_API_KEY","task":{"type":"RecaptchaV2TaskProxyless","websiteURL":"https://example.com/login","websiteKey":"6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo"}}'
# {"errorId":0,"taskId":1001}
curl -s https://unlock-api.com/getTaskResult \
-H "Content-Type: application/json" \
-d '{"clientKey":"YOUR_API_KEY","taskId":1001}'
# {"errorId":0,"status":"processing"} then {"errorId":0,"status":"ready","solution":{...},"cost":"0.001"}方法
createTask创建任务并返回其ID。任务类型的费用在任务被接受时从您的余额中扣除,并在任务失败时退还。getTaskResult返回任务的状态。任务正在处理时,状态为“processing”。任务完成后,状态为“ready”,solution字段包含答案。失败的任务返回errorId 1及原因,其费用已退还至您的余额。getBalance返回账户剩余的余额,单位为美元。getToken创建任务并在同一个请求中等待答案,最长 50 秒。如果届时任务未完成,会返回 status processing 和 taskId;请继续用 getTaskResult 查询。getToken 任务不发送结果回调。getQueueStats返回当前队列:等待中的任务、识别中的任务,以及最近一小时的平均识别时间。数字来自真实任务,不是估算。getSpendingStats按小时返回某个 UTC 日的消费:任务数和花费金额。失败和已退款的任务不计入。reportCorrect, reportIncorrect报告答案正确或错误。接受这些调用是为了让现有库继续正常工作;报告不会改变扣费。test用于调试的回显。返回收到的 JSON 请求体,去掉 clientKey。不检查密钥,不收费。
指南
任务类型
每种类型都有单独页面,列出全部参数、solution 对象和示例。
令牌任务
- reCAPTCHA v2
RecaptchaV2TaskProxylessuserrecaptcha - reCAPTCHA v2 Enterprise
RecaptchaV2EnterpriseTaskProxylessuserrecaptcha, enterprise=1 - reCAPTCHA v3
RecaptchaV3TaskProxylessuserrecaptcha, version=v3 - Cloudflare Turnstile
TurnstileTaskProxylessturnstile - GeeTest v3 / v4
GeeTestTaskProxylessgeetest, geetest_v4 - FunCaptcha (Arkose Labs)
FunCaptchaTaskProxylessfuncaptcha - Amazon AWS WAF
AmazonTaskProxylessamazon_waf - MTCaptcha
MtCaptchaTaskProxylessmt_captcha - Friendly Captcha
FriendlyCaptchaTaskProxylessfriendly_captcha - Lemin Cropped Captcha
LeminTaskProxylesslemin - DataDome
DataDomeSliderTaskdatadome - KeyCaptcha
KeyCaptchaTaskProxylesskeycaptcha - Capy Puzzle
CapyTaskProxylesscapy - Cloudflare Challenge 验证页
AntiCloudflareTaskcloudflare_challenge - Cutcaptcha
CutCaptchaTaskProxylesscutcaptcha - CyberSiARA
AntiCyberSiAraTaskProxylesscybersiara - atbCAPTCHA
AtbCaptchaTaskProxylessatb_captcha - Tencent Captcha
TencentTaskProxylesstencent - Prosopo Procaptcha
ProsopoTaskProxylessprosopo - CaptchaFox
CaptchaFoxTaskProxylesscaptchafox - Altcha
AltchaTaskProxylessaltcha - NetEase Yidun
YidunTaskProxylessyidun - Yandex SmartCaptcha
YandexSmartCaptchaTaskProxylessyandex - VK Captcha
VKCaptchaTaskProxylessvkcaptcha - Binance Captcha
BinanceTaskProxylessbinance - 自定义任务(Imperva、Temu 等)
CustomTaskincapsula, temuimage, hunt, tspd, basilisk