Logo of «GitHub»

Debugging & Sandbox

If you have a doubt integrating your software with our API and need to debug your code and API requests we provide some instruments and suggestions to help you on that.

Method test

The method allows to check the parameters of your request and see how our API service sees your request.

Use it if you receive an error code from our API and can not understand what are you doing wrong. Just replace the API enpoint from createTask or getResponse to test and compare the parameters you sent with the returned values.

API Endpoint: https://api.2captcha.com/test
Method: POST
Content-Type: application/json

Request example

{
    "clientKey": "YOUR_API_KEY",
    "foo": "bar",
    "test": true,
    "attempt": 3,
    "options": {
        "list": [
            "item1",
            "item2"
        ]
    }
}

Response example

Parsed input JSON:
Dict
(
[clientKey] => YOUR_API_KEY
[foo] => bar
[test] => 1
[attempt] => 3
[options] => Dict
(
[list] => Dict
(
[0] => item1
[1] => item2
)

)

)
Raw POST input:
{
"clientKey": "YOUR_API_KEY",
"foo": "bar",
"test": true,
"attempt": 3,
"options": {
"list": [
"item1",
"item2"
]
}
}

Sandbox mode

We also provide the sandbox that allows you to see how our workers will see your tasks.
Sandbox can be really useful for cases when our workers can not solve your captcha or you receive incorrect answers.

To debug a captcha in Sandbox follow these simple steps:

  • enable sandbox mode
  • if you need to debug image-based captchas go directly to workers' cabinet
  • if you need to debug an interactive captcha:
    1. download our workers' software
    2. get your Client KEY for the worker role. To do this, switch the role you are using to worker in cabinet.
    3. log in to the installed application using Client KEY
      for role worker.
  • submit your captcha to the API and try to solve it

Browser automation issues

There's a really common problem with executing JavaScript, especially callbacks from browser automation framework. Most of the problems are caused by simple syntax errors when you need to pass some JavaScript, substitute some variables and pass arguments to JavaScript function calls.

We always recommend the following approach for such kind of tasks:

  1. Try to solve the captcha manually on the website to ensure that it really works. There are cases when website administrators deploy the captcha incorrectly or just forget to pay the captcha service bills and the captcha does not work at all, so it can not be solved.
  2. Try to bypass the captcha executing the JavaScript manually in the browser console. This really helps to understand how your call should look like.
  3. Only when two previous steps were successul, start to automate with the code in your favourive language using your prefered frameworks.