> For the complete documentation index, see [llms.txt](https://docs.hypersolutions.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hypersolutions.co/api-reference/akamai.md).

# Akamai API Reference

API reference for the Hyper Solutions Akamai API: generate sensor data, SBSD payloads and SEC-CPT challenge responses for sites behind Akamai Bot Manager.

{% hint style="info" %}
Tip: Use one of the [SDKs](/start-here/readme-1.md) instead of directly calling the API.
{% endhint %}

[This API](https://hypersolutions.co/products/akamai) generates human-like data based on the most recent chrome browser version on Windows. It is recommended to match the latest TLS and UserAgent of the newest chrome version when using this API on a site.\
\
The latest chrome useragents can be found [here](https://versionhistory.googleapis.com/v1/chrome/platforms/win/channels/stable/versions/). It is perfectly fine to use only one useragent for all your requests.\
\
Note that all request payloads to this API should be sent as `application/json`.\
\
It is advised to use one of the sdks that were written for this API. Feel free to contact me about them.

## Generate sensor data

The first sensor of a session can send the script's sha256 as `scriptHash` instead of `script`. If the API answers `422 script_required`, repeat the request with `script`. See [Script Hash](/start-here/script-hash.md).

## Generate sensor data

> Generates sensor data that should be posted in order to acquire valid "\_abck" cookies

```json
{"openapi":"3.0.0","info":{"title":"AKM Sensor Data and Pixel Payload API","version":"1.0.0"},"servers":[{"url":"https://akm.hypersolutions.co","description":"Main server for sensor and pixel endpoints"}],"paths":{"/v2/sensor":{"post":{"summary":"Generate sensor data","description":"Generates sensor data that should be posted in order to acquire valid \"_abck\" cookies","operationId":"generateSensorData","parameters":[{"in":"header","name":"Content-Type","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"The Content-Type of the request body"},{"in":"header","name":"x-api-key","required":true,"schema":{"type":"string"},"description":"Your API key for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["abck","bmsz","pageUrl","version","userAgent","scriptUrl","ip","acceptLanguage"],"properties":{"abck":{"type":"string","description":"The \"_abck\" cookie to generate sensor data with. This should be obtained from your cookie jar. The cookie for the first request should be from doing a GET request to the script endpoint."},"bmsz":{"type":"string","description":"The \"bm_sz\" cookie to generate sensor data with."},"pageUrl":{"type":"string","description":"The page URL to insert into the generated sensor data. This should be the URL of the page you're currently on, like a product page, login page or home page."},"version":{"type":"string","description":"The Akamai version that the site is on. Supported values are \"2\" and \"3\". When using v3 dynamic, set this value to \"3\"."},"userAgent":{"type":"string","description":"The userAgent that you're using for the entire session"},"script":{"type":"string","description":"Script contents as string. Send it, or its hash as scriptHash, on the first sensor request only. Mutually exclusive with scriptHash and context. v1.75 sensors take no script."},"scriptHash":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"The lowercase hex sha256 of the script exactly as served (the UTF-8 bytes of the string you would send as script), 64 characters. Send it instead of script on the first request of a chain. Mutually exclusive with script and context. If the API has not seen this script yet, it answers 422 script_required. Repeat the request with script."},"scriptUrl":{"type":"string","description":"The full URL of the Akamai sensor script, the src of the script tag the sensor data is posted to."},"ip":{"type":"string","description":"The IP that is used to post the sensor data to the target site. You can use /ip to get the IP from a connection. If you are not using proxies, this will be the IPv4 or IPv6 address of your pc."},"acceptLanguage":{"type":"string","description":"Your accept-language header."},"context":{"type":"string","description":"Leave empty for the first sensor, then send the context from the previous response, without script."}}}}}},"responses":{"200":{"description":"OK Sensor data successfully generated","content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"The generated sensor data"},"context":{"type":"string","description":"The context value to use for generating the next sensor"},"headers":{"description":"The client hints for the device the sensor data describes.","allOf":[{"$ref":"#/components/schemas/ClientHints"}]}}}}}},"400":{"description":"Bad Request Error occurred","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}},"403":{"description":"Forbidden Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}},"422":{"description":"Script required. The API has not seen the script behind scriptHash yet (or its record expired), or the request is solved in a browser that needs the script itself. Not billed. Repeat the same request with script instead of scriptHash; the API stores it and the hash works for every client from then on.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["script_required"],"description":"Always script_required."}}}}}}}}}},"components":{"schemas":{"ClientHints":{"type":"object","description":"The Accept-CH client hints for the device the payload was generated for. Keys are lowercase header names, values are ready to send verbatim (already quoted where the header needs it). Send sec-ch-ua, sec-ch-ua-mobile and sec-ch-ua-platform on every request; send any other hint only if the origin's Accept-CH header lists it. Brands and full versions come from your userAgent, everything else from the device. See the Client Hints page for the full rules.","properties":{"sec-ch-ua":{"type":"string"},"sec-ch-ua-mobile":{"type":"string"},"sec-ch-ua-platform":{"type":"string"},"sec-ch-ua-arch":{"type":"string"},"sec-ch-ua-bitness":{"type":"string"},"sec-ch-ua-model":{"type":"string"},"sec-ch-ua-platform-version":{"type":"string"},"sec-ch-ua-full-version":{"type":"string"},"sec-ch-ua-full-version-list":{"type":"string"},"sec-ch-ua-wow64":{"type":"string"},"sec-ch-ua-form-factors":{"type":"string"},"sec-ch-device-memory":{"type":"string"},"sec-ch-dpr":{"type":"string"},"sec-ch-viewport-width":{"type":"string"},"sec-ch-viewport-height":{"type":"string"},"device-memory":{"type":"string"},"dpr":{"type":"string"},"viewport-width":{"type":"string"},"ect":{"type":"string"},"rtt":{"type":"string"},"downlink":{"type":"string"},"sec-ch-prefers-color-scheme":{"type":"string"},"sec-ch-prefers-reduced-motion":{"type":"string"},"sec-ch-prefers-reduced-transparency":{"type":"string"}}}}}}
```

## Sbsd

Sbsd is a new challenge meant to block scrapings from accessing HTML. You will find it with a blocking page that looks like this:

```html
<html>
   <head>
      <script type="text/javascript" src="https://example.com/assets/33eb14c569f53cae79b60dac7ccf7fcaf0012483407" async ></script><script src="/.well-known/sbsd?v=7ac10a5c-7a4e-fddd-611f-39dcf23f1722&amp;t=99543528"></script>
      <script>
         (function() {
             var proxied = window.XMLHttpRequest.prototype.send;
             window.XMLHttpRequest.prototype.send = function() {
             var pointer = this
             var intervalId = window.setInterval(function(){
                 if (pointer.readyState != 4){
                 return;
                 }
                 location.reload(true)
                 clearInterval(intervalId);
             }, 1);
             return proxied.apply(this, [].slice.call(arguments));
             };
         })();
      </script>
   </head>
   <body>
   </body>
</html>
```

It is important to parse the UUID, this can be done with the following regex:

```regex
v=(.*?)&
```

After parsing the UUID you can make a request to my API with the following API Reference:

## Generate sbsd payload

> Generates sbsd payload that should be posted in order to get around sbsd page

```json
{"openapi":"3.0.0","info":{"title":"AKM Sensor Data and Pixel Payload API","version":"1.0.0"},"servers":[{"url":"https://akm.hypersolutions.co","description":"Main server for sensor and pixel endpoints"}],"paths":{"/sbsd":{"post":{"summary":"Generate sbsd payload","description":"Generates sbsd payload that should be posted in order to get around sbsd page","operationId":"generateSbsdPayload","parameters":[{"in":"header","name":"Content-Type","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"The Content-Type of the request body"},{"in":"header","name":"x-api-key","required":true,"schema":{"type":"string"},"description":"Your API key for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["pageUrl","uuid","userAgent","o","ip","acceptLanguage"],"properties":{"index":{"type":"integer","description":"Optional, superseded by context. Only read when context is empty, where 0 means the first payload of a chain. Leave it out when you chain with context; the current SDKs no longer send it."},"pageUrl":{"type":"string","description":"This should be the URL of the page you're currently on, like a product page, login page or home page. It's also the referer on the sbsd post request in browser."},"uuid":{"type":"string","description":"The uuid of the sbsd challenge (https://example.com/.well-known/sbsd?v=dcc78710-14fe-3835-cc6e-b9b5ea3b6010). uuid is dcc78710-14fe-3835-cc6e-b9b5ea3b6010 on this url."},"userAgent":{"type":"string","description":"The userAgent that you're using for the entire session"},"o":{"type":"string","description":"The \"sbsd_o\" cookie value, if \"sbsd_o\" is not present, use the cookie value from \"bm_so\"."},"script":{"type":"string","description":"The SBSD script body as a string. Send it, or its hash as scriptHash, on the first request of a chain and on every hard block (an SBSD POST with a t parameter), without context. Mutually exclusive with scriptHash and context."},"scriptHash":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"The lowercase hex sha256 of the script exactly as served (the UTF-8 bytes of the string you would send as script), 64 characters. Send it instead of script on the first request of a chain. Mutually exclusive with script and context. If the API has not seen this script yet, it answers 422 script_required. Repeat the request with script. A hard block (an SBSD POST with a t parameter) starts a new chain, so it can also send scriptHash."},"context":{"type":"string","description":"The context returned by the previous SBSD response. Send it, without script, on every request after the first. A hard block (an SBSD POST with a t parameter) always starts a new chain with script and an empty context. Optional today, mandatory soon. Mutually exclusive with script."},"scriptUrl":{"type":"string","description":"Optional. The absolute src of the SBSD script tag, query included, exactly as the page loads it, for example https://example.com/.well-known/sbsd?v=7ac10a5c-7a4e-fddd-611f-39dcf23f1722&t=99543528 Must be an http(s) URL with a host and a path; anything else is rejected with \"invalid scriptUrl, expected the absolute src of the SBSD script tag\"."},"acceptLanguage":{"type":"string","description":"Your accept-language header."},"ip":{"type":"string","description":"The IP that is used to post the sensor data to the target site. You can use /ip to get the IP from a connection. If you are not using proxies, this will be the IPv4 or IPv6 address of your pc."}}}}}},"responses":{"200":{"description":"OK Sbsd payload successfully generated","content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"The generated sbsd payload"},"context":{"type":"string","description":"The context to send on your next SBSD request of this chain, in place of the script field."},"headers":{"description":"The client hints for the device the payload describes.","allOf":[{"$ref":"#/components/schemas/ClientHints"}]}}}}}},"400":{"description":"Bad Request Error occurred","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}},"403":{"description":"Forbidden Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}},"422":{"description":"Script required. The API has not seen the script behind scriptHash yet (or its record expired), or the request is solved in a browser that needs the script itself. Not billed. Repeat the same request with script instead of scriptHash; the API stores it and the hash works for every client from then on.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["script_required"],"description":"Always script_required."}}}}}}}}}},"components":{"schemas":{"ClientHints":{"type":"object","description":"The Accept-CH client hints for the device the payload was generated for. Keys are lowercase header names, values are ready to send verbatim (already quoted where the header needs it). Send sec-ch-ua, sec-ch-ua-mobile and sec-ch-ua-platform on every request; send any other hint only if the origin's Accept-CH header lists it. Brands and full versions come from your userAgent, everything else from the device. See the Client Hints page for the full rules.","properties":{"sec-ch-ua":{"type":"string"},"sec-ch-ua-mobile":{"type":"string"},"sec-ch-ua-platform":{"type":"string"},"sec-ch-ua-arch":{"type":"string"},"sec-ch-ua-bitness":{"type":"string"},"sec-ch-ua-model":{"type":"string"},"sec-ch-ua-platform-version":{"type":"string"},"sec-ch-ua-full-version":{"type":"string"},"sec-ch-ua-full-version-list":{"type":"string"},"sec-ch-ua-wow64":{"type":"string"},"sec-ch-ua-form-factors":{"type":"string"},"sec-ch-device-memory":{"type":"string"},"sec-ch-dpr":{"type":"string"},"sec-ch-viewport-width":{"type":"string"},"sec-ch-viewport-height":{"type":"string"},"device-memory":{"type":"string"},"dpr":{"type":"string"},"viewport-width":{"type":"string"},"ect":{"type":"string"},"rtt":{"type":"string"},"downlink":{"type":"string"},"sec-ch-prefers-color-scheme":{"type":"string"},"sec-ch-prefers-reduced-motion":{"type":"string"},"sec-ch-prefers-reduced-transparency":{"type":"string"}}}}}}
```

You can then post the payload string to the following endpoint:

```
https://example.com/.well-known/sbsd
```

Making a new GET request to the same page (make sure that cookies are included in this request) it will show you the full HTML.

### The sbsd context field

`POST https://akm.hypersolutions.co/sbsd` returns a `context` string alongside `payload`, and the request accepts an optional `context` string:

* The first SBSD call of a session sends `script` (or its sha256 as `scriptHash`, see [Script Hash](/start-here/script-hash.md)) and no `context`.
* Every SBSD call after it sends the `context` from the previous response and must **not** send `script`.
* A hard block (an SBSD POST with a `t` parameter, including the [429 flow](/akamai-web/handling-429-status-codes-with-sbsd-challenges.md)) always starts a new chain: it sends `script` (or `scriptHash`) and an empty `context`, never the context from an earlier call.

`script`, `scriptHash` and `context` are mutually exclusive. A request containing two of them is rejected with an error. Sending the context instead of the script saves re-uploading the script on every call, roughly half a megabyte each time, and improves SBSD success rates.

{% hint style="warning" %}
`context` is optional today and becomes mandatory soon. There is no date yet, we will notify customers before it changes, but update your integration now.
{% endhint %}

The `index` field is unaffected and keeps working as before.

These are the minimum SDK versions that support `context`:

| SDK                                              | Minimum version                           |
| ------------------------------------------------ | ----------------------------------------- |
| Go, `github.com/Hyper-Solutions/hyper-sdk-go/v3` | `v3.0.0`                                  |
| Python, `hyper-sdk`                              | `3.0.0`                                   |
| JS / TS, `hyper-sdk-js`                          | `4.0.0`                                   |
| `hyper-sdk-playwright`                           | `1.0.0-beta.15`, handles it automatically |

The Go module path is now `github.com/Hyper-Solutions/hyper-sdk-go/v3`, the `v2` module is deprecated.

### The sbsd scriptUrl field

`POST https://akm.hypersolutions.co/sbsd` accepts an optional `scriptUrl`: the **absolute src of the SBSD script tag, query included**, exactly as the page loads it, for example:

```
https://example.com/.well-known/sbsd?v=7ac10a5c-7a4e-fddd-611f-39dcf23f1722&t=99543528
```

The browser's SBSD fingerprint includes signals about the script itself, such as its resource-timing entry, which differ between an SBSD script on a normal page and one on a block page (the `t` parameter). With `scriptUrl` set, the payload carries the script's own values the way a browser's does; without it, the API falls back to defaults. Send it whenever you have the script tag.

When set, `scriptUrl` must be an http(s) URL with a host and a path; anything else is rejected with `invalid scriptUrl, expected the absolute src of the SBSD script tag`.

| SDK                                              | Minimum version                           | Field        |
| ------------------------------------------------ | ----------------------------------------- | ------------ |
| Go, `github.com/Hyper-Solutions/hyper-sdk-go/v4` | `v4.0.0`                                  | `ScriptUrl`  |
| Python, `hyper-sdk`                              | `4.0.0`                                   | `script_url` |
| JS / TS, `hyper-sdk-js`                          | `5.0.0`                                   | `scriptUrl`  |
| `hyper-sdk-playwright`                           | `1.0.0-beta.16`, handles it automatically |              |

## Akamai-BM-Telemetry

For sites that protect their API with an `Akamai-BM-Telemetry` request header instead of a sensor post. See [Akamai-BM-Telemetry Header](/akamai-web/akamai-bm-telemetry.md) for how to recognise it and the full flow.

### Generate a telemetry header

`POST https://akm.hypersolutions.co/v1/telemetry`

The request is a [sensor request](#generate-sensor-data) plus `j`. Only v3 dynamic scripts send the header, so `version` can be left out; `"1.75"` and `"2"` are rejected with `telemetry is only supported for v3 dynamic scripts`.

| Field            | Type   | Required    | Description                                                                                                                |
| ---------------- | ------ | ----------- | -------------------------------------------------------------------------------------------------------------------------- |
| `abck`           | string | yes         | The `_abck` cookie from the page load.                                                                                     |
| `bmsz`           | string | yes         | The `bm_sz` cookie from the page load.                                                                                     |
| `pageUrl`        | string | yes         | The URL of the page that loaded the Akamai script.                                                                         |
| `scriptUrl`      | string | yes         | The full URL of the Akamai script (the src of its script tag), no query string.                                            |
| `userAgent`      | string | yes         | Your Chrome user agent.                                                                                                    |
| `acceptLanguage` | string | yes         | Your `accept-language` header.                                                                                             |
| `ip`             | string | yes         | The IP address of your proxy or network.                                                                                   |
| `script`         | string | first call  | The Akamai script. Mutually exclusive with `scriptHash` and `context`.                                                     |
| `scriptHash`     | string | first call  | The lowercase hex sha256 of the script, instead of `script`. See [Script Hash](/start-here/script-hash.md).                |
| `context`        | string | later calls | The `context` from the previous telemetry or telemetry params response. Mutually exclusive with `script` and `scriptHash`. |
| `j`              | string | no          | The `j` from the site's get\_params response, verbatim (still URL-encoded). Leave empty when there is none.                |

| Response field | Description                                                                                                      |
| -------------- | ---------------------------------------------------------------------------------------------------------------- |
| `payload`      | The complete header value, `a=...&&&e=...&&&sensor_data=...&&&j=...`. Send it verbatim as `Akamai-BM-Telemetry`. |
| `context`      | Send it on the next telemetry request.                                                                           |
| `headers`      | The [client hints](/start-here/client-hints.md) for the device the header describes.                             |

Each protected request takes a fresh header: call `/v1/telemetry` before every one, chaining `context`. Never reuse a header.

### Get the get\_params path

`POST https://akm.hypersolutions.co/v1/telemetry/params`

Returns the path of the site's get\_params request, whose JSON response carries the `j` for `/v1/telemetry`. This request does not count towards your usage.

| Field        | Type   | Required | Description                                                                            |
| ------------ | ------ | -------- | -------------------------------------------------------------------------------------- |
| `pageUrl`    | string | yes      | The URL of the page that loaded the Akamai script.                                     |
| `script`     | string | one of   | The Akamai script.                                                                     |
| `scriptHash` | string | one of   | The lowercase hex sha256 of the script. See [Script Hash](/start-here/script-hash.md). |
| `context`    | string | one of   | A context from an earlier telemetry or telemetry params response.                      |

| Response field | Description                                                                                                                                                                                                    |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload`      | The get\_params path exactly as the browser requests it, for example `/_bm/get_params?type=web-jsto&v=aNjc97OfvDBoc9gY88Sbui9EwsB6tx66vij5EVYP8U0=`. The tag is not URL-encoded: request the path as returned. |
| `context`      | Can replace the script on the first `/v1/telemetry` request.                                                                                                                                                   |

### Errors

Both endpoints answer `422` with `{"error": "script_required"}` when they need the script behind a `scriptHash`: repeat the request with `script`. They answer `400` with `{"error": "..."}` on invalid input:

| Error                                                | Cause                                                                         |
| ---------------------------------------------------- | ----------------------------------------------------------------------------- |
| `script, scriptHash or context must be set`          | None of `script`, `scriptHash` and `context` was sent.                        |
| `script and context are mutually exclusive`          | Both were sent.                                                               |
| `script and scriptHash are mutually exclusive: ...`  | Both were sent.                                                               |
| `scriptHash and context are mutually exclusive: ...` | Both were sent.                                                               |
| `malformed scriptHash, ...`                          | `scriptHash` is not 64 lowercase hex characters.                              |
| `missing pageUrl` / `invalid pageUrl`                | `pageUrl` is empty or not a URL.                                              |
| `missing scriptUrl` / `invalid scriptUrl, ...`       | `/v1/telemetry` only: `scriptUrl` is empty or not the full Akamai script URL. |
| `telemetry is only supported for v3 dynamic scripts` | `/v1/telemetry` only: `version` is `"1.75"` or `"2"`.                         |

## Pixel

Pixel is not required by most sites. Please discuss with support first if you think the site requires it. Your site having the pixel script does not mean it has pixel enforced.

## Generate pixel payload

## Generate pixel payload

> Generates a pixel payload to use to obtain a "ak\_bmsc" cookie. Note that the payload returned is already url-encoded.

```json
{"openapi":"3.0.0","info":{"title":"AKM Sensor Data and Pixel Payload API","version":"1.0.0"},"servers":[{"url":"https://akm.hypersolutions.co","description":"Main server for sensor and pixel endpoints"}],"paths":{"/pixel":{"post":{"summary":"Generate pixel payload","description":"Generates a pixel payload to use to obtain a \"ak_bmsc\" cookie. Note that the payload returned is already url-encoded.","operationId":"generatePixelPayload","parameters":[{"in":"header","name":"Content-Type","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"The Content-Type of the request body"},{"in":"header","name":"x-api-key","required":true,"schema":{"type":"string"},"description":"Your API key for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["htmlVar","scriptVar","userAgent","ip","acceptLanguage"],"properties":{"htmlVar":{"type":"string","description":"The bazadebezolkohpepadr value."},"scriptVar":{"type":"string","description":"The u value that gets sent in the payload. It's hidden somewhere in the first array in the pixel script."},"userAgent":{"type":"string","description":"The userAgent that you're using for your whole session."},"acceptLanguage":{"type":"string","description":"Your accept-language header."},"ip":{"type":"string","description":"The IP that is used to post the sensor data to the target site. You can use /ip to get the IP from a connection. If you are not using proxies, this will be the IPv4 or IPv6 address of your pc."}}}}}},"responses":{"200":{"description":"OK Pixel payload successfully generated","content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"string","description":"The generated pixel payload (url-encoded)"}}}}}},"400":{"description":"Bad Request Error occurred","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}},"403":{"description":"Forbidden Authentication error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}}}}}}}}
```
