API

For automation purposes, Death By Captcha (DBC) provides APIs for users and developers to integrate with any given software.

The solving process goes as follows:

Check our API details below for additional information & resources to implement DBC using your favorite tool(s) and/or programming language!

Version: 4.6

Third-party clients

require_once 'deathbycaptcha.php';
// Put your DBC credentials here.
// Use DeathByCaptcha_HttpClient class if you want to use HTTP API.
$client = new DeathByCaptcha_SocketClient(USERNAME, PASSWORD);

// Put the CAPTCHA file name or handler, and desired timeout (in seconds) here:
if ($captcha = $client->decode(CAPTCHA_FILE_NAME, TIMEOUT)) {
    echo $captcha['text'] . "\n";
    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        $client->report($captcha['captcha']);
    }
}
// Repeat for other CAPTCHAs
require_once 'deathbycaptcha.php';
// Put your DBC credentials here.
// Use DeathByCaptcha_HttpClient class if you want to use HTTP API.
// To use token username must be authtoken.
$client = new DeathByCaptcha_SocketClient("authtoken", token-from-panel);

// Put the CAPTCHA file name or handler, and desired timeout (in seconds) here:
if ($captcha = $client->decode(CAPTCHA_FILE_NAME, TIMEOUT)) {
    echo $captcha['text'] . "\n";

    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        $client->report($captcha['captcha']);
    }
}
// Repeat for other CAPTCHAs
// Do not forget to reference DeathByCaptcha.dll in your project!
using DeathByCaptcha;

// Put your DBC credentials here.
// Use HttpClient class if you want to use HTTP API.
Client client = (Client) new SocketClient(USERNAME, PASSWORD);

// Put your CAPTCHA file name, stream, or vector of bytes,
// and desired timeout (in seconds) here:
Captcha captcha = client.Decode(CAPTCHA_FILE_NAME, TIMEOUT);
if (captcha.Solved && captcha.Correct) {
    Console.WriteLine("CAPTCHA {0}: {1}", captcha.Id, captcha.Text);

    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        client.Report(captcha);
    }
}

// Repeat for other CAPTCHAs
// Do not forget to reference DeathByCaptcha.dll in your project!
using DeathByCaptcha;

// Put your DBC credentials here.
// Use HttpClient class if you want to use HTTP API.
// Using token authentication in C#/VB, username must be authtoken.

Client client = (Client) new SocketClient("authtoken", token-from-panel);

// Put your CAPTCHA file name, stream, or vector of bytes,
// and desired timeout (in seconds) here:
Captcha captcha = client.Decode(CAPTCHA_FILE_NAME, TIMEOUT);
if (captcha.Solved && captcha.Correct) {
    Console.WriteLine("CAPTCHA {0}: {1}", captcha.Id, captcha.Text);

    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        client.Report(captcha);
    }
}

// Repeat for other CAPTCHAs
We are using command line dotnet 6+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the C# source code.

Download C# Selenium project from the list above

Edit Program.cs and put your credentials there
string _username = "DBC_USERNAME";
string _password = "DBC_PASSWORD";

In the folder where .csproj file is located
Do the following comands to run the example:

dotnet restore to install the requirements
dotnet build to build the project
dotnet run to run the project

dotnet clean to clean the project


// Repeat for other CAPTCHAs
We are using Maven 3.6+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the Java source code.

Download Java Selenium project from the list above

Edit App.java and put your credentials there
Client client = new HttpClient("DBC_USERNAME", "DBC_PASSWORD");

In the folder where pom.xml file is located
Do the following comands to run the example:

mvn clean install -U to clean project and install dependencies
mvn exec:java -Dexec.mainClass="deathbycaptcha.App" to build the project

mvn clean to clean the project

Refer to Java and Maven project examples to more detail
We are using NodeJS v12+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the NodeJS source code.

Download NodeJS Selenium project from the list above

Edit nodeSeleniumExample.js and put your credentials there

const USERNAME = 'DBC_USERNAME'   // Your DBC username here
const PASSWORD = 'DBC_PASSWORD'   // Your DBC password here

In the folder where package.json file is located
Do the following comands to run the example:

npm install // to install dependencies
node recaptcha_example/nodeSeleniumExample.js // to run the example

Refer to NodeJS project examples to more detail
We are using Python v3+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the Python3 source code.

Download Python3 Selenium project from the list above

Edit python_selenium_example.py and put your credentials there

USERNAME = 'DBC_USERNAME'   # Your DBC username here
PASSWORD = 'DBC_PASSWORD'   # Your DBC password here

In the folder where requirements.txt file is located
Do the following comands to run the example:

python3 -m venv venv to create a new python3 venv
. venv/bin/activate to activate the venv
pip3 install -r requirements.txt to install dependencies
python3 python_selenium_example.py

Refer to Python3 project examples to more detail
Create new Python3 virtual environment

python3 -m venv venv

Activate the virtual environment
. venv/bin/activate

Install DeathByCaptcha library from pypi

pip install deathbycaptcha-official

Create our python3 script

import  deathbycaptcha
# don't forget to import deathbycaptcha library
username = 'username'
password = 'password'
authtoken =  ''
...

use the DeathByCaptcha python http client
http_client = deathbycaptcha.HttpClient(username, password, authtoken)
or use the DeathByCaptcha python sockets client
socket_client = deathbycaptcha.SocketClient(username, password, authtoken)

Refer to Python3 project examples to more detail.
Create new Maven project

mvn archetype:generate
-DgroupId=examples
-DartifactId=deathbycaptcha-examples
-DarchetypeArtifactId=maven-archetype-quickstart
-DarchetypeVersion=1.4
-DinteractiveMode=false

Include the following dependencies on maven pom.xml file

<dependencies>
<dependency>
<groupId>io.github.deathbycaptcha</groupId>
<artifactId>deathbycaptcha-java-library</artifactId>
<version>0.43</version>
</dependency>
</dependencies>

if the pom.xml is correct.
We can use the imports on our java files.

import com.DeathByCaptcha.AccessDeniedException;
import com.DeathByCaptcha.Client;
import com.DeathByCaptcha.HttpClient;
import com.DeathByCaptcha.SocketClient;
import com.DeathByCaptcha.Captcha;
...

Clean and build the project
mvn clean install -U
Run the project
mvn exec:java -Dexec.mainClass="examples.GetBalance" -Dexec.args=""
mvn exec:java -Dexec.mainClass="examples.ExampleFuncaptcha"
mvn exec:java -Dexec.mainClass="examples.ExampleHcaptcha"
mvn exec:java -Dexec.mainClass="examples.ExampleRecaptchaV2"
...

Refer to Java and Maven project examples to more detail

When using socket API clients, make sure you don`t have outgoing TCP connections to ports 8123–8130 firewalled. Use HTTP API clients if socket API clients do not work for you. The 8123–8130 ports range is for socket API only, do not try to use it with HTTP API!

Note that a call to the decode function/method can return a null value if timeout is reached before the CAPTCHA is solved. If this happens often, increase the timeout used.

For more details see examples included in each API client package and check the clients source code.

  1. To check your balance, run:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -b
    Or using authentication token
    deathbycaptcha.exe -a AUTHTOKEN -b
    Your balance will be saved in balance.txt file and printed out on the standard output.
  2. To upload a CAPTCHA, run:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -c CAPTCHA_FILE_NAME [-t TIMEOUT]
    Or using authentication token
    deathbycaptcha.exe -a AUTHTOKEN -c CAPTCHA_FILE_NAME [-t TIMEOUT]
    Default CAPTCHA solving timeout is 60 seconds.
    If solved, the CAPTCHA ID will be saved in id.txt, the CAPTCHA text will be saved in answer.txt, and both ID and text will be printed out on the standard output separated by a space.
  3. To report an incorrectly solved CAPTCHA, run:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -n CAPTCHA_ID
    Or using authentication token
    deathbycaptcha.exe -a AUTHTOKEN -n CAPTCHA_ID

Before implementing your own Death By Captcha HTTP API client, please seriously consider using socket API with one of our official clients listed above.

The API url is http://api.dbcapi.me/api/. The URL path changes depending on the action desired. All responses from requests made to the API have two common fields:

  • status — request status. 0 if there were no errors during internal request processing, 255 otherwise.
  • error — short explanation of the occurred error. Only returned when status is 255.

For details about correct URL path and other returned fields for a specific action, refer to its section below.

All API responses are returned URL-encoded by default. If JSON encoding is desired, include application/json in the Accept header of your request. Note that boolean true will be returned as 1 in URL-encoded responses and as true in JSON-encoded responses. Boolean false will be returned as 0 in URL-encoded responses and as false in JSON-encoded responses.

What are "normal captcha" challenges?

This form of CAPTCHA are image-based and requires entering a sequence of letters or numbers from a distorted image.

To upload a CAPTCHA, issue a multipart/form-data POST request to http://api.dbcapi.me/api/captcha. The request must contain the following fields:

  • username — your Death By Captcha username.
  • password — your Death By Captcha password.
  • captchafile — the CAPTCHA image.

In case you are using token authentication:

  • authtoken — your Death By Captcha authentication token.
  • captchafile — the CAPTCHA image.

captchafile should be either raw CAPTCHA image file, or base64-encoded CAPTCHA image prepended with base64: prefix. Image file size is limited to less than 180 KB. When the image will be encoded in base64, the size should be lower than 120 KB. The supported image formats are JPG, PNG, GIF and BMP.

Here is the HTML form that does the trick:

<form action="http://api.dbcapi.me/api/captcha"method="post" enctype="multipart/form-data">
    <input type="text"     name="username" value="">
    <input type="password" name="password" value="">
    <input type="file"     name="captchafile">
</form>

Or using token authentication:

<form action="http://api.dbcapi.me/api/captcha"method="post" enctype="multipart/form-data">
    <input type="text"     name="authtoken" value="">
    <input type="file"     name="captchafile">
</form>

Here is cURL command equivalent:

curl --header 'Expect: ' -F username=YOUR_USERNAME  -F password=YOUR_PASSWORD  -F captchafile=@YOUR_CAPTCHA_FILENAME http://api.dbcapi.me/api/captcha

Or using token authentication:

curl --header 'Expect: ' -F authtoken=YOUR_AUTHTOKEN  -F captchafile=@YOUR_CAPTCHA_FILENAME http://api.dbcapi.me/api/captcha

base64-encoded captchafile field should look like this:

base64:R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAICTAEAOw==

You`ll get one of the following HTTP responses:

  • 303 See Other if your CAPTCHA was successfully uploaded, Location HTTP header will point you to the uploaded CAPTCHA status page, you may follow the Location to get the uploaded CAPTCHA status. Also, the following fields will be returned:
    • captcha — id of the uploaded captcha.
    • is_correct — 1 if an answer has been identified for this captcha or it is still being processed, 0 if processing finished and no answer could be found.
    • text — captcha answer. An empty string means that the captcha is not solved yet.
    URL encoded example:
    status=0&captcha=123&is_correct=1&text=
    JSON encoded example:
    { "status": 0, "captcha": 123, "is_correct": 1, "text": "" }
  • 403 Forbidden if your Death By Captcha credentials were rejected, or you don`t have enough credits.
  • 400 Bad Request if your request did not follow the specification above, or the CAPTCHA was rejected for not being a valid image.
  • 500 Internal Server Error if something happened on our side preventing you from uploading the CAPTCHA; if you are sure you are sending properly structured requests with valid CAPTCHA images but the problem persists, please contact our live support and tell them in details how to reproduce the issue.
  • 503 Service Temporarily Unavailable when our service is overloaded, try again later.

At this point the CAPTCHA you`ve just uploaded may not be solved yet! If you did not receive the answer in the text key of the server response, you have to poll for it. Refer to Polling for uploaded CAPTCHA status for more details.

To get an uploaded CAPTCHA`s status, issue a GET request to http://api.dbcapi.me/api/captcha/%CAPTCHA_ID%, where %CAPTCHA_ID% is your uploaded CAPTCHA`s ID acquired while uploading the CAPTCHA. You don`t have to supply your Death By Captcha credentials this time. The response will be a HTTP 200 OK response with the same fields described for the 303 See Other response of the Uploading a CAPTCHA section.

If the captcha is not solved yet, the text key will come empty. You will have to keep on polling for this answer. Example responses:

  • URL-encoded response of a correctly solved CAPTCHA
    status=0&captcha=1234&is_correct=1&text=tyrone+slothrop
  • JSON-encoded response of a correctly solved CAPTCHA
    { "captcha": 1234, "is_correct": true,"status": 0, "text": "tyrone slothrop" }
  • JSON-encoded response of an incorrectly solved CAPTCHA
    { "captcha": 1234, "is_correct": false, "status": 0, "text": "?" }
  • JSON-encoded response of an inexistent captcha
    { "captcha": 0, "status": 0 }
    If you get this response, confirm that the CAPTCHA id you are using to poll for the answer is the same one returned when it was uploaded. If the problem persists, feel free to contact us.

Please don`t poll for a CAPTCHA status more than once in a couple of seconds.
This is considered abusive and might get you banned.
Conserve your and our bandwidth.

If you think your CAPTCHA was solved incorrectly, report it to Death By Captcha to get your money back. To do so, issue a POST request to http://api.dbcapi.me/api/captcha/%CAPTCHA_ID%/report with the following fields:

  • username — your Death By Captcha username.
  • password — your Death By Captcha password.

Or using authentication token:

  • authtoken — your Death By Captcha authentication token.

The response will be:

  • 200 OK if report was completed. In this case, your credits will be refunded. The response body will be the same as for a poll (or upload) but the is_correct field will be 0. Example:
    { "captcha": 1234, "is_correct": false,"status": 0, "text": "tyrone slothrop" }
  • 503 Service Unavailable if report could not be completed. This might be because:
    1) captcha corresponding to the provided id was not uploaded by the user reporting it;
    2) your user is banned;
    3) report was made more than an hour after if was uploaded. In this case, you won`t be refunded.

Abusing this feature will get you banned!

To check your credit balance, issue a GET or POST request to http://api.dbcapi.me/api with the following fields:

  • username — your Death By Captcha username.
  • password — your Death By Captcha password.

Or using authentication token:

  • authtoken — your Death By Captcha authentication token.

On successful authentication, you`ll get 200 OK response with your Death By Captcha account details, either URL- or JSON-encoded, with the following fields:

  • user — your Death By Captcha account ID;
  • rate — how much we charge you for one correctly solved CAPTCHA, in US¢;
  • balance — your current credit balance, in US¢.
  • is_banned — 1 if user is banned, 0 if not.

Example JSON-encoded response:

{ "is_banned": false, "status": 0, "rate": 0.139,"balance": 455.23, "user": 43122 }

In order to receive current server status, issue a GET request to http://api.dbcapi.me/api/status. Response will have the following fields:

  • todays_accuracy — number representing accuracy in percentage (e.g., 99.6 represents 99.6%)
  • solved_in — average solving time in seconds
  • is_service_overloaded — 1 if service is overloaded, 0 otherwise

Example JSON-encoded response:

{ "status": 0, "todays_accuracy": 99.9, "solved_in": 5.3,"is_service_overloaded": false }
Death By Captcha API also supports Token authentication (both socket and HTTP), Learn how to use token authentication with our API.

Status: OK

Servers are fully operational with faster than average response time.
  • Average solving time
  • 2 seconds - Normal CAPTCHAs (1 min. ago)
  • 28 seconds - reCAPTCHA V2, V3, etc (1 min. ago)
  • 68 seconds - hCAPTCHA & others (1 min. ago)
Chrome and Firefox logos
Browser extensions available

Updates

  1. Feb 26: NEW TYPE ADDED - Now supporting Friendly CAPTCHA!! See the details at https://deathbycaptcha.com/api/friendly
  2. Nov 22: Now supporting Amazon WAF!! See the details at https://deathbycaptcha.com/api/amazonwaf
  3. Nov 01: Today our Socket API was affected by a technical issue for a few hours. It's now sorted and back to 100%, working optimally. We sincerely apologize for the inconvenience this may have caused you. If you were affected, please don't hesitate to contact us: https://deathbycaptcha.com/contact and we'll be happy to assist/compensate you!

  4. Previous updates…

Support

Our system is designed to be completely user-friendly and easy-to-use. Should you have any trouble with it, simply email us at DBC technical support emailcom, and a support agent will get back to you as soon as possible.

Live Support

Available Monday to Friday (10am to 4pm EST) Live support image. Link to live support page