NEWStandard createTask and in.php APIs. Change the address and you are connected.View API docs
GATESOLVER

CAPTCHA solving

Why does CAPTCHA handling fail in automation scripts?

Usually not because the solve failed, but because of what the script does around it: the inputs it sends, where it puts the answer, whether it triggers the site's own code, and how long it waits.

The direct answer

A CAPTCHA step has three parts: reading the right parameters from the page, getting an answer, and handing that answer to the site the way the site expects. The middle part is the solver's job and is the most reliable of the three. Most failures in automation scripts come from the first and last parts: a stale or wrong site key, a missing action, a token written into a field the site never reads, a callback that is never called, or a token that expired while the script did other things.

Failures before the solve

  • Hard-coded parameters. Site keys, v3 actions and Turnstile cData can change. Read them from the live page on each run rather than pasting them once.
  • Wrong type. An Enterprise site needs an Enterprise task; an invisible widget needs isInvisible; a full Cloudflare check page needs a challenge task, not a Turnstile task. The comparison of v2, v3 and Turnstile helps you pick.
  • Wrong URL. Send the URL of the page that shows the widget, not the API endpoint the form posts to.
  • Bad task data. The API answers ERROR_INVALID_TASK_DATA and names the missing field; scripts that ignore error replies keep polling a task that never existed.

Failures after the solve

The most frequent one is writing the token into the textarea and submitting, on a site that expects its JavaScript callback to run. Many sites send the form through their own fetch call inside the callback, so a token in the field alone does nothing. Call the callback with the token, or reproduce the request it makes:

// in the page, after the solver returns gsAnswer
const answerBox = document.querySelector("#g-recaptcha-response, textarea[name='g-recaptcha-response']");
if (answerBox) { answerBox.value = gsAnswer; }
const holder = document.querySelector(".g-recaptcha[data-callback]");
const cbName = holder?.getAttribute("data-callback");
if (cbName && typeof window[cbName] === "function") {
  window[cbName](gsAnswer);
} else {
  document.querySelector("form#signup")?.requestSubmit();
}

Some callbacks are not global names but functions registered through grecaptcha.render; the guide to finding the reCAPTCHA callback shows how to locate them.

Timing failures

reCAPTCHA tokens are valid for about two minutes, Turnstile tokens a bit longer. Scripts that solve first and then fill a long form, wait for other pages, or queue the token behind other work send it too late. Solve as the last step before submission. Polling also matters: poll every three seconds for token tasks so you pick up the answer soon after it is ready, and stop after about two minutes, when an unsolved task is closed as failed.

Identity mismatches

Answers can be tied to the client that requested them. A cf_clearance cookie works only with the user agent and IP it was issued for. DataDome cookies behave the same way. Token tasks return a userAgent in the solution; when the site checks it, send requests with that user agent. Proxy tasks must use the same proxy you will browse through. See which user agent to use with a token.

Frames, shadow roots and re-renders

Widgets live in iframes. Scripts that look for the site key inside the frame instead of on the host element, or that try to click inside a cross-origin frame, fail quietly. Single page apps may also re-render the form after you inject the token, wiping the field. Inject immediately before submitting, and verify the value is still there.

A debugging routine

  1. Log the parameters you sent and compare them with what DevTools shows on the page.
  2. Log the task id, final status and time to ready.
  3. Capture the network request your script triggers after injecting, and compare it with a request made by hand in a normal browser.
  4. Check the site's response: an error message, a redirect back to the form or a new challenge each mean something different.

If the site rejects tokens that were injected correctly and on time, the cause is on the site side (score, IP reputation, fingerprint); the page on token rejection continues from there. Framework-specific code lives in the Playwright and Selenium integration guides.

Common questions

Why does my form submit but nothing happens?

The site probably sends the form from its CAPTCHA callback. Call the callback with the token instead of only filling the field.

Should I read the site key every time?

Yes. Reading it from the live page avoids failures when the site rotates keys or serves different keys per page.

How long can I wait between solving and submitting?

As little as possible. reCAPTCHA tokens last about two minutes, so solve right before you submit.

Does the user agent matter for token tasks?

Sometimes. If the site compares it, send your requests with the userAgent returned in the solution.

What does ERROR_INVALID_TASK_DATA mean in this context?

A required field was missing or malformed. The error description names it, so log it rather than retrying blindly.

Keep reading