hCaptchaTask#
Token-based method of hCaptcha. The method is very similar to
reCAPTCHA V2 . The token can be used on the target website within the h-captcha-response form field or passed to a callback function.
HCaptchaTask Task object structure#
name type Required Description type String Yes HCaptchaTask
websiteURL String Yes The complete URL of the target page, where the Captcha is loaded websiteKey String Yes hCaptcha website key. Can be found in the `data-sitekey` attribute of the hCaptcha div element or the `sitekey` parameter of a request to the hCaptcha API isInvisible Boolean No Works with hCaptcha invisible version - no checkbox but challenge will appear. Typically used with callback functions enterprisePayload Object No An Object containing additional parameters, such as: `rqdata` proxyType String Yes Proxy type:`http`, `socks4`, `socks5` proxyAddress String Yes Proxy server IP address or hostname proxyPort Integer Yes proxy port proxyLogin String No Proxy login name proxyPassword String No Proxy login password
Request example#
API endpoint: https://api.nextcaptcha.com/createTask
method: POST
Content type: application/json
{
"clientKey" : "api key" ,
"task" : {
"type" : "HCaptchaTask" ,
"websiteURL" : "https://hcaptcha.com/demo/hcaptcha" ,
"websiteKey" : "f7de0da3-3303-44e8-ab48-fa32ff8ccc7b" ,
"isInvisible" : false ,
"enterprisePayload" : {
"rqdata" : "eyJ0eXAi"
},
"proxyType" : "http" ,
"proxyAddress" : "your_proxy_address" ,
"proxyPort" : 1234 ,
"proxyLogin" : "your_proxy_login" ,
"proxyPassword" : "your_proxy_password"
}
}
Response example#
{
"errorId" : 0 ,
"status" : "ready" ,
"solution" : {
"respKey" : "E0_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9" ,
"userAgent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299" ,
"gRecaptchaResponse" : "P1_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"
},
"createTime" : 1701234567890 ,
"endTime" : 1701234567890
}
Sample Code#
# https://github.com/nextcaptcha/nextcaptcha-python
import os
import sys
from nextcaptcha import NextCaptchaAPI
client_key = os.getenv( 'NEXTCAPTCHA_KEY' , "YOUR_CLIENT_KEY" )
api = NextCaptchaAPI( client_key = client_key)
try :
result = api.hcaptcha( website_url = "https://example.com" , website_key = "SITE_KEY" )
except Exception as e:
sys.exit(e)
else :
sys.exit( 'solved: ' + str (result))
// https://github.com/nextcaptcha/nextcaptcha-go
package main
import (
" fmt "
" log "
" github.com/nextcaptcha/nextcaptcha-go "
)
func main () {
api := nextcaptcha. NewNextCaptchaAPI ( "API_KEY" )
result, err := api. HCaptcha ( "https://example.com" , "SITE_KEY" , nextcaptcha . RecaptchaV3Options {})
if err != nil {
log. Fatal (err);
}
fmt. Println ( "result " + result)
}
// https://github.com/nextcaptcha/nextcaptcha-csharp
string clientKey = "YOUR_CLIENT_KEY" ;
string solftId = "" ; // Optional
string callbackUrl = "" ; // Optional
bool openLog = true ; // Optional
var nextCaptchaAPI = new NextCaptchaAPI (clientKey, solftId, callbackUrl, openLog);
string websiteUrl = "https://example.com" ;
string websiteKey = "YOUR_WEBSITE_KEY" ;
bool isInvisible = false ; // Optional
Dictionary < string , object > enterprisePayload = null ; // Optional
string proxyType = "" ; // Optional
string proxyAddress = "" ; // Optional
int proxyPort = 0 ; // Optional
string proxyLogin = "" ; // Optional
string proxyPassword = "" ; // Optional
var result = await nextCaptchaAPI. SolveHCaptchaAsync (websiteUrl, websiteKey, isInvisible, enterprisePayload, proxyType, proxyAddress, proxyPort, proxyLogin, proxyPassword);
Related Links#