### Example Request Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 This is a generic example request. Please refer to specific API endpoint documentation for details. ```text /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD36lpKM0hC0U0GlzTGLRSZozQAUUZpM8gYoADSUppKAClpKTcAcEjPpQAUuaSigBwNLmmilHWkIDxTSwpXOASe3Nee+JfEE9nfyhJB5G0oybQd3JyB+FMDc/4Su3h1l7KdsKMYOD/dz2FdHHKJEDL0NeFW3iKWzulivlARM/IFweR7kH0r2LQtVi1jTVuoAfLLFR07H2JosBrZpajzSg+lIB9GcGmbh0yM1E7EXMQHcGhDLBNJTWdVHzMF9MnFG8eo9vemIWs+Yf8AE5Q5/wCWY/8A0q/zV5T/AOnSDP8Ayw/9CkA0TSUUtMYoozSg0hBRRmjNAx1FJS0AUtFFFAH//2Q== ``` -------------------------------- ### RecaptchaV3Task Example Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/480739330/reCaptcha%2Bv2%2Bv3%2BK1%2Bseries%2Bcustomized%2Bfingerprint%2Blist This example demonstrates the parameters for creating a RecaptchaV3Task. Ensure the website key and action are correctly specified for the target website. ```string RecaptchaV3Task| 6Lcyqq8oAAAAAJE7eVJ3aZp_hnJcI6LgGdYD8lge| demo_action| https://2captcha.com/demo/recaptcha-v3 ``` -------------------------------- ### HTTP POST Request Example in C# Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/64194653 This snippet demonstrates how to send a POST request with data to a specified URL, commonly used for submitting tasks to the YesCaptcha API. It handles request setup, sending data, and reading the response. ```csharp public string POST(string posturl, byte[] data, System.Text.Encoding encoding) { try { //设置参数 request = WebRequest.Create(posturl) as HttpWebRequest; CookieContainer cookieContainer = new CookieContainer(); request.CookieContainer = cookieContainer; request.AllowAutoRedirect = true; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; outstream = request.GetRequestStream(); outstream.Write(data, 0, data.Length); outstream.Close(); //发送请求并获取相应回应数据 response = request.GetResponse() as HttpWebResponse; //直到request.GetResponse()程序才开始向目标网页发送Post请求 instream = response.GetResponseStream(); sr = new StreamReader(instream, encoding); //返回结果网页(html)代码 string content = sr.ReadToEnd(); string err = string.Empty; return content; } catch (Exception ex) { string err = ex.Message; return string.Empty; } } ``` -------------------------------- ### C# DEMO: Yescaptcha Example Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/63897603/YesCaptcha%2BAPI This C# code provides a basic example of how to interact with the YesCaptcha API. It includes placeholders for API key and task details, demonstrating the structure for sending requests. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; public class YesCaptchaClient { private readonly string _apiKey; private readonly HttpClient _httpClient; private const string CreateTaskEndpoint = "https://api.yescaptcha.com/createTask"; private const string GetTaskResultEndpoint = "https://api.yescaptcha.com/getTaskResult"; public YesCaptchaClient(string apiKey) { _apiKey = apiKey; _httpClient = new HttpClient(); } public async Task CreateRecaptchaV2TaskAsync(string siteKey, string url) { var taskPayload = new { type = "NoCaptchaTaskProxyless", websiteURL = url, websiteKey = siteKey }; var requestPayload = new { clientKey = _apiKey, task = taskPayload }; var jsonPayload = JsonConvert.SerializeObject(requestPayload); var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync(CreateTaskEndpoint, content); response.EnsureSuccessStatusCode(); var responseJson = await response.Content.ReadAsStringAsync(); var createTaskResult = JsonConvert.DeserializeObject(responseJson); if (createTaskResult.status == true) { return createTaskResult.taskId.ToString(); } else { throw new Exception($"Failed to create task: {createTaskResult.errorDescription}"); } } public async Task GetTaskResultAsync(string taskId) { var requestPayload = new { clientKey = _apiKey, taskId = taskId }; var jsonPayload = JsonConvert.SerializeObject(requestPayload); var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync(GetTaskResultEndpoint, content); response.EnsureSuccessStatusCode(); var responseJson = await response.Content.ReadAsStringAsync(); var getTaskResult = JsonConvert.DeserializeObject(responseJson); if (getTaskResult.status == true) { return getTaskResult.solution.gRecaptchaResponse.ToString(); } else { // Handle cases where the task is not yet solved or failed // You might want to implement polling logic here return null; // Or throw an exception } } public static async Task Main(string[] args) { string apiKey = "YOUR_API_KEY"; // Replace with your actual API key string siteKey = "YOUR_SITE_KEY"; // Replace with the website's reCaptcha site key string pageUrl = "YOUR_WEBSITE_URL"; // Replace with the URL of the page containing the reCaptcha YesCaptchaClient client = new YesCaptchaClient(apiKey); try { Console.WriteLine("Creating reCaptcha task..."); string taskId = await client.CreateRecaptchaV2TaskAsync(siteKey, pageUrl); Console.WriteLine($"Task created with ID: {taskId}"); // In a real application, you would poll GetTaskResultAsync until a result is available // For demonstration, we'll wait a bit and then try to get the result Console.WriteLine("Waiting for task to complete (simulated)..."); await Task.Delay(20000); // Simulate waiting time Console.WriteLine("Getting task result..."); string recaptchaToken = await client.GetTaskResultAsync(taskId); if (!string.IsNullOrEmpty(recaptchaToken)) { Console.WriteLine($"Successfully solved reCaptcha. Token: {recaptchaToken}"); // Use the token to submit the form on the target website } else { Console.WriteLine("Task not yet solved or failed."); } } catch (Exception ex) { Console.WriteLine($"An error occurred: {ex.Message}"); } } } ``` -------------------------------- ### Task Creation Response Example Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/2916435/RecaptchaV2EnterpriseTaskProxyless%2BreCaptcha%2BV2 This is an example of a successful response after creating a task. The taskId is crucial for retrieving the task results later. ```json { "errorId": 0, "errorCode": "", "errorDescription": "", "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006" } ``` -------------------------------- ### Send POST Request and Get Response in C# Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/64194653/English%2BC%2BDEMO%2Bdemo_c%2B.cs This method sends a POST request to a specified URL with given data and returns the content of the response. It handles web request setup, sending data, and reading the response stream. Includes basic error handling for exceptions. ```csharp try { // 设置参数 request = WebRequest.Create(posturl) as HttpWebRequest; CookieContainer cookieContainer = new CookieContainer(); request.CookieContainer = cookieContainer; request.AllowAutoRedirect = true; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; outstream = request.GetRequestStream(); outstream.Write(data, 0, data.Length); outstream.Close(); //发送请求并获取相应回应数据 response = request.GetResponse() as HttpWebResponse; //直到request.GetResponse()程序才开始向目标网页发送Post请求 instream = response.GetResponseStream(); sr = new StreamReader(instream, encoding); //返回结果网页(html)代码 string content = sr.ReadToEnd(); string err = string.Empty; return content; } catch (Exception ex) { string err = ex.Message; return string.Empty; } ``` -------------------------------- ### C# DEMO Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/64192513/YesCaptcha+Documentation A basic C# example for interacting with the YesCaptcha API. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; public class YesCaptchaClient { private readonly string _apiKey; private readonly HttpClient _httpClient; public YesCaptchaClient(string apiKey) { _apiKey = apiKey; _httpClient = new HttpClient(); _httpClient.BaseAddress = new Uri("https://api.yescaptcha.com/"); } public async Task CreateTaskAsync(string taskType, string websiteURL, string websiteKey) { var payload = new { clientKey = _apiKey, task = new { type = taskType, websiteURL = websiteURL, websiteKey = websiteKey } }; var jsonPayload = System.Text.Json.JsonSerializer.Serialize(payload); var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync("createTask", content); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); return responseBody; } // Add other methods like getTaskResult, getBalance etc. } // Example Usage: // var client = new YesCaptchaClient("YOUR_CLIENT_KEY"); // var result = await client.CreateTaskAsync("NoCaptchaTaskProxyless", "https://www.google.com/recaptcha/api2/demo", "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"); // Console.WriteLine(result); ``` -------------------------------- ### getTaskResult Response Example (Success) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/196857/getTaskResult This example demonstrates a successful response from the getTaskResult API. It indicates that the task is ready and provides the recognition result in the 'solution' object. ```json { "errorId": 0, "errorCode": null, "errorDescription": null, "solution": { "gRecaptchaResponse": "03AGdBq25SxXT-pmSeBXjzScW-EiocHwwpwqtk1QXlJnGnUJCZrgjwLLdt7cb0..." }, "status": "ready" } ``` -------------------------------- ### getTaskResult Response Example (Success) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/196857 This example shows a successful response from the getTaskResult API. The status is 'ready', and the result is available in the 'solution' object, with the specific key like 'gRecaptchaResponse' depending on the task type. ```json { "errorId": 0, "errorCode": null, "errorDescription": null, "solution": { "gRecaptchaResponse": "03AGdBq25SxXT-pmSeBXjzScW-EiocHwwpwqtk1QXlJnGnUJCZrgjwLLdt7cb0..." }, "status": "ready" } ``` -------------------------------- ### Example reCaptchaV3 Action Values Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/57573377 This snippet shows example 'action' values identified during the debugging process. The first action is for submitting an email during signup, and the second is for a successful registration. ```javascript "website/signup/submit_email" ``` ```javascript "website/signup/success" ``` -------------------------------- ### RecaptchaV3Task for Account Sign-In Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/480739330/reCaptcha%2Bv2%2Bv3%2BK1%2Bseries%2Bcustomized%2Bfingerprint%2Blist This example shows a RecaptchaV3Task for signing into an account, with the action 'SIGN_IN'. ```string RecaptchaV3Task| 6LdHW1kpAAAAAMQ4itbdu1urGNh9v86jzGdLBMrM| SIGN_IN| https://account.weverse.io/ ``` -------------------------------- ### Example output of findRecaptchaClients function Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/12746875 This is an example of the structured data returned by the `findRecaptchaClients()` function, showing details for a reCaptcha V2 instance. ```json [ { "id": "0", "version": "V2", "sitekey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", "function": "onSuccess", "callback": "___grecaptcha_cfg.clients['0']['l']['l']['callback']", "pageurl": "https://www.google.com/recaptcha/api2/demo" } ] ``` -------------------------------- ### Cloudflare 5s Shield Response Example Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/389382145/CloudFlareTask%2BCloudFlare5S This is an example of the JavaScript code returned by Cloudflare for its 5-second challenge. It includes parameters for challenge verification and script loading. ```javascript "window['__CF$cv$params']={r:'7f49dfe16af64c78',t:'MTY5MTY4NzY1OS44MjgwMDA='};_cpo=document.createElement('script');_cpo.nonce='',_cpo.src='/cdn-cgi/challenge-platform/scripts/invisible.js',document.getElementsByTagName('head')[0].appendChild(_cpo);";var _0xh = document.createElement('iframe');_0xh.height = 1;_0xh.width = 1;_0xh.style.position = 'absolute';_0xh.style.top = 0;_0xh.style.left = 0;_0xh.style.border = 'none';_0xh.style.visibility = 'hidden';document.body.appendChild(_0xh);function handler() {var _0xi = _0xh.contentDocument || _0xh.contentWindow.document;if (_0xi) {var _0xj = _0xi.createElement('script');_0xj.innerHTML = js;_0xi.getElementsByTagName('head')[0].appendChild(_0xj);}}if (document.readyState !== 'loading') {handler();} else if (window.addEventListener) {document.addEventListener('DOMContentLoaded', handler);} else {var prev = document.onreadystatechange || function () {};document.onreadystatechange = function (e) {prev(e);if (document.readyState !== 'loading') {document.onreadystatechange = prev;handler();}};}})(); " ``` -------------------------------- ### RecaptchaV3Task for Booking Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/480739330/reCaptcha%2Bv2%2Bv3%2BK1%2Bseries%2Bcustomized%2Bfingerprint%2Blist This example is for a RecaptchaV3Task used in a booking process, with the action 'offerPrice'. ```string RecaptchaV3Task| 6Lcm8KYoAAAAAGaf_2goMQJA0x27uc6kTbCmledR| offerPrice| https://flyflair.com/booking/upselling ``` -------------------------------- ### RecaptchaV3Task for Account Activation Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/480739330/reCaptcha%2Bv2%2Bv3%2BK1%2Bseries%2Bcustomized%2Bfingerprint%2Blist This example shows a RecaptchaV3Task for account activation, with the action 'activate_account'. ```string RecaptchaV3Task| 6LegcCkpAAAAAIBOzAFyLf47Bji3Enn9LThscFzx| activate_account| https://auth-live.gop3.nl/ ``` -------------------------------- ### RecaptchaV2Task for Instacart Signup Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/480739330/reCaptcha%2Bv2%2Bv3%2BK1%2Bseries%2Bcustomized%2Bfingerprint%2Blist This example shows a RecaptchaV2Task for Instacart signup, with no specific action provided. ```string RecaptchaV2Task| 6LeN0vMZAAAAAIKVl68OAJQy3zl8mZ0ESbkeEk1m| -| https://www.instacart.com/signup ``` -------------------------------- ### RecaptchaV3Task for Zealy Login Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/480739330/reCaptcha%2Bv2%2Bv3%2BK1%2Bseries%2Bcustomized%2Bfingerprint%2Blist This example shows a RecaptchaV3Task for logging into Zealy, with the action 'email_connection'. ```string RecaptchaV3Task| 6LcSxLwoAAAAANXNkGTUHXqfaw2V4nIArm6u4xfk| email_connection| https://zealy.io/login ``` -------------------------------- ### Get Balance Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 This snippet shows how to retrieve your current account balance. It's essential for managing your credits. ```javascript const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; async function getBalance() { try { const response = await axios.post('https://api.yescaptcha.com/getBalance', { clientKey: apiKey }); console.log('Account balance:', response.data); } catch (error) { console.error('Error getting balance:', error.response ? error.response.data : error.message); } } getBalance(); ``` -------------------------------- ### Get Task Result Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 After creating a task, you need to poll this endpoint periodically to get the result. Replace 'YOUR_TASK_ID' with the actual task ID received from the createTask response. ```javascript const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const taskId = 'YOUR_TASK_ID'; // Replace with the actual task ID async function getTaskResult() { try { const response = await axios.post('https://api.yescaptcha.com/getTaskResult', { clientKey: apiKey, taskId: taskId }); console.log('Task result:', response.data); if (response.data.status === 'ready') { console.log('Captcha solution:', response.data.solution.text); } else { console.log('Task not ready yet. Status:', response.data.status); } } catch (error) { console.error('Error getting task result:', error.response ? error.response.data : error.message); } } // It's recommended to poll this function with a delay, e.g., every 5 seconds // setInterval(getTaskResult, 5000); getTaskResult(); ``` -------------------------------- ### Solve ReCAPTCHA V2 (Python) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 Python example for solving ReCAPTCHA V2. Requires the website URL and site key. ```python import requests import json api_key = 'YOUR_API_KEY' website_url = 'WEBSITE_URL' website_key = 'WEBSITE_KEY' url = "https://api.yescaptcha.com/createTask" payload = { "clientKey": api_key, "task": { "type": "RecaptchaV2TaskProxyless", "websiteURL": website_url, "websiteKey": website_key } } try: response = requests.post(url, json=payload) response.raise_for_status() print("ReCAPTCHA V2 task created:", response.json()) except requests.exceptions.RequestException as e: print(f"Error creating ReCAPTCHA V2 task: {e}") if e.response: print(f"Response data: {e.response.json()}") ``` -------------------------------- ### Get Balance (Python) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 Python script to check your YesCaptcha account balance. Essential for monitoring your credits. ```python import requests import json api_key = 'YOUR_API_KEY' url = "https://api.yescaptcha.com/getBalance" payload = { "clientKey": api_key } try: response = requests.post(url, json=payload) response.raise_for_status() print("Account balance:", response.json()) except requests.exceptions.RequestException as e: print(f"Error getting balance: {e}") if e.response: print(f"Response data: {e.response.json()}") ``` -------------------------------- ### ImageToTextTask with Base64 Image (Python) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 Python example for solving CAPTCHAs using a base64 encoded image. This is an alternative to using image URLs. ```python import requests import json api_key = 'YOUR_API_KEY' image_base64 = 'YOUR_BASE64_ENCODED_IMAGE' url = "https://api.yescaptcha.com/createTask" payload = { "clientKey": api_key, "task": { "type": "ImageToTextTask", "body": { "base64Image": image_base64 } } } try: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes print("Task created:", response.json()) except requests.exceptions.RequestException as e: print(f"Error creating task: {e}") if e.response: print(f"Response data: {e.response.json()}") ``` -------------------------------- ### HCaptcha Image Recognition Interface Tutorial (Python) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 This Python example demonstrates how to integrate with the HCaptcha Image Recognition API. It is suitable for users developing custom integrations who can handle raw recognition results. ```Python # HCaptchaImageRecognition # Use this method to solve HCaptcha challenges that require image recognition. # This method returns only the image recognition results, not a validation token. # Ensure you have the necessary integration capabilities to handle raw recognition results. # Example usage: # result = HCaptchaImageRecognition.solve(sitekey="YOUR_SITE_KEY", pageurl="YOUR_PAGE_URL") # print(result) ``` -------------------------------- ### Solve CAPTCHA with Task List API Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 This example shows how to solve a CAPTCHA by adding it to a task list. This is useful for managing multiple CAPTCHA solving requests. ```javascript const axios = require('axios'); async function solveCaptchaTaskList(siteKey, captchaUrl, captchaType) { const url = 'https://api.yescaptcha.com/createTask'; const payload = { clientKey: 'YOUR_CLIENT_KEY', task: { type: captchaType, params: { sitekey: siteKey, url: captchaUrl } } }; try { const response = await axios.post(url, payload); console.log('Task created:', response.data); // You would then poll for the result using the taskId return response.data; } catch (error) { console.error('Error creating task:', error.response ? error.response.data : error.message); return null; } } // Example usage: solveCaptchaTaskList('6Le-wvkSAAAAAPBMRTvw0Q4Muexq9biUXxQE_NfV', 'https://www.google.com/recaptcha/api2/demo', 'RecaptchaV2TaskProxyless'); ``` -------------------------------- ### Solve ReCAPTCHA V3 Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 Example for solving ReCAPTCHA V3. Similar to V2, requires website URL and site key. Note the 'RecaptchaV3TaskProxyless' type. ```javascript const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const websiteUrl = 'WEBSITE_URL'; // The URL of the page with the ReCAPTCHA const websiteKey = 'WEBSITE_KEY'; // The site key of the ReCAPTCHA const pageAction = 'PAGE_ACTION'; // The action name defined for the ReCAPTCHA V3 async function solveRecaptchaV3() { try { const response = await axios.post('https://api.yescaptcha.com/createTask', { clientKey: apiKey, task: { type: 'RecaptchaV3TaskProxyless', websiteURL: websiteUrl, websiteKey: websiteKey, pageAction: pageAction } }); console.log('ReCAPTCHA V3 task created:', response.data); } catch (error) { console.error('Error creating ReCAPTCHA V3 task:', error.response ? error.response.data : error.message); } } solveRecaptchaV3(); ``` -------------------------------- ### Solve hCaptcha Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 Example for solving hCaptcha. Similar to ReCAPTCHA V2, requires website URL and site key. ```javascript const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const websiteUrl = 'WEBSITE_URL'; // The URL of the page with the hCaptcha const websiteKey = 'WEBSITE_KEY'; // The site key of the hCaptcha async function solveHcaptcha() { try { const response = await axios.post('https://api.yescaptcha.com/createTask', { clientKey: apiKey, task: { type: 'HCaptchaTaskProxyless', websiteURL: websiteUrl, websiteKey: websiteKey } }); console.log('hCaptcha task created:', response.data); } catch (error) { console.error('Error creating hCaptcha task:', error.response ? error.response.data : error.message); } } solveHcaptcha(); ``` -------------------------------- ### Get Account Balance Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 This snippet retrieves your current account balance from YesCaptcha. Ensure your client key is valid. ```javascript const axios = require('axios'); async function getBalance() { const url = 'https://api.yescaptcha.com/getBalance'; const payload = { clientKey: 'YOUR_CLIENT_KEY' }; try { const response = await axios.post(url, payload); console.log('Account balance:', response.data); return response.data; } catch (error) { console.error('Error getting balance:', error.response ? error.response.data : error.message); return null; } } // Example usage: getBalance(); ``` -------------------------------- ### HCaptcha Image Reconstruction Protocol Example Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465/HCaptchaClassification%2BHcaptcha%2BImage%2BRecognition This section describes the protocol for Proxyless HCaptcha challenges, requiring image reconstruction from provided tiles and coordinates before sending to the recognition interface. ```text If you are developing via protocol (Proxyless), the raw data you receive contains small tile images, their coordinates (`coords`), and the background image. Open 025d1d3c4911fdbe2f456f98582f3c4-20250315-160414.png `coords`: Indicates the position of the small tile.You must stitch the small tiles onto the background image according to the positions specified in `coords` to generate a complete image. **Important:** The visual style of the reconstructed image **must match a browser screenshot exactly** , as the recognition model is trained based on screenshots (please refer to the example at the end). Open e869795409950a154de3b6fc4eb0796-20250315-160449.png * **Reconstruct the Image:** Assemble the complete image as described above. * **Send to API:** Send the reconstructed image to the recognition interface. * Please refer to the "Screenshot Processing" section above for the request format and response handling. You will receive a set of coordinates. * **Submit Result:** Submit the returned coordinates to the HCaptcha interface; `entity_coords` represents the target location. ``` -------------------------------- ### Get Task Result (Python) Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 Python code to retrieve the result of a previously created task. Replace 'YOUR_TASK_ID' with the actual ID. ```python import requests import json api_key = 'YOUR_API_KEY' task_id = 'YOUR_TASK_ID' # Replace with the actual task ID url = "https://api.yescaptcha.com/getTaskResult" payload = { "clientKey": api_key, "taskId": task_id } try: response = requests.post(url, json=payload) response.raise_for_status() result = response.json() print("Task result:", result) if result.get('status') == 'ready': print("Captcha solution:", result.get('solution', {}).get('text')) else: print(f"Task not ready yet. Status: {result.get('status')}") except requests.exceptions.RequestException as e: print(f"Error getting task result: {e}") if e.response: print(f"Response data: {e.response.json()}") ``` -------------------------------- ### HCaptcha Classification Task Request Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465/HCaptchaClassification%2BHcaptcha%2BImage%2BRecognition Example of a request to classify an HCaptcha image, specifying the task type and image details. ```json { "clientKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "task": { "type": "HCaptchaClassification", "imageUri": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgJCwkJCQwJDAkJCQkJCwkJCQkJCQkJCQkJCQkJCQkJCQkJCQkP/wAARCAA+AD4DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NT88vE9ER0dXX2J2h5eo0tPU1dbX2Nna4eLj5OXm59jp6vS09dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEAAAAAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETgUIGFJGhsQglQhWxM0HRYnKCCQoWFxgZGiVyc5Kio0NT88vE9ER0dXX2J2h5eo0tPU1dbX2Nna4eLj5OXm59jp6vS09dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+f8A/9k=" } } ``` -------------------------------- ### Get Task Status Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465 This code shows how to check the status of a CAPTCHA solving task using its ID. You need the taskId obtained from task creation. ```javascript const axios = require('axios'); async function getTaskStatus(taskId) { const url = 'https://api.yescaptcha.com/getTaskResult'; const payload = { clientKey: 'YOUR_CLIENT_KEY', taskId: taskId }; try { const response = await axios.post(url, payload); console.log('Task status:', response.data); return response.data; } catch (error) { console.error('Error getting task status:', error.response ? error.response.data : error.message); return null; } } // Example usage (replace 'YOUR_TASK_ID' with an actual task ID): // getTaskStatus('YOUR_TASK_ID'); ``` -------------------------------- ### HCaptcha Drag and Drop Task Request Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/909246465/HCaptchaClassification%2BHcaptcha%2BImage%2BRecognition Example of a request for an HCaptcha drag-and-drop task, specifying the task type and image details. The image must contain both the draggable object and its target location. ```json { "clientKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "task": { "type": "HCaptchaClassification", "queries": [] } } ``` -------------------------------- ### Get SoftID and Account Balance Response Source: https://yescaptcha.atlassian.net/wiki/spaces/YESCAPTCHA/pages/64192719/getSoftID%2Bretrieve%2BSoftID%2Band%2Baccount%2Bbalance This is an example of a successful response from the getSoftID API. It includes the error status, developer softID, and account balance. ```json { "errorId": 0, "softID": 3, "balance": 0.004 } ```