Kasada overview
Kasada protects a site with a script, ips.js. The browser runs it and posts the result to the sensor’s /tl, and
accepting that post gives the session its tokens, the x-kpsdk-* headers. After that, every request to the site’s protected endpoints
carries those tokens plus a fresh proof of work.
We build two things for you: the /tl payload from the script your session fetched, and the proof of work for each
protected request. You make every request to the site yourself, from your own session and proxy. We never fetch the
script or contact the site.
Base URL: https://ksd.antibotapi.com. Requests take about 200 ms the first time we see a script build and 10–20 ms
after that. Chrome on Windows only.
The flow
Section titled “The flow”- Request a protected page or API and get blocked (
403or429). GET /mfcon the sensor. Keep thex-kpsdk-hit returns.GET /fp. Read the firstx-kpsdk-ctand theimvalue from it.GET /ips.jswith those values. This is the script.- Send the script to
POST /tland get the headers and payload back. Billed. POST /tlon the sensor with that payload. Keep the newx-kpsdk-ctand thex-kpsdk-stit returns.- Send
st,ctand the API’s host toPOST /cdfor a proof of work. Free. - Make the protected request with
x-kpsdk-ct,x-kpsdk-h,x-kpsdk-vandx-kpsdk-cd.
Steps 5 and 7 are the calls to us. Payload covers steps 1–6 and Proof of work covers 7–8.
Which headers go where
Section titled “Which headers go where”| Header | Comes from | Send on the sensor’s /tl |
Send on protected requests |
|---|---|---|---|
x-kpsdk-ct |
Our /tl response, then the sensor’s /tl response |
Ours | The sensor’s (newer) |
x-kpsdk-dt |
Our /tl response |
Yes | No |
x-kpsdk-im |
Our /tl response |
Yes | No |
x-kpsdk-v |
Our /tl response |
Yes | Yes |
x-kpsdk-h |
Your /mfc response |
No | Yes |
x-kpsdk-cd |
Our /cd response |
No | Yes, a new one each time |
Our /tl response also contains x-kpsdk-r, x-kpsdk-dv and x-kpsdk-fc as empty strings, and x-kpsdk-h as 01.
Do not send them; send h from your own /mfc. An empty header is not the same as no header, and the sensor can tell.
Use a fresh script
Section titled “Use a fresh script”A script solves for a few days after it was served. An old one fails with a 502. If a site that was working starts
returning 502, fetch a new ips.js first.
Approved hosts
Section titled “Approved hosts”We accept only hosts approved for your account; any other answers 403 and names the host. Approval is per host, not
per site:
/tlchecks the host inips_link, the host serving the script./cdchecksdomain, the host of the protected API.
They are often different. Twitch serves the script from k.twitchcdn.net and its API is gql.twitch.tv, so solving
Twitch needs both approved. Request hosts from the dashboard and list both when they differ.
Billing
Section titled “Billing”Each 200 from POST /tl is one solve. POST /cd is free and unmetered, and refused requests cost nothing.