Logo of «GitHub»

KeyCAPTCHA

KeyCAPTCHA widget

Token-based method to bypass KeyCAPTCHA.

Task types

  • KeyCaptchaTaskProxyless - we use our own pool of proxies
  • KeyCaptchaTask - we use your proxies

KeyCaptchaTaskProxyless task type specification

Property Type Required Description
type String Yes Task type:
KeyCaptchaTaskProxyless
KeyCaptchaTask
websiteURL String Yes The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users
s_s_c_user_id String Yes The value of s_s_c_user_id parameter found on page
s_s_c_session_id String Yes The value of s_s_c_session_id parameter found on page
s_s_c_web_server_sign String Yes The value of s_s_c_web_server_sign parameter found on page
s_s_c_web_server_sign2 String Yes The value of s_s_c_web_server_sign2 parameter found on page

KeyCaptchaTask task type specification

KeyCaptchaTask extends KeyCaptchaTaskProxyless adding a set of proxy-related parameters listed below

Property Type Required Description
proxyType String Yes Proxy type:
http
socks4
socks5
proxyAddress String Yes Proxy IP address or hostname
proxyPort Integer Yes Proxy port
proxyLogin String No Login for basic authentication on the proxy
proxyPassword String No Password for basic authentication on the proxy

Request examples

Method: createTask
API endpoint: https://api.2captcha.com/createTask

KeyCaptchaTaskProxyless

{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "KeyCaptchaTaskProxyless",
    "s_s_c_user_id": 10,
    "s_s_c_session_id": "493e52c37c10c2bcdf4a00cbc9ccd1e8",
    "s_s_c_web_server_sign": "9006dc725760858e4c0715b835472f22-pz-",
    "s_s_c_web_server_sign2": "2ca3abe86d90c6142d5571db98af6714",
    "websiteURL": "https://2captcha.com/demo/keycaptcha"
  }
}

KeyCaptchaTask

{
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "KeyCaptchaTask",
        "s_s_c_user_id": 184015,
        "s_s_c_session_id": "80f5f77b8b396b6cb6ea59cf22c38c55",
        "s_s_c_web_server_sign": "418910f3da05d4e3125030e4f9c95d42",
        "s_s_c_web_server_sign2": "118b538926cf9aafc48926bcaccf4c0e",
        "websiteURL": "https://2captcha.com/demo/keycaptcha",
        "proxyType": "http",
        "proxyAddress": "1.2.3.4",
        "proxyPort": "8080",
        "proxyLogin": "user23",
        "proxyPassword": "p4$w0rd"
    }
}

Response example

Method: getTaskResult
API endpoint: https://api.2captcha.com/getTaskResult

{
    "errorId": 0,
    "status": "ready",
    "solution": {
        "token": "84f42ee334f6bd760b8be3b2b...492598266d7a2418511776505f79|1"
    },
    "cost": "0.00299",
    "ip": "1.2.3.4",
    "createTime": 1692863536,
    "endTime": 1692863556,
    "solveCount": 0
}

Code examples

// https://github.com/2captcha/2captcha-php

require(__DIR__ . '/../src/autoloader.php');

$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');

try {
    $result = $solver->keycaptcha([
        's_s_c_user_id'          => 184015,
        's_s_c_session_id'       => '9ff29e0176e78eb7ba59314f92dbac1b',
        's_s_c_web_server_sign'  => '964635241a3e5e76980f2572e5f63452',
        's_s_c_web_server_sign2' => '3ca802a38ffc5831fa293ac2819b1204',
        'url'                    => 'https://2captcha.com/demo/keycaptcha',
    ]);
} catch (\Exception $e) {
    die($e->getMessage());
}

die('Captcha solved: ' . $result->code);
# https://github.com/2captcha/2captcha-python

import sys
import os

sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from twocaptcha import TwoCaptcha

api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')

solver = TwoCaptcha(api_key)

try:
    result = solver.keycaptcha(
        s_s_c_user_id=184015,
        s_s_c_session_id='9ff29e0176e78eb7ba59314f92dbac1b',
        s_s_c_web_server_sign='964635241a3e5e76980f2572e5f63452',
        s_s_c_web_server_sign2='3ca802a38ffc5831fa293ac2819b1204',
        url='https://2captcha.com/demo/keycaptcha')

except Exception as e:
    sys.exit(e)

else:
    sys.exit('solved: ' + str(result))
// https://github.com/2captcha/2captcha-csharp

using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
    public class KeyCaptchaExample
    {
        public void Main()
        {
            TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
            KeyCaptcha captcha = new KeyCaptcha();
            captcha.SetUserId(184015);
            captcha.SetSessionId("9ff29e0176e78eb7ba59314f92dbac1b");
            captcha.SetWebServerSign("964635241a3e5e76980f2572e5f63452");
            captcha.SetWebServerSign2("3ca802a38ffc5831fa293ac2819b1204");
            captcha.SetUrl("https://2captcha.com/demo/keycaptcha");
            try
            {
                solver.Solve(captcha).Wait();
                Console.WriteLine("Captcha solved: " + captcha.Code);
            }
            catch (AggregateException e)
            {
                Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
            }
        }
    }
}
// https://github.com/2captcha/2captcha-java

package examples;

import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.KeyCaptcha;

public class KeyCaptchaExample {
    public static void main(String[] args) {
        TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
        KeyCaptcha captcha = new KeyCaptcha();
        captcha.setUserId(184015);
        captcha.setSessionId("9ff29e0176e78eb7ba59314f92dbac1b");
        captcha.setWebServerSign("964635241a3e5e76980f2572e5f63452");
        captcha.setWebServerSign2("3ca802a38ffc5831fa293ac2819b1204");
        captcha.setUrl("https://2captcha.com/demo/keycaptcha");
        try {
            solver.solve(captcha);
            System.out.println("Captcha solved: " + captcha.getCode());
        } catch (Exception e) {
            System.out.println("Error occurred: " + e.getMessage());
        }
    }
}
// https://github.com/2captcha/2captcha-go

package main

import (
    "fmt"
    "log"
    "github.com/2captcha/2captcha-go"
)

func main() {
    client := api2captcha.NewClient("API_KEY")
    captcha := api2captcha.KeyCaptcha{
        UserId: 184015,
        SessionId: "9ff29e0176e78eb7ba59314f92dbac1b",
        WebServerSign: "964635241a3e5e76980f2572e5f63452",
        WebServerSign2: "3ca802a38ffc5831fa293ac2819b1204",
        Url: "https://2captcha.com/demo/keycaptcha",   
    }
    code, err := client.Solve(captcha.ToRequest())
    if err != nil {
        log.Fatal(err);
    }
    fmt.Println("code "+code)
}
# https://github.com/2captcha/2captcha-ruby
require 'api_2captcha'

client =  Api2Captcha.new("YOUR_API_KEY")

result = client.keycaptcha({
  s_s_c_user_id: 184015,
  s_s_c_session_id: '9ff29e0176e78eb7ba59314f92dbac1b',
  s_s_c_web_server_sign: '964635241a3e5e76980f2572e5f63452-pz-',
  s_s_c_web_server_sign2: '3ca802a38ffc5831fa293ac2819b1204',
  pageurl: 'https://2captcha.com/demo/keycaptcha'
})