Skip to main content
Are you experiencing issues obtaining the token?
Contact support

TenDI - Tencent CAPTCHA

More on the topic in our blog
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).


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.


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

POST
https://api.capmonster.cloud/createTask

Request example

{
"clientKey": "API_KEY",
"task": {
"type": "CustomTask",
"class": "TenDI",
"websiteURL": "https://yourwebsite.com/page-with-tencent",
"websiteKey": "your-website-key",
"userAgent": "userAgentPlaceholder",
"metadata": {
"captchaUrl": "https://global.captcha.example.com/TCaptcha-global.js"
}
}
}

Response example

{
"errorId": 0,
"taskId": 407533072
}

Get task result method

Use the getTaskResult method to get the TenDI solution.

POST
https://api.capmonster.cloud/getTaskResult

Request example

{
"clientKey":"API_KEY",
"taskId": 407533072
}

Response example

{
"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 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.

Show code (Node.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();
})();

Use the SDK Library

Show code (for browser)
// https://github.com/ZennoLab/capmonstercloud-client-js

import {
CapMonsterCloudClientFactory,
ClientOptions,
TenDIRequest
} from '@zennolab_com/capmonstercloud-client';

const API_KEY = "YOUR_API_KEY"; // Specify your CapMonster Cloud API key

document.addEventListener("DOMContentLoaded", async () => {
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://example.com", // URL of the page with Tencent (TenDI) captcha
websiteKey: "183268248" // TencentCaptcha appid (replace with a valid value)
});

// Example of using your own 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://example.com",
websiteKey: "183268248",
userAgent: "userAgentPlaceholder",
proxy
});
*/

// Optionally, you can check the balance
const balance = await client.getBalance();
console.log("Balance:", balance);

const result = await client.Solve(tenDIRequest);
console.log("Solution:", result);
});
Show code (Node.js)
// https://github.com/ZennoLab/capmonstercloud-client-js

import {
CapMonsterCloudClientFactory,
ClientOptions,
TenDIRequest
} from '@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://example.com", // URL of the page with the captcha
websiteKey: "183268248" // TencentCaptcha appid (replace with a valid value)
});

// Example of using your own 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://example.com",
websiteKey: "websiteKey",
proxy,
userAgent: "userAgentPlaceholder"
});
*/

// Optionally, you can check the balance
const balance = await client.getBalance();
console.log("Balance:", balance);

const result = await client.Solve(tenDIRequest);
console.log("Solution:", result);
}

solveTenDI().catch(console.error);