Captcha

solve_captcha=true solves a captcha made of text drawn in a picture, then takes the screenshot. Name the picture and the text box with CSS selectors, such as #captcha-img or img.captcha.

You can also name the button to click after the answer is typed, a control that loads a new picture, and an element that shows a wrong-answer message. The solver tries again while that message is still visible. The default is 3 tries. You can set 1 to 5.

This reads text inside an image. A checkbox challenge, or a challenge that asks you to select pictures such as traffic lights, is outside this solver. The attempt waits up to 60 seconds.

The solver is on Growth and Business. It adds 3 credits when solve_captcha is on and the capture succeeds. See Plans and credits. A proxy can make a challenge less likely, but it does not type the answer. That is covered on the proxy page.

Hashtag
Parameters

ParameterRequiredValuesWhat it does
solve_captchaYestrue or falseTurn the solver on.
captcha_imageYesCSS selectorThe captcha picture.
captcha_inputYesCSS selectorThe box the answer is typed into.
captcha_submitNoCSS selectorClicked after the answer is typed.
captcha_errorNoCSS selectorA visible message here means the guess was rejected.
captcha_refreshNoCSS selectorClicked to load a new picture before the next try.
captcha_retriesNo1 to 5How many guesses to make. Default is 3.
ocr_modelNomini-ocr-v1 or ocr-v1Which recognition model to use. Default is mini-ocr-v1.

Hashtag
Errors

  • 400 when solve_captcha=true and captcha_image or captcha_input is missing.
  • 400 when captcha_retries is not a whole number from 1 to 5.
  • 400 when captcha_image matches no element.
  • 400 when ocr_model is not mini-ocr-v1 or ocr-v1.
  • 422 when every guess was rejected, or the picture had no readable text.
  • 500 when the solver cannot run. Try again, or contact support if it keeps happening.
  • 502 when the solver does not answer, or the wait times out.

Hashtag
Example


const axios = require("axios");

let config = {
	method: "get",
	maxBodyLength: Infinity,
	url: "https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fexample.com%2Flogin&solve_captcha=true&captcha_image=%23captcha-img&captcha_input=%23captcha-input&captcha_submit=%23login-button",
	headers: { }
};

axios.request(config).then((response) => {
	console.log(JSON.stringify(response.data));
}.catch((error) => {
	console.log(error);
});
{
  "url": "https://example.com/login",
  "solve_captcha": true,
  "captcha_image": "#captcha-img",
  "captcha_input": "#captcha-input",
  "captcha_submit": "#login-button",
  "captcha_refresh": "#captcha-reload",
  "captcha_error": ".captcha-error",
  "captcha_retries": 3
}