# Automatically recognise and bypass TenDI - Tencent captcha | API URL: https://docs.capmonster.cloud/docs/captchas/tendi/ > Learn how to bypass TenDl (Tencent captcha) using API of Capmonster Cloud's automatic captcha recognition and solution service. # TenDI - Tencent CAPTCHA View full price: https://capmonster.cloud/en/prices/ Tencent captcha - **Price:** $1.6 / 1000 tokens. **Success rate:** 99%. > **CapMonster Cloud MCP** > > CapMonster Cloud MCP can also be used to detect and solve CAPTCHA. [Learn more about MCP](https://docs.capmonster.cloud/docs/mcp.txt). More on the topic in our blog: https://capmonster.cloud/en/blog/ten-1/what-is-tencent-captcha-and-how-do-i-bypass-it > **Attention!** > > CapMonster Cloud uses built-in proxies by default — their cost is already included in the service. You only need to specify your own proxies in cases where the website does not accept the token or access to the built-in services is restricted. > > If you are using a proxy with IP authorization, make sure to whitelist the address **65.21.190.34**. ## Request parameters **type** (string, required): **CustomTask** --- **class** (string, required): **TenDI** --- **websiteURL** (string, required): The address of the main page where the captcha is solved. --- **websiteKey** (string, required): **captchaAppId** corresponds to the `aid` value. For example, `"websiteKey": "189123456"` is a unique parameter for your website. It can be obtained from the HTML of the page containing the captcha or from the network traffic (see the description below). --- **captchaUrl (inside metadata)** (string, optional): Link to the CAPTCHA script. The file is usually named `TCaptcha.js` or `TCaptcha-global.js`. For the second version, files named `TJNCaptcha*.js` and `TJCaptcha*.js` may also be used, where `*` represents any string or an empty string, for example `-global`. You can find the script among the network requests (see the example below). --- **aidEncrypted (inside metadata)** (string, optional): This parameter contains the Aid value, which must be obtained from the target website before creating a task. Example: `HHuVfL451oAYXSwVa87xnU4QHER9ufsPpaSomCugX5Il/Nc2vLTu2dgoguMwmhAM` **Important**: this parameter is not used on all websites. If the website does not return Aid, you do not need to pass `aidEncrypted`. The `aidEncrypted` value is **single-use**: a new Aid must be obtained for each new task. For details, see [How to get aidEncrypted](#how-to-get-aidencrypted). --- **userAgent** (string, optional): Browser User-Agent. Use the current value supported by CapMonster Cloud: `userAgentPlaceholder` You can get the latest value at: [https://capmonster.cloud/api/useragent/actual](https://capmonster.cloud/api/useragent/actual). --- **proxyType** (string, optional): **http** - regular http/https proxy; **https** - try this option only if "http" doesn't work (required for some custom proxies); **socks4** - socks4 proxy; **socks5** - socks5 proxy. --- **proxyAddress** (string, optional): IPv4/IPv6 proxy IP address. Not allowed: - using transparent proxies (where you can see the client's IP); - using proxies on local machines. --- **proxyPort** (integer, optional): Proxy port. --- **proxyLogin** (string, optional): Proxy-server login. --- **proxyPassword** (string, optional): Proxy-server password. ## Create task method If the website uses `aidEncrypted`, pass it in `metadata`. Obtain a new value from the website for each new task. #### CustomTask (without proxy) ```http https://api.capmonster.cloud/createTask ``` **Request example** ```json { "clientKey": "API_KEY", "task": { "type": "CustomTask", "class": "TenDI", "websiteURL": "https://yourwebsite.com/page-with-tencent", "websiteKey": "your-website-key", "userAgent": "userAgentPlaceholder", "metadata": { "captchaUrl": "https://example.com/TCaptcha.js" } } } ``` **Response example** ```json { "errorId": 0, "taskId": 407533072 } ``` #### CustomTask (with proxy) ```http https://api.capmonster.cloud/createTask ``` **Request example** ```json { "clientKey": "API_KEY", "task": { "type": "CustomTask", "class": "TenDI", "websiteURL": "https://yourwebsite.com/page-with-tencent", "websiteKey": "your-website-key", "userAgent": "userAgentPlaceholder", "metadata": { "captchaUrl": "https://example.com/TCaptcha.js" }, "proxyType": "your-proxy-type", "proxyAddress": "your-proxy-address", "proxyPort": 1234, "proxyLogin": "your-proxy-login", "proxyPassword": "your-proxy-password" } } ``` **Response example** ```json { "errorId": 0, "taskId": 407533072 } ``` ## Get task result method Use the [getTaskResult](https://docs.capmonster.cloud/docs/api/methods/get-task-result.txt) method to get the TenDI solution. ```http https://api.capmonster.cloud/getTaskResult ``` **Request example** ```json { "clientKey":"API_KEY", "taskId": 407533072 } ``` **Response example** ```json { "errorId": 0, "status": "ready", "solution": { "data": { "randstr": "@EcL", "ticket": "tr03lHUhdnuW3neJZu.....7LrIbs*" }, "headers": { "User-Agent": "userAgentPlaceholder" } } } ``` ## How to get websiteKey (captchaAppId) Turn on the *Developer Tools*, go to the **Network** tab, activate the captcha and look at the requests. Some of them will contain the parameter value you need. In this case `websiteKey=aid` ## How to get captchaUrl Open *Developer Tools*, go to the **Network** tab, trigger the CAPTCHA, and inspect the network requests. Among the loaded files, find `TCaptcha.js` or `TCaptcha-global.js`: For the second version, files named `TJNCaptcha*.js` and `TJCaptcha*.js` may also be used: `*` in the filename represents any string or an empty string. For example, the pattern `TJNCaptcha*.js` can match files such as `TJNCaptcha.js` or `TJNCaptcha-global.js`. ## How to get aidEncrypted If the website uses Aid, obtain it with a separate request before creating a task and pass the returned value in the `aidEncrypted` parameter inside the `metadata` object. Open **Developer Tools**, go to the **Network** tab, and trigger the CAPTCHA. Find the request the website uses to obtain Aid and copy the value from the response. Example request URL: ```text https://example.com/path/GetCaptchaAid.ashx?_=1234567890000 ``` The same request may also include the `websiteKey` (`AppId`) value. The request URL and response format depend on the website. Example of creating a task with the `aidEncrypted` parameter: ```json { "clientKey": "API_KEY", "task": { "type": "CustomTask", "class": "TenDI", "websiteURL": "https://example.com/page-with-captcha", "websiteKey": "YOUR_WEBSITE_KEY", "metadata": { "captchaUrl": "https://example.com/TCaptcha.js", "aidEncrypted": "YOUR_AID_ENCRYPTED" } } } ``` > **Important:** > > Obtain a new Aid value before creating each task. Do not reuse an `aidEncrypted` value obtained for a previous task, and do not use values from the documentation examples. ## How to find all required parameters for task creation ### Automatically To automate parameter extraction, you can retrieve them via a **browser** (regular or headless, e.g., using **Playwright**) or directly from **HTTP requests**. Since dynamic parameter values are short-lived, it is recommended to use them immediately after retrieval. > **Important:** > > The provided code snippets are basic examples for learning how to extract the required parameters. The exact implementation will depend on your captcha page, its structure, and the HTML elements and selectors used. #### JavaScript #### Show code (Node.js) ```js import { chromium } from "playwright"; (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); // Intercept requests page.on("request", (request) => { const url = request.url(); if ( url.startsWith("https://sg.captcha.qcloud.com/cap_union_prehandle?aid=") ) { const parsedUrl = new URL(url); const aid = parsedUrl.searchParams.get("aid"); console.log("Extracted aid:", aid); } }); await page.goto("https://www.example.com/", { waitUntil: "load" }); await page.waitForTimeout(5000); await browser.close(); })(); ``` #### Python #### Show code ```python import asyncio from playwright.async_api import async_playwright async def main(): async with async_playwright() as p: browser = await p.chromium.launch(headless=False) page = await browser.new_page() # Intercept requests page.on("request", lambda request: handle_request(request)) await page.goto("https://www.example.com/", wait_until="load") await asyncio.sleep(5) await browser.close() def handle_request(request): url = request.url if url.startswith("https://sg.captcha.qcloud.com/cap_union_prehandle?aid="): parsed_url = request.url.split('?')[1] params = dict(param.split('=') for param in parsed_url.split('&') if '=' in param) aid = params.get('aid') print("Extracted aid:", aid) asyncio.run(main()) ``` #### C# #### Show code ```csharp using System; using System.Threading.Tasks; using Microsoft.Playwright; class Program { public static async Task Main() { using var playwright = await Playwright.CreateAsync(); await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false }); var page = await browser.NewPageAsync(); // Intercept requests page.Request += (_, request) => { var url = request.Url; if (url.StartsWith("https://sg.captcha.qcloud.com/cap_union_prehandle?aid=")) { var uri = new Uri(url); var queryParams = System.Web.HttpUtility.ParseQueryString(uri.Query); var aid = queryParams.Get("aid"); Console.WriteLine("Extracted aid: " + aid); } }; await page.GotoAsync("https://www.example.com/", new PageGotoOptions { WaitUntil = WaitUntilState.Load }); await Task.Delay(5000); await browser.CloseAsync(); } } ``` ## Use the SDK Library #### JavaScript / TypeScript #### Show code (for browser) ```js // https://github.com/CapMonsterCloud/capmonster-nodejs-captcha-solver import { CapMonsterCloudClientFactory, ClientOptions, TenDIRequest } from "@zennolab_com/capmonstercloud-client"; document.addEventListener("DOMContentLoaded", async () => { const API_KEY = "YOUR_API_KEY"; // Specify your CapMonster Cloud API key const client = CapMonsterCloudClientFactory.Create( new ClientOptions({ clientKey: API_KEY }) ); // Basic example without proxy // CapMonster Cloud automatically uses its own proxies let tenDIRequest = new TenDIRequest({ websiteURL: "https://yourwebsite.com/page-with-tendi", websiteKey: "your-website-key", }); // Example using your proxy // Uncomment this block if you want to use your own proxy /* const proxy = { proxyType: "http", proxyAddress: "123.45.67.89", proxyPort: 8080, proxyLogin: "username", proxyPassword: "password", }; tenDIRequest = new TenDIRequest({ websiteURL: "https://yourwebsite.com/page-with-tendi", websiteKey: "your-website-key", proxy, userAgent: "userAgentPlaceholder", }); */ // You can check your balance if necessary const balance = await client.getBalance(); console.log("Balance:", balance); const result = await client.Solve(tenDIRequest); console.log("Solution:", result.solution); }); ``` #### Show code (Node.js) ```JavaScript // https://github.com/CapMonsterCloud/capmonster-nodejs-captcha-solver const { CapMonsterCloudClientFactory, ClientOptions, TenDIRequest, } = require("@zennolab_com/capmonstercloud-client"); const API_KEY = "YOUR_API_KEY"; // Specify your CapMonster Cloud API key async function solveTenDI() { const client = CapMonsterCloudClientFactory.Create( new ClientOptions({ clientKey: API_KEY }), ); // Basic example without proxy // CapMonster Cloud automatically uses its own proxies let tenDIRequest = new TenDIRequest({ websiteURL: "https://yourwebsite.com/page-with-tendi", websiteKey: "your-website-key", }); // Example using your proxy // Uncomment this block if you want to use your own proxy /* const proxy = { proxyType: "http", proxyAddress: "123.45.67.89", proxyPort: 8080, proxyLogin: "username", proxyPassword: "password", }; tenDIRequest = new TenDIRequest({ websiteURL: "https://yourwebsite.com/page-with-tendi", websiteKey: "your-website-key", proxy, userAgent: "userAgentPlaceholder", }); */ // You can check your balance if necessary const balance = await client.getBalance(); console.log("Balance:", balance); const result = await client.Solve(tenDIRequest); console.log("Solution:", result.solution); } solveTenDI().catch(console.error); ``` #### Python #### Show code ```python # https://github.com/CapMonsterCloud/capmonster-python-captcha-solver import asyncio from capmonstercloudclient import CapMonsterClient, ClientOptions from capmonstercloudclient.requests import TenDiCustomTaskRequest # Import ProxyInfo if you plan to use your own proxy from capmonstercloudclient.requests.proxy_info import ProxyInfo API_KEY = "YOUR_API_KEY" # Specify your CapMonster Cloud API key async def solve_tendi(): client = CapMonsterClient( options=ClientOptions(api_key=API_KEY) ) # Basic example without proxy # CapMonster Cloud automatically uses its own proxies tendi_request = TenDiCustomTaskRequest( websiteUrl="https://yourwebsite.com/page-with-tendi", websiteKey="your-website-key", ) # Example using your proxy # Uncomment this block if you want to use your own proxy """ proxy = ProxyInfo( proxyType="http", proxyAddress="123.45.67.89", proxyPort=8080, proxyLogin="username", proxyPassword="password", ) tendi_request = TenDiCustomTaskRequest( websiteUrl="https://yourwebsite.com/page-with-tendi", websiteKey="your-website-key", proxy=proxy, userAgent="userAgentPlaceholder", ) """ # You can check your balance if necessary balance = await client.get_balance() print("Balance:", balance) result = await client.solve_captcha(tendi_request) print("Solution:", result) asyncio.run(solve_tendi()) ``` #### C# #### Show code ```csharp // https://github.com/CapMonsterCloud/capmonster-dotnet-captcha-solver using System; using System.Threading.Tasks; using Zennolab.CapMonsterCloud; using Zennolab.CapMonsterCloud.Requests; class Program { static async Task Main(string[] args) { // Specify your CapMonster Cloud API key var clientOptions = new ClientOptions { ClientKey = "YOUR_API_KEY" }; var cmCloudClient = CapMonsterCloudClientFactory.Create(clientOptions); // Basic example without proxy // CapMonster Cloud automatically uses its own proxies var tenDiRequest = new TenDiCustomTaskRequest { WebsiteUrl = "https://yourwebsite.com/page-with-tendi", WebsiteKey = "your-website-key", UserAgent = "userAgentPlaceholder" }; // Example using your proxy // Uncomment this block if you want to use your own proxy /* tenDiRequest = new TenDiCustomTaskRequest { WebsiteUrl = "https://yourwebsite.com/page-with-tendi", WebsiteKey = "your-website-key", UserAgent = "userAgentPlaceholder", Proxy = new ProxyContainer( "123.45.67.89", 8080, ProxyType.Http, "username", "password" ) }; */ // You can check your balance if necessary var balance = await cmCloudClient.GetBalanceAsync(); Console.WriteLine("Balance: " + balance); var tenDiResult = await cmCloudClient.SolveAsync(tenDiRequest); Console.WriteLine("Solution Data: " + string.Join(", ", tenDiResult.Solution.Data)); Console.WriteLine("Solution Headers: " + string.Join(", ", tenDiResult.Solution.Headers)); } } ```