For the complete documentation index, see llms.txt. This page is also available as Markdown.

Script Hash

Send the sha256 of a challenge script as scriptHash instead of the full script, and retry with the script when the API answers 422 script_required.

Endpoints that take a challenge script also accept scriptHash: the lowercase hex sha256 of the script exactly as the site served it. Challenge scripts are about 600 to 800 KB; the hash is 64 bytes. Once any client has sent a script, every client can send its hash instead.

Which endpoints accept it

Product
Endpoints
Rule

Akamai

/v2/sensor, /sbsd, /v1/telemetry, /v1/telemetry/params

script, scriptHash and context are mutually exclusive. The first request of a chain sends script or scriptHash, later ones send context.

DataDome

/interstitial, /slider

Never both. Without either, a fixed bundle version is used; always send one.

Incapsula

/reese84

Exactly one of script and scriptHash is required.

Akamai v1.75 sensors take no script. /utmvc, /tags and the Kasada endpoints are unchanged.

How it works

  1. Compute the sha256 of the script: the UTF-8 bytes of the exact string you would otherwise send as script, encoded as 64 lowercase hex characters. Do not trim, reformat or re-encode the script first.

  2. Send the request with scriptHash in place of script.

  3. If the API answers HTTP 422 with {"error": "script_required"}, repeat the same request once with script instead of scriptHash. The 422 is not billed.

After that retry, the API has the script and the hash works for every client. A script is kept for at least 7 days. If it has expired, the API answers script_required again and the same retry stores it once more.

Some requests are solved in a real browser on our side. Those need the script itself and also answer script_required to a hash-only request; the same retry handles them, so treat every script_required the same way.

Errors

Status
Body
Cause

422

{"error": "script_required"}

The API needs the script for this request. Retry once with script.

400

{"error": "..."}

script and scriptHash sent together, or on Akamai scriptHash with context.

400

{"error": "..."}

scriptHash is not 64 lowercase hex characters.

400

{"error": "missing script or scriptHash"}

Incapsula: neither was sent.

Example

The examples call Incapsula's /reese84; the same pattern works for every endpoint above. body holds the rest of the request fields.

On Akamai, only the first request of a chain carries script or scriptHash; keep sending context on the requests after it as before.

Hash the script as you received it from the site. If your HTTP client decodes the body into a string, hash that string's UTF-8 bytes, which is what the API hashes when you send the same string as script.

Last updated