Beta Captcha Tasks API
POSThttps://api.yxai-tech.top/captcha/tasks
查询异步验证码任务的处理状态与最终结果;处理中和终态失败不会产生解题费用。
请求头
acceptstring
Specifies the format of the response from the server.
请选择
authorizationstring
Bearer token
请求体
task_idstring必填参数
The task id returned when a token API was called with async=true.
响应
成功200
OK, the request is successful.
响应体
textstring
The recognized text for recognition/image2text. Present only when status is 'ready'.
typestring
任务类型。
tokenstring
The solved verification token (token APIs). Present only when status is 'ready'.
api_idstring
该任务所属接口的 ID。
statusstring
Persisted task state. 'processing' means the server is still working; 'ready' means the result is stored. Reading processing state has no lifecycle or billing side effects.
elapsednumber
Processing time in seconds (float, 3 decimals). Absent while the task is still processing.
successboolean
Whether the query succeeded.
task_idstring
The task id being polled.
user_idstring
发起该任务的账号 ID。
solutionobject
The recognition result for recognition/recaptcha2 and recognition/hcaptcha. Present only when status is 'ready'.
object <string, unknown>
trace_idstring
本次请求的追踪 ID,排查问题时提供给技术支持。
started_atnumber
When the task began processing, as a Unix timestamp in seconds (float).
finished_atnumber
When the task produced its result, as a Unix timestamp in seconds (float). Absent while the task is still processing.
actor_user_idstring
实际执行者的账号 ID。通过授权代发时与 `user_id` 不同。
credential_idstring
发起该任务所用凭证的 ID。
application_idstring
该任务计费所用应用的 ID。
authorization_idstring
该任务使用的授权 ID。未通过授权发起时为 null。
示例
{
"token": "P1_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1Ni......",
"status": "ready",
"success": true,
"task_id": "61138bb6-19aa-11ec-a9c8-0242ac110002"
}失败400invalid_query
Bad request, possibly due to a missing task_id.
响应体
object <string, unknown>
示例
{
"error": {
"code": "invalid_query",
"message": "no task_id specified"
},
"trace_id": "2efa9340-b21b-4e26-9e14-4aac95f343ab"
}失败401invalid_token
Unauthorized, invalid or missing authorization token.
响应体
object <string, unknown>
示例
{
"error": {
"code": "invalid_token",
"message": "The specified token is invalid or wrong."
},
"trace_id": "2efa9340-b21b-4e26-9e14-4aac95f343ab"
}失败404not_found
The specified task_id does not exist.
响应体
object <string, unknown>
示例
{
"error": {
"code": "not_found",
"message": "task not found"
},
"trace_id": "2efa9340-b21b-4e26-9e14-4aac95f343ab"
}失败504timeout
The server-managed task reached its 120-second deadline without a result. Repeated reads return the same timeout, and the task is not charged.
响应体
codestring
The terminal task timeout code.
detailstring
A stable description of the terminal task failure.
statusstring
elapsednumber
Processing time before the terminal failure, in seconds.
successboolean
task_idstring
The task id that reached a terminal failure.
started_atnumber
When the task began processing, as a Unix timestamp in seconds.
finished_atnumber
When the task reached its terminal failure, as a Unix timestamp in seconds.
示例
{
"code": "timeout",
"detail": "The captcha task timed out.",
"status": "failed",
"elapsed": 112.4,
"success": false,
"task_id": "61138bb6-19aa-11ec-a9c8-0242ac110002",
"started_at": 1784885653,
"finished_at": 1784885765.4
}
集成指南
Shell
Python
JavaScript
Java
Go
PHP
温馨提示:对于流式请求,上面的代码可能不完全适用。请参阅对接文档以进行更改。
hCaptcha 验证码识别服务
允许用通用余额
启用「允许通用余额」后,专属余额不足将自动使用通用余额。

