Audio CAPTCHA

Audio

We provide a speech recognition method that allows you to convert an audio record to text. The method can be used to bypass audio captchas or to recognize any audio record.

The limitations are:

  • Max file size: 1 MB
  • Audio duration: not limited
  • Supported audio format: mp3 only
  • Supported speech languages: English, French, German, Greek, Portuguese, Russian

The recognition is fully automated and performed by a neural network trained for speech recognition.

Task type: AudioTask

AudioTask task type specification

Property Type Required Default Description
type String Yes Task type: AudioTask
body String Yes Base64 encoded audio file in mp3 format
lang String Yes en The language of audio record. Supported languages are: en, fr, de, el, pt, ru

Request example

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

{
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "AudioTask",
        "body": "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
        "lang": "en"
    }
}

Response example

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

{
    "errorId": 0,
    "status": "ready",
    "solution": {
        "text": "hello world"
    },
    "cost": "0.0005",
    "ip": "1.2.3.4",
    "createTime": 1692808229,
    "endTime": 1692808326,
    "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->audio('path/to/audio.mp3');
  } catch (\Exception $e) {
      die($e->getMessage());
  }

  die('Captcha solved: ' . $result->code); 
  // https://github.com/2captcha/2captcha-csharp
  AudioCaptcha captcha = new AudioCaptcha();
  byte[] bytes = File.ReadAllBytes("../../resources/audio-en.mp3");
  string base64EncodedImage = Convert.ToBase64String(bytes);
  captcha.SetBase64(base64EncodedImage);
  // https://github.com/2captcha/2captcha-java
  TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
  byte[] bytes = Files.readAllBytes(Paths.get("src/main/resources/audio-en.mp3"));
  String base64EncodedImage = Base64.getEncoder().encodeToString(bytes);
  Audio captcha = new Audio();
  captcha.setBase64(base64EncodedImage);
  # https://github.com/2captcha/2captcha-ruby
  require 'api_2captcha'

  client =  Api2Captcha.new("YOUR_API_KEY")

  result = client.audio({
      audio: "path/to/audio.jpg",
      lang: "en"
  })