Join And Get Free Trial!

NextCaptcha.com API

NextCaptcha is a leading human-powered image and CAPTCHA recognition service. Designed to solve your CAPTCHAs quickly and accurately using advanced AI workers, NextCaptcha goes beyond just CAPTCHA solving.

This versatile service also offers a range of solutions for image recognition tasks, making it an essential tool for automating and streamlining your online activities.

Introduction

Automate CAPTCHA Solving with Our API Integration

Our powerful API lets you seamlessly automate CAPTCHA solving by integrating your software with our service. Follow these simple steps to solve your CAPTCHAs efficiently:

Learn how to efficiently use NextCaptcha services by following these simple steps. Whether you're looking to automate CAPTCHA solving or integrate with our API, this guide will walk you through the process.

  1. Create an Account and obtain your unique API key.
  2. Send the CAPTCHA task to our server with your API request.
  3. Retrieve the task ID to track your CAPTCHA solving progress.
  4. Receive the CAPTCHA solution and continue your automated workflow.

Create an Account and obtain your unique API key.

1. Register an Account: Head over to  NextCaptcha's registration   page and create your account by filling in the necessary details.

2. Register an Account: Head over to  NextCaptcha's registration   page and create your account by filling in the necessary details.

3. Register an Account: Head over to  NextCaptcha's registration   page and create your account by filling in the necessary details.

Send the CAPTCHA task to our server with your API request.

Once you've obtained your API key, the next step is to send the CAPTCHA solving task to the NextCaptcha server. This is done by submitting a task payload that contains specific details of the CAPTCHA challenge.

1.Prepare the Task Payload: Structure the task payload with the necessary parameters such as the CAPTCHA site key, page URL, and other relevant data required for solving the CAPTCHA.

{
  "clientKey": "api key",
  "task": {
    "type": "Recaptchav2TaskProxyless",
    "websiteURL": "https://www.google.com/recaptcha/api2/demo",
    "websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
  }
}

2. Send the Request: Use your API key to authenticate and send the task payload to the NextCaptcha server. The API endpoint will handle your request and initiate the CAPTCHA-solving process.

{
  "clientKey": "api key",
  "taskId": 1781234567890
}

3. Receive Task ID: After submitting the task, you will receive a unique Task ID. This ID will be used to check the status and retrieve the solution once it's processed

Retrieve the task ID to track your CAPTCHA solving progress.

After submitting the CAPTCHA-solving task to the NextCaptcha server, the next step is to retrieve the solution and seamlessly integrate it into your automated workflow.


  import requests
  import time
  
  
  # Retrieve the solved token from NextCaptcha
  retrieve_url = 'https://api.nextcaptcha.com/getTaskResult'
  params = {
      'clientKey': api_key,
      'taskId': captcha_id
  }
  
  solution = None
  while solution is None:
      time.sleep(1)  # Wait a few seconds before checking again
      response = requests.post(retrieve_url, data=params)
      if response.json().get('errorId') == 0:
          solution = response.json().get('solution')
  
  # The reCAPTCHA token
  recaptcha_token = solution["gRecaptchaResponse"]
  print(f'Successfully retrieved token: {recaptcha_token}')
  
            

After a short wait, query the NextCaptcha server using the Task ID to retrieve the solution. The response will contain the solved CAPTCHA token (gRecaptchaResponse), which is necessary to proceed.

{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "gRecaptchaResponse": "03AGdBq26gJ8Yq3z3Zzv"
  },
  "createTime": 1701234567890,
  "endTime": 1701234567890
}

Receive the CAPTCHA solution and continue your automated workflow.

After submitting the CAPTCHA-solving task to the NextCaptcha server, the next step is to retrieve the solution and seamlessly integrate it into your automated workflow.

This process ensures that CAPTCHA challenges are solved in the background, allowing your automation to flow without human intervention.

The full example code of captcha solver


import requests
 
# Your NextCaptcha API key
api_key = 'YOUR_NEXTCAPTCHA_API_KEY'
site_key = '6LcAbwIqAAAAAJvVAhSSJ8qzYsujc7kn1knmSgQX'
page_url = 'https://nextcaptcha.com/'
 
# Step 1: Send a request to NextCaptcha to solve the reCAPTCHA
captcha_request_url = 'https://api.nextcaptcha.com/createTask'
payload = {
    'clientKey': api_key,
    'task': {
        'type':'RecaptchaV3TaskProxyless',
        'websiteURL': page_url,
        'websiteKey': site_key,
        'pageAction': 'submit'
    }
}
 
response = requests.post(captcha_request_url, data=payload)
if response.status_code != 200:
    print('Failed to send request to NextCaptcha')
    exit()
 
response_data = response.json()
 
captcha_id = response_data.get('taskId')
 
# Step 2: Retrieve the solved token from NextCaptcha
retrieve_url = 'https://api.nextcaptcha.com/getTaskResult'
params = {
    'clientKey': api_key,
    'taskId': captcha_id
}
 
solution = None
while solution is None:
    time.sleep(1)  # Wait a few seconds before checking again
    response = requests.post('https://api.nextcaptcha.com/getTaskResult', data={
		  "clientKey": "api key",
		  "taskId": request_id
		})
    if response.json().get('errorId') == 0:
        solution = response.json().get('solution')
 
# The reCAPTCHA token
recaptcha_token = solution["gRecaptchaResponse"]
print(f'Successfully retrieved token: {recaptcha_token}')
 
# Step 3: Use the token in the verify API endpoint
verify_url = 'https://next.nextcaptcha.com/api/captcha-demo/recaptcha_enterprise/verify'
verify_payload = {
    'siteKey': site_key,
    'gRecaptchaResponse': token,
    'action': 'submit'
}
 
verify_response = requests.post(verify_url, json=verify_payload)
if verify_response.status_code == 200:
    print('Verification response:', verify_response.json())
else:
    print('Failed to verify token')