Beta Captcha Tasks API
POSThttps://api.01ai.cloud/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
}
Integration workbench
Shell
Python
JavaScript
Java
Go
PHP
溫馨提示:對於流式請求,上面的代碼可能不完全適用。請參閱對接文檔以進行更改。
hCaptcha 驗證碼識別服務
允许用通用余额
啟用「允許通用餘額」後,專屬餘額不足將自動使用通用餘額。

