Blog
How to solve Cloudflare Challenge (5s)

How to solve Cloudflare Challenge

Logo of Capsolver

CapSolver Blogger

How to use capsolver

11-May-2023

How to solve Cloudflare Challenge

Challenges Supported by Capsolver

  • Challenge + Turnstile
  • Challenge
  • Challenge + hCaptcha (Cloudflare removed this, but in case they put back, it's supported)

If it's challenge + captcha, you don't need to put any special parameter in the createTask, as we will recognize that require to solve the captcha.

How to solve Cloudflare Challenge (5s IUAM)

Before we start solving Cloudflare, there are some requeriments and points that we need to be aware that they are needed to know
Requeriments:

  • Capsolver Key
  • Proxy

Points to be aware that if we don't follow, solution will be invalid:

  • Token returned in the response of the method getTaskResult is the value of the cookie cf_clearance that you will need to create.
  • Must use the same user-agent that the method getTaskResult return
  • Must use the same proxy IP used for solve the challenge

To solve cloudflare challenge, follow our documentation. Some parameters are required and some are optional.
For this example, we will only use the required parameters. The task types for cloudflare are:

  • AntiCloudflareTask: This task type requires your own proxies.

We will use AntiCloudflareTask as the site uses Cloudflare Challenge 5s.
If any parameters are missing or you don't submit correctly, you will likely encounter issues with the token not being accepted by the website. You can find all the parameters in this picture:

Task Object Structure for solve Cloudflare Challenge 5s (cf_clearance)

Step 1: Submitting the information to capsolver

Use the method createTask to submit the information required:

POST https://api.capsolver.com/createTask

{
{
 "clientKey":"Your_API_KEY",
    "task": {
    "type": "AntiCloudflareTask",
    "websiteURL": "",
    "proxy": "Your_proxy"  
      }
}

Step 2: Getting the results

To verify the results, you'll need to continuously poll the getTaskResult API endpoint until the captcha is resolved.

Here's an example request:

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json

{
    "clientKey":"YOUR_API_KEY",
    "taskId": "TASKID_OF_CREATETASK" //ID created by the createTask method
}

Once the captcha is successfully resolved, you'll receive a response similar to the one depicted in the following image:

The captcha token received can be verified by submitting the cookie cf_clearance with the value of the response token, use the same proxy IP used for solve the challenge and also the same user-agent that we return you in the response to the relevant site.

⚠️ If the token is rejected, it may indicate that some information is missing or incorrect. Make sure that you are submitting the token value correctly to the cookie cf_clearance, that you are using the same proxy IP used for solve the challenge and also the same user-agent that it's returned to you in the response.

If you want to solve Cloudflare Turnstile Captcha. Please refer to this blog: link

In conclusion, while solving cloudflare challenge may seem a daunting task, capsolver.com makes the process swift and efficient. By following the steps outlined above, you can easily resolve cloudflare.

Capsolver Team 💜

Máse