Akamai
Create a task through sync api https://sync.ez-captcha.com/createSyncTask, and get the result directly
If you obtain an invalid token, please contact us. It will usually work normally after we optimize it.
Task Type
Task Type | Description | Price(USD) |
|---|---|---|
AkamaiWEBTaskProxyless | Akamai solution | $2.5/1k |
Sensor Data
Parameter | Type | Required | Description |
|---|---|---|---|
pageUrl | string | true | your target page url that you want to bypass |
v3Url | string | true | Enter the Akamai v3 script URL. Note that for most websites, this URL changes with each request, so it needs to be obtained dynamically. |
bmsz | string | true | bm sz cookie value (need to be the latest) |
abck | string | true | _abck cookie value (need to be the latest) |
ua | string | true | The UserAgent used in your program (must be consistent) only supports Chrome's UserAgent. It is recommended to use the latest version of Chrome's UserAgent. |
lang | string | true | The language used, consistent with the accept-language header in the request, such as "en-GB","en-US". |
script_base64 | string | true | Only needs to be sent in the first packet, the value is the Base64 encoded form of the akamai v3 javascript. |
index | int32 | true | Indicates the sequence number of the current packet, starting from 0. |
encodeData | string | true | The value is empty in the first packet; it is obtained from the first packet's return value. After the first packet, only this value needs to be populated; script_base64 does not need to be populated. |
Remarks
Some websites still consider the abck cookie valid even when it's "~-1~", so we recommend validating its effectiveness each time you get it, up to eight attempts. The number of times sensor_data is sent depends on the website's protection level.
The lang parameter, the accept-language field in the request header, and the proxy’s region must be consistent.
Only Chrome ua are supported. It is recommended to use the latest version of Chrome's ua.
Most website v3 url change randomly, so you need to dynamically obtain them with each request.
When using the _abck cookie finally, ensure the IP, UA, and TLS settings are the same as when sending the previous sensor_data packet.
Create Task
Example
POST https://sync.ez-captcha.com/createSyncTask
Content-Type: application/json
{
"clientKey": "YourClientKey",
"task": {
"type": "AkamaiWEBTaskProxyless",
"pageUrl": "websiteUrl",
"v3Url":"v3Url",
"bmsz": "xxx",
"abck": "xxx",
"ua": "xxx",
"lang": "xxx",
"script_base64": "xxx",
"index": 0,
"encodeData": "xxx"
}
}The API returns payload and encodedata in the response body. payload represents the sensor_data that needs to be sent.
Response Example
The returned payload is submitted as sensor_data to the website api via POST request.
{
"errorId": 0,
"solution": {
"payload": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"encodedata": "xxxxxxxx"
},
"status": "ready"
}
Code Example
import base64
from curl_cffi import requests
import threading
from typing import Dict, List
import json
def akamai_v3_post():
url = "WebsiteUrl"
v3_url = "v3_script_url"
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36'
client_key = 'YourClientKey'
proxies = {
#'http': 'http://127.0.0.1:8888',
#'https': 'https://127.0.0.1:8888'
}
headers1: Dict[str, str] = {
'cache-control': 'max-age=0',
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="135", "Google Chrome";v="135"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'upgrade-insecure-requests': '1',
'user-agent': user_agent,
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'sec-fetch-site': 'none',
'sec-fetch-mode': 'navigate',
'sec-fetch-user': '?1',
'sec-fetch-dest': 'document',
'accept-encoding': 'gzip, deflate, br, zstd',
'accept-language': 'en-GB,en;q=0.9',
'priority': 'u=0, i'
}
headers2: Dict[str, str] = {
'sec-ch-ua-platform': '"Windows"',
'user-agent': user_agent,
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="135", "Google Chrome";v="135"',
'sec-ch-ua-mobile': '?0',
'accept': '*/*',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'no-cors',
'sec-fetch-dest': 'script',
'referer': url,
'accept-encoding': 'gzip, deflate, br, zstd',
'accept-language': 'en-GB,en;q=0.9',
'priority': 'u=2'
}
try:
session = requests.Session()
resp1 = session.get(
url,
headers=headers1,
proxies=proxies,
verify=False,
impersonate="chrome124"
)
resp2 = session.get(
v3_url,
headers=headers2,
proxies=proxies,
verify=False,
impersonate="chrome124"
)
bz_sz_cookie = session.cookies.get('bm_sz', '')
abck_cookie = session.cookies.get('_abck', '')
resp_script = base64.b64encode(resp2.content).decode('utf-8')
ez_url = "https://sync.ez-captcha.com/createSyncTask"
payload = {
"clientKey":client_key,
"task":{
"type": "AkamaiWEBTaskProxyless",
"pageUrl": url,
"v3Url":v3_url,
"bmsz": bz_sz_cookie,
"abck":abck_cookie,
"ua": user_agent,
"lang": "en-GB",
"script_base64": resp_script,
"index": 0,
"encodeData": ""
}
}
response = requests.post(ez_url, json=payload, timeout=10)
encodedata = json.loads(response.text).get('solution').get('encodedata')
sensordata = {'sensor_data':json.loads(response.text).get('solution').get('payload')}
count = 1
while count <= 8:
resp3 = session.post(
v3_url,
headers=headers2,
proxies=proxies,
verify=False,
json=sensordata,
impersonate="chrome124"
)
ret_cookie = session.cookies.get('_abck', '')
#Check if using the cookie directly is effective; if so, return it. If not, continue attempting to retrieve it up to eight times.
#if ..... return
print(ret_cookie)
payload = {
"clientKey":client_key,
"task":{
"type": "AkamaiWEBTaskProxyless",
"pageUrl": url,
"v3Url":v3_url,
"bmsz": bz_sz_cookie,
"abck":ret_cookie,
"ua": user_agent,
"lang": "en-GB",
"script_base64": "",
"index": count,
"encodeData": encodedata
}
}
response = requests.post(ez_url, json=payload, timeout=10)
sensordata = {'sensor_data':json.loads(response.text).get('solution').get('payload')}
count = count + 1
print("Get cookie error")
except Exception as e:
print(f"Request error: {e}")
return None
if __name__ == "__main__":
akamai_v3_post()
428 StatusCode
If you encounter a 428 status code, please contact us and we will help you resolve it.