Skip to main content
Are you experiencing issues obtaining the token?
Contact support

AmazonTask | AWS WAF Captcha and Challenge

Solving CAPTCHA and challenge in AWS WAF

More on the topic in our blog
Warning!

This task will be performed using our proxy servers.

Possible captcha variants

Request parameters

Option 1

type<string>required

AmazonTaskProxyless


websiteURL<string>required

The address of the main page where the captcha is solved.


websiteKey<string>required

Can be found in the apiKey field when rendering the captcha


captchaScript<string>required

Link to jsapi.js on html page, has the form <Integration URL>/jsapi.js


cookieSolution<boolean>optional

Default false. If you require an ‘aws-waf-token’ cookie, then specify a value of true. Otherwise you will get "captcha_voucher" and "existing_token" in response.

Option 2

type<string>required

AmazonTaskProxyless


websiteURL<string>required

The address of the main page where the captcha is solved.


challengeScript<string>required

Link to challenge.js (see description below)


captchaScript<string>optional

Link to captcha.js (maybe missing if you just have a challenge)


websiteKey<string>required

A string that can be retrieved from an html page with a captcha or with javascript by executing the window.gokuProps.key


context<string>required

A string that can be retrieved from an html page with a captcha or with javascript by executing the window.gokuProps.context


iv<string>required

A string that can be retrieved from an html page with a captcha or with javascript by executing the window.gokuProps.iv


cookieSolution<boolean>optional

By default false. If you need to use cookies "aws-waf-token", specify the value true. Otherwise, what you will get in return is "captcha_voucher" and "existing_token".

How to get websiteKey, context, iv and challengeScript parameters

When you go to a website, you get a 405 response and an html page with a captcha. It is from this page that you can get all the parameters:

Task Creation Methods

Option 1

POST
https://api.capmonster.cloud/createTask

Request

{
"clientKey": "API_KEY",
"task": {
"type": "AmazonTaskProxyless",
"websiteURL": "https://example.com/index.html",
"websiteKey": "h15hX7brbaRTR...Za1_1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
"captchaScript": "https://234324vgvc23.yejk.captcha-sdk.awswaf.com/234324vgvc23/jsapi.js",
"cookieSolution": true
}
}

Response

{
"errorId":0,
"taskId":407533072
}

Option 2

POST
https://api.capmonster.cloud/createTask

Request

{
"clientKey": "API_KEY",
"task": {
"type": "AmazonTaskProxyless",
"websiteURL": "https://example.com",
"challengeScript": "https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js",
"captchaScript": "https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js",
"websiteKey": "AQIDA...wZwdADFLWk7XOA==",
"context": "qoJYgnKsc...aormh/dYYK+Y=",
"iv": "CgAAXFFFFSAAABVk",
"cookieSolution": true
}
}

Response

{
"errorId":0,
"taskId":407533072
}

Get task result method

Use the getTaskResult method to get the AmazonTask solution.

POST
https://api.capmonster.cloud/getTaskResult

Request

{
"clientKey":"API_KEY",
"taskId": 407533072
}

Response

{
"errorId":0,
"status":"ready",
"solution": {
"cookies": {
"aws-waf-token": "10115f5b-ebd8-45c7-851e-cfd4f6a82e3e:EAoAua1QezAhAAAA:dp7sp2rXIRcnJcmpWOC1vIu+yq/A3EbR6b6K7c67P49usNF1f1bt/Af5pNcZ7TKZlW+jIZ7QfNs8zjjqiu8C9XQq50Pmv2DxUlyFtfPZkGwk0d27Ocznk18/IOOa49Rydx+/XkGA7xoGLNaUelzNX34PlyXjoOtL0rzYBxMAQy0D1tn+Q5u97kJBjs5Mytqu9tXPIPCTSn4dfXv5llSkv9pxBEnnhwz6HEdmdJMdfur+YRW1MgCX7i3L2Y0/CNL8kd8CEhTMzwyoXekrzBM="
},
"userAgent": "userAgentPlaceholder"
}
}

Use SDK Library

// https://github.com/ZennoLab/capmonstercloud-client-js

import { CapMonsterCloudClientFactory, ClientOptions, AmazonProxylessRequest } from '@zennolab_com/capmonstercloud-client';

document.addEventListener('DOMContentLoaded', async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));
console.log(await cmcClient.getBalance());

const amazonRequest = new AmazonProxylessRequest({
websiteURL: 'https://example.com',
websiteKey: 'websiteKey',
challengeScript: 'https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js',
captchaScript: 'https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js',
context: 'qoJYgnKsc...aormh/dYYK+Y=',
iv: 'CgAAXFFFFSAAABVk',
});

console.log(await cmcClient.Solve(amazonRequest));
});