Text CAPTCHA
The method can be used to bypass tasks where you need to answer a question.
You can add some context that can help workers to provide the answer.
TextCaptchaTask task type specification
Property | Type | Required | Description |
---|---|---|---|
type | String | Yes | TextCaptchaTask |
comment | String | Yes | Text with a question you need to answer. |
Request example
Method: createTask
API endpoint: https://api.2captcha.com/createTask
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "TextCaptchaTask",
"comment": "If tomorrow is Saturday, what day is today?"
},
"languagePool": "en"
}
Response example
Method: getTaskResult
API endpoint: https://api.2captcha.com/getTaskResult
{
"errorId": 0,
"status": "ready",
"solution": {
"text": "friday"
},
"cost": "0.001",
"ip": "1.2.3.4",
"createTime": 1692863536,
"endTime": 1692863556,
"solveCount": 1
}
Code examples
// https://github.com/2captcha/2captcha-php
require(__DIR__ . '/../src/autoloader.php');
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
try {
$result = $solver->text([
'text' => 'If tomorrow is Saturday, what day is today?',
'lang' => 'en',
]);
} 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, defaultTimeout=40, pollingInterval=10)
try:
result = solver.text('If tomorrow is Saturday, what day is today?',
lang='en')
except Exception as e:
sys.exit(e)
else:
sys.exit('solved: ' + str(result))
// 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, defaultTimeout=40, pollingInterval=10)
try:
result = solver.text('If tomorrow is Saturday, what day is today?',
lang='en')
except Exception as e:
sys.exit(e)
else:
sys.exit('solved: ' + str(result))
// https://github.com/2captcha/2captcha-java
package examples;
import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.Text;
public class TextExample {
public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
Text captcha = new Text();
captcha.setText("If tomorrow is Saturday, what day is today?");
captcha.setLang("en");
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.Text{
Text: "If tomorrow is Saturday, what day is today?",
Lang: "en",
}
code, err := client.Solve(captcha.ToRequest())
if err != nil {
log.Fatal(err);
}
fmt.Println("code "+code)
}
require 'api_2captcha'
client = Api2Captcha.new("YOUR_API_KEY")
result = client.text({
textcaptcha:'If tomorrow is Saturday, what day is today?',
lang: "en"
})