Imperva (Incapsula)

-
Use your own proxies to perform this task.
-
If your proxy uses IP-based authorization, you must whitelist the address 65.21.190.34.
-
After solving, you will receive special cookies that must be added to the browser.
Request parameters
type<string>requiredCustomTask
class<string>requiredImperva
websiteURL<string>requiredThe address of the main page where Incapsula is located.
incapsulaScriptUrl (inside metadata)<string>required"incapsulaScriptUrl": "_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3" - Name of the Incapsula JS file.
incapsulaCookies (inside metadata)<string>requiredYour cookies from Incapsula. They can be obtained on the page using document.cookie or in the request header Set-Cookie: "incap_sess_=...; visid_incap_=..." (see the /createTask request example).

proxyType<string>requiredhttp - regular http/https proxy;
https - try this option only if "http" doesn't work (required for some custom proxies);
socks4 - socks4 proxy;
socks5 - socks5 proxy.
proxyAddress<string>requiredIPv4/IPv6 proxy IP address. Not allowed:
- using transparent proxies (where you can see the client's IP);
- using proxies on local machines.
proxyPort<integer>requiredProxy port.
proxyLogin<string>requiredProxy-server login.
proxyPassword<string>requiredProxy-server password.
reese84UrlEndpoint (inside metadata)<string>optionalThe name of the endpoint where the reese84 fingerprint is sent can be found among the requests and ends with ?d=site.com

userAgent<string>optionalBrowser User-Agent.
Pass only a valid UA from Windows OS. Currently it is: userAgentPlaceholder
Create task method
https://api.capmonster.cloud/createTask
Request
{
"clientKey": "API_KEY",
"task": {
"type": "CustomTask",
"class": "Imperva",
"websiteURL": "https://example.com",
"userAgent": "userAgentPlaceholder",
"metadata": {
"incapsulaScriptUrl": "_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3",
"incapsulaCookies": "incap_ses_1166_2930313=br7iX33ZNCtf3HlpEXcuEDzz72cAAAAA0suDnBGrq/iA0J4oERYzjQ==; visid_incap_2930313=P3hgPVm9S8Oond1L0sXhZqfK72cAAAAAQUIPAAAAAABoMSY9xZ34RvRseJRiY6s+;",
"reese84UrlEndpoint": "Built-with-the-For-hopence-Hurleysurfecting-the-"
},
"proxyType": "http",
"proxyAddress": "8.8.8.8",
"proxyPort": 8080,
"proxyLogin": "proxyLoginHere",
"proxyPassword": "proxyPasswordHere"
}
}
Response
{
"errorId": 0,
"taskId": 407533072
}
Get task result method
Use the method getTaskResult to obtain the Imperva solution.
https://api.capmonster.cloud/getTaskResult
Request
{
"clientKey":"API_KEY",
"taskId": 407533072
}
Response
{
"errorId":0,
"status":"ready",
"solution": {
"domains": {
"https://example.com": {
"cookies": {
"___utmvc": "NMB+nRa4inxXNeXuhPl9w4opzdo2afqlceX5uMBLwrduDVo64yb4KunkabEeLYXmKZuVhloliIv6fWevXUcT1WJiFklg9AghMBMkDFjDAEtAnK639bNQi/ob8l+hp/5wf/WpTQcIkG8F9VifAEcZG7MxawsEpYJxkLji4vDSUbGuHPNf5CzIyEzATfw6UVBRiLiDdUvFWboxszG1T5aUrwQYgIlmm1B2X5ZZW4BzwN3k8Md5J+jIdllfdTaxK9JQfuqYQCdT/g5mifg2TPbrwVQeN14avfo1xQr88Mh+m4oclb0yR6VJp2vaVktDSIe2cwCZ3sKKYE0rzkCpcJb9530gRCOT3YxCtyU4Qqg6yRIf8Rk4q/KRSC8/VJ9ezreZ221mURm4FnFH+OF0PqjAiLd/lVK6oTO6BIet4ykEKCtch9EVk0hgGJieaG1F1Nt5haZcSNjGBa15wPyD2OFZe0kI7VBopsUyWqiD0Ydun6+WD/7aDHROngJj0VIZjSuOnQuVQDK2Vcw9gTVvvqwnDhR28ff0gj5b+LAkvrykfgO/AQO0K/DNCF0HgmWIMiSJeoohCpCa/UArU8tDtETnuxGKGaaJOsGKsPtOS5VRQlyRa+D0inSAVY77lpWF5+9SOS+Ioxlq3r8ovFosR33OOcBCEgAlrkdTNNKvK27mWNwmi+ccKkyuJw5Gtk3SEsYNZ75KU/ok+sKBZM5OIsrmp9ivj+nx0oi7yQf6q0Oksbwr2xTFANsIfpoOJBIMylVSCRGwEbpoN4+IJitczOtb8D/TmfHx5P1td0NWTli7UhqFSADS0CcH+vfBos4nucByHjMxkiK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
"reese84":"3:+K02uF6IfjbaMpdv1+5JLw==:x0jVrEYjOB+rVD2ZkdV2gpcVRjsahu5tqUlnsFl5amKje2ikXLJO6QHty6ipwIPX29mSruAp/AhCg15DjBX+EeYyC+ugScX2MtXA62fTUzELpZs2hkd428Q96bpb4lpEZSSVa5B6CBBtGL7VluNDjuVXo6BIUx+9CUFKxf2Zw7RW+BHCmdCZsHJdeCAIZ4h17IzTp3UgFNoxKwSp3fDwuYRgfg1BoezZWNcP4eAs2oaMcBmo66C8pLU8QoHFo5sp6BE43HbjYJ47RrbkokYRRhYwwe2n8OfkCws+9bQq++3LsThVxN37eeWH7UhVd7YlO+ldMOrMZHHP9U6ShTJZDVPUv++XGlKYw4B1sxaf0jN+2vc1a4zPX+eFlsnrvhymURYvE9fjgGjvFSVO+nQb3M50iKTKN/eHbshgnw2UcZmCvzCfcsGJl+idSsieA20YWe13lFAOIIQ3U1wct+EYjmJlSBq02IIn9Y+WtPXP4lkXzXex0W8I14k+uBe+XSb1:vIosWJM6+1OFaFys4VFDiTJ75BZg/k/jwaygMW3VKpU=; Max-Age=31536000; Domain=.site.com; Path=/; Secure; SameSite=Lax"
}
}
}
}
}
Access denied
Error 16 - this error is related to the use of proxy servers that do not match the required geolocation.
How to find all required parameters for task creation
Automatically
To automate parameter extraction, you can retrieve them via a browser (regular or headless, e.g., using Playwright) or directly from HTTP requests. Since dynamic parameter values are short-lived, it is recommended to use them immediately after retrieval.
The provided code snippets are basic examples for learning how to extract the required parameters. The exact implementation will depend on your captcha page, its structure, and the HTML elements and selectors used.
- JavaScript
- Python
- C#
Show code (Node.js)
import { chromium } from "playwright";
(async () => {
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto("https://www.example.com/");
// Extract the src attribute from the iframe with id main-iframe
const iframeSrc = await page.$eval("#main-iframe", (iframe) =>
iframe.getAttribute("src")
);
console.log("iframe src:", iframeSrc);
// Get all cookies
const cookies = await page.context().cookies();
// Filter cookies that start with visid_incap_ or incap_ses_
const filteredCookies = cookies.filter(
(cookie) =>
cookie.name.startsWith("visid_incap_") ||
cookie.name.startsWith("incap_ses_")
);
filteredCookies.forEach((cookie) => {
console.log(`${cookie.name}=${cookie.value}`);
});
await browser.close();
})();
Show code
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
await page.goto("https://www.example.com/")
# Extract the src attribute from the iframe with id main-iframe
iframe_src = await page.locator("#main-iframe").get_attribute("src")
print("iframe src:", iframe_src) # Output the src value
# Get all cookies
cookies = await page.context.cookies()
# Filter cookies that start with visid_incap_ or incap_ses_
filtered_cookies = [
cookie for cookie in cookies
if cookie["name"].startswith("visid_incap_") or cookie["name"].startswith("incap_ses_")
]
for cookie in filtered_cookies:
print(f"{cookie['name']}={cookie['value']}")
await browser.close()
asyncio.run(main())
Show code
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Playwright;
class Program
{
public static async Task Main(string[] args)
{
var playwright = await Playwright.CreateAsync();
var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions { Headless = false });
var page = await browser.NewPageAsync();
await page.GotoAsync("https://www.example.com/");
// Extract the src attribute from the iframe with id main-iframe
var iframeSrc = await page.GetAttributeAsync("#main-iframe", "src");
Console.WriteLine("iframe src: " + iframeSrc); // Output the src value
// Get all cookies
var cookies = await page.Context.CookiesAsync();
// Filter cookies that start with visid_incap_ or incap_ses_
var filteredCookies = cookies.Where(cookie =>
cookie.Name.StartsWith("visid_incap_") || cookie.Name.StartsWith("incap_ses_"));
foreach (var cookie in filteredCookies)
{
Console.WriteLine($"{cookie.Name}={cookie.Value}");
}
await browser.CloseAsync();
}
}
Use the SDK library
- JavaScript
- Python
Show code (for browser)
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, ImpervaRequest } from '@zennolab_com/capmonstercloud-client';
const API_KEY = "YOUR_API_KEY"; // Specify your CapMonster Cloud API key
document.addEventListener("DOMContentLoaded", async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: API_KEY })
);
// Optionally, you can check the balance
const balance = await cmcClient.getBalance();
console.log("Balance:", balance);
const proxy = {
proxyType: "http",
proxyAddress: "123.45.67.89",
proxyPort: 8080,
proxyLogin: "username",
proxyPassword: "password"
};
// Setup Imperva (Incapsula) task
const impervaRequest = new ImpervaRequest({
websiteURL: "https://example.com/", // URL of your Imperva-protected page
metadata: {
incapsulaScriptUrl: "_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3",
incapsulaCookies: "incap_ses_1166_2930313=br7iX33ZNCtf3HlpEXcuEDzz72cAAAAA0suDnBGrq/iA0J4oERYzjQ==; visid_incap_2930313=P3hgPVm9S8Oond1L0sXhZqfK72cAAAAAQUIPAAAAAABoMSY9xZ34RvRseJRiY6s+;"
},
proxy
});
const result = await cmcClient.Solve(impervaRequest);
console.log("Solution:", result.solution);
});
Show code (Node.js)
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, ImpervaRequest } from '@zennolab_com/capmonstercloud-client';
async function main() {
const cmcClient = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: 'YOUR_API_KEY' }) // Specify your CapMonster Cloud API key
);
// Optionally, you can check the balance
const balance = await cmcClient.getBalance();
console.log('Balance:', balance);
const proxy = {
proxyType: "http",
proxyAddress: '123.45.67.89',
proxyPort: 8080,
proxyLogin: 'username',
proxyPassword: 'password'
};
// Setup Imperva (Incapsula) task
const impervaRequest = new ImpervaRequest({
websiteURL: 'https://example.com/', // URL of your Imperva-protected page
metadata: {
incapsulaScriptUrl: '_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3',
incapsulaCookies: 'incap_ses_1166_2930313=br7iX33ZNCtf3HlpEXcuEDzz72cAAAAA0suDnBGrq/iA0J4oERYzjQ==; visid_incap_2930313=P3hgPVm9S8Oond1L0sXhZqfK72cAAAAAQUIPAAAAAABoMSY9xZ34RvRseJRiY6s+;',
},
proxy,
});
const result = await cmcClient.Solve(impervaRequest);
console.log('Solution:', result.solution);
}
main().catch(console.error);
Show code
# https://github.com/ZennoLab/capmonstercloud-client-python
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import ImpervaCustomTaskRequest
from capmonstercloudclient.requests.baseRequestWithProxy import ProxyInfo
API_KEY = "YOUR_API_KEY" # Specify your CapMonster Cloud API key
async def solve_imperva_captcha():
client_options = ClientOptions(api_key=API_KEY)
cap_monster_client = CapMonsterClient(options=client_options)
# Setup your own proxy
proxy = ProxyInfo(
proxyType="http",
proxyAddress="123.45.67.89",
proxyPort=8080,
proxyLogin="username",
proxyPassword="password"
)
# Setup Imperva (Incapsula) task
imperva_request = ImpervaCustomTaskRequest(
websiteUrl="https://example.com",
metadata={
"incapsulaScriptUrl": "_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3",
"incapsulaCookie": "incap_ses_1166_2930313=br7iX33ZNCtf3HlpEXcuEDzz72cAAAAA0suDnBGrq/iA0J4oERYzjQ==; visid_incap_2930313=P3hgPVm9S8Oond1L0sXhZqfK72cAAAAAQUIPAAAAAABoMSY9xZ34RvRseJRiY6s+;",
"reese84UrlEndpoint": "Built-with-the-For-hopence-Hurleysurfecting-the-"
},
proxy=proxy
)
# Optionally, you can check the balance
balance = await cap_monster_client.get_balance()
print("Balance:", balance)
result = await cap_monster_client.solve_captcha(imperva_request)
print("Solution:", result)
asyncio.run(solve_imperva_captcha())
