Solve CAPTCHA

View as Markdown

Ask the Challenge solver to detect and solve a CAPTCHA in an active browser Runtime. The solver applies the result to the page when possible and returns the solution shape for inspection.

Solve a challenge

1const result = await bctrl.tools.call("captcha.solve", {
2 pageId,
3 timeoutMs: 120000,
4}, { runtimeId: runtime.id });
5
6if (result.success) {
7 console.log(result.type, result.kind, result.artifact);
8} else {
9 console.log(result.reason, result.error);
10}

pageId is optional. If omitted, the solver uses the Runtime’s active page. The Runtime must be active and use the browser runtime type. timeoutMs can be up to 120000 milliseconds.

Request parameters

ParameterTypeRequiredDescription
pageIdPageIdNoPage to inspect. Uses the active page when omitted.
timeoutMsintegerNoMaximum solve time in milliseconds. Maximum: 120000.

Response

FieldTypeAlways presentDescription
successbooleanYesWhether the challenge was solved and applied.
typeCaptchaTypeNoDetected challenge type.
reasonCaptchaSolveFailureReasonNoWhy solving or applying the solution failed.
kindCaptchaSolveArtifactKindNoShape of the returned solution artifact.
artifactCaptchaSolveArtifactNoStructured solution data, when available.
tokenstringNoToken returned by the solver, when available.
workerUserAgentstringNoUser agent associated with the solving worker, when available.
durationnumberNoSolve duration, when available.
errorstringNoHuman-readable failure detail.

Challenge types include recaptcha_v2, recaptcha_v3, turnstile, hcaptcha, geetest_v3, geetest_v4, arkose, prosopo, mtcaptcha, lemin, friendly_captcha, amazon_waf, altcha, datadome, basilisk, yidun, and tendi.

Solution artifacts

Inspect artifact.kind before reading the artifact fields:

kindShapeDescription
token{ token: string }Token-based solution.
fields{ fields: Record<string, string> }Form fields to apply.
cookie{ cookie: Cookie }Cookie-based solution.
text{ text: string }Text returned by the solver.
click_points{ points: { x: number; y: number }[] }Coordinates to click.
grid{ cells: number[] }Selected challenge cells.
browser_state{ browserState: BrowserState }Browser state such as cookies, headers, storage, or URL.

Failure reasons are no_captcha, unsupported, rate_limited, page_not_attached, solve_failed, and apply_failed.

Run asynchronously

1const call = await bctrl.tools.start("captcha.solve", {
2 pageId,
3 timeoutMs: 120000,
4}, { runtimeId: runtime.id });
5
6const result = await bctrl.toolCalls.result(call.id, {
7 waitSeconds: 120,
8});

Use bctrl.toolCalls.get(call.id) to inspect progress or bctrl.toolCalls.cancel(call.id) to cancel an active call.

Next