Kasada x-kpsdk-cd Single-Use Headers, st/rst Timestamps, and Clock Skew
The Kasada x-kpsdk-cd header is a single-use proof-of-work value bound to a session's x-kpsdk-ct token and timing anchors (st and rst), generated right before each protected request via POST /Solver/cd. Below: why pre-computed pools fail, how /p.js parameters work, and how to call the endpoint.
Who this is for
Engineers building authorized HTTP clients against Kasada-protected APIs who have already completed the initial /fp and /tl bootstrap, and need to generate valid x-kpsdk-cd headers on subsequent POST or GraphQL calls.
On this page
- How does x-kpsdk-cd differ from the session x-kpsdk-ct header?
- Why do pre-computed x-kpsdk-cd queues and clock skew cause rejections?
- How do you call POST /Solver/cd right before a protected request?
- What error codes can POST /Solver/cd return and how should you handle them?
- Key takeaways
- Conclusion and scope
- Evidence and sources
- Frequently asked questions
How does x-kpsdk-cd differ from the session x-kpsdk-ct header?
While x-kpsdk-ct identifies the verified client session across multiple requests, x-kpsdk-cd is a per-request proof generated immediately before each protected action.
In a standard Kasada handshake over a trusted TLS session, your client first solves the ips.js challenge via POST /Solver/solve and posts the binary telemetry to the target's /tl route. Once /tl accepts that submission, the target returns a session-scoped x-kpsdk-ct header. However, when your client subsequently calls a protected business endpoint (such as login, checkout, or search), the target requires both the session x-kpsdk-ct header and a fresh x-kpsdk-cd proof header.
Session x-kpsdk-ct versus per-action x-kpsdk-cd
Understanding the lifecycle difference between the two headers prevents accidental token reuse:
| Dimension | x-kpsdk-ct (Client token) | x-kpsdk-cd (Challenge data proof) |
|---|---|---|
| How it is obtained | Returned by the target on /fp and refreshed on /tl | Computed by the client script or via POST /Solver/cd |
| Reuse policy | Carried across protected calls within the active session | Single-use; generate one immediately before each protected call |
| Input dependencies | Issued after POST /Solver/solve + /tl acceptance | Depends on host, platform, session ct, /p.js, and st/rst |
| Catmouse endpoint | POST /Solver/solve (takes ctToken, returns ctHeader) | POST /Solver/cd (or alias POST /cd) |
Why do pre-computed x-kpsdk-cd queues and clock skew cause rejections?
Pre-computing x-kpsdk-cd values in a background queue fails because each proof embeds timing anchors that must stay coherent with the moment the request is sent.
As documented in the Catmouse OpenAPI 3.1 specification (/openapi.json), a reused or early-generated x-kpsdk-cd value is rejected by Kasada. In contrast to static HMAC signatures, the proof embeds timing anchors (st and rst) alongside parameters extracted from the target's /p.js script (or the server's warmed per-host cache).
Depending on whether your client tracks its own timing anchors from x-kpsdk-r or lets the API generate them, two rules govern st and rst in POST /Solver/cd:
- Send both or omit both: If you supply custom timing anchors in the request body, you must pass both
standrstas integers. Sending one without the other is rejected immediately with HTTP400(invalid_st_rst). - Generate just-in-time: When you omit
standrst,POST /Solver/cdgenerates a coherent pair at call time. Because the proof is anchored to that timestamp, your client should attach the returnedcdstring and dispatch the outbound HTTP request immediately rather than stockpiling proofs in a worker pool.
x-kpsdk-cd generation and st/rst timing alignment via POST /Solver/cd. Diagram by Catmouse Engineering.How do you call POST /Solver/cd right before a protected request?
Send a JSON POST to https://kasadaapi.catmouse.ai/Solver/cd with host, platform, and your session ct token immediately before issuing the protected request.
The Python example below follows the documented CdRequest schema in /openapi.json:
import os
import requests
cd_resp = requests.post(
"https://kasadaapi.catmouse.ai/Solver/cd",
headers={"x-api-key": os.environ["CATMOUSE_KEY"]},
json={
"host": "www.example.com",
"platform": "web",
"ct": "<x-kpsdk-ct of the session, at least 16 characters>",
},
timeout=15,
)
data = cd_resp.json()
print(cd_resp.status_code, data)
A successful call returns HTTP 200 OK with {"success": true, "host": "www.example.com", "platform": "web", "cd": "<x-kpsdk-cd header value, verbatim>"}. Copy the cd string verbatim into the x-kpsdk-cd header of your single outbound request.
What optional fields does CdRequest accept?
In addition to the required host and platform fields, POST /Solver/cd supports the following documented properties:
ct(optional string, minimum 16 characters)- The session's
x-kpsdk-cttoken. When provided, it must be at least 16 characters long or the server returns HTTP400 invalid_ct. pscript(optional string)- The target site's
/p.jssource text. Sendingpscriptrefreshes the server's per-host proof-of-work parameter cache without requiring the server to contact the target. standrst(optional integers)- Custom timing anchors. Must be sent together as a pair or omitted together so the API generates a coherent pair.
telemetryandseed(optional enums)telemetryacceptsreal(default),zeroed, orderived;seedacceptsauto(default),bare,ct, orct-lhw.kpsdkVersion(optional string)- The served
x-kpsdk-vstring; oniosit selects the appropriate timing band.
What error codes can POST /Solver/cd return and how should you handle them?
Each error string in CdResponse pinpoints whether the failure came from input validation, an unwarmed /p.js host cache, or key permissions.
Per RFC 9110 and the Catmouse OpenAPI specification, your client should branch on the HTTP status and error code:
400 Bad Request(invalid_host,invalid_platform,invalid_ct,invalid_st_rst,invalid_telemetry,invalid_seed): Fix the request schema before retrying. Ensureplatformisweborios,ctis at least 16 characters, andst/rstare either both present or both omitted.403 Forbidden(service_not_enabled): Thecdservice is not enabled on the calling API key.422 Unprocessable Content(pjs_host_unwarmed,pjs_pow_not_found,cd_platform_unproven,cd_shape_unproven): When a host is not pre-warmed on the server, pass the target's/p.jstext in thepscriptfield so the server can extract and cache the proof-of-work parameters.503 Service Unavailable(pjs_warming): The per-host parameter cache is currently warming; honor theRetry-After: 2response header before retrying.
Key takeaways
- Single-use only: Generate a fresh
x-kpsdk-cdviaPOST /Solver/cdright before each protected request; never reuse a header across two calls. - Keep timing coherent: Omit both
standrstto let the API generate a coherent pair at call time, or pass both integers together. - Supply
pscriptfor custom hosts: Pass the target's/p.jssource inpscriptwhen testing a host that is not pre-warmed (`pjs_host_unwarmed`). - Same USD balance:
POST /Solver/cduses thecdservice permission and is charged to the key's USD balance (balanceUsdinGET /Solver/getBalance) at the cd price.
Conclusion and scope
Calling POST /Solver/cd immediately before each protected action and pairing the returned cd string with your active session x-kpsdk-ct keeps proof-of-work timestamps aligned and avoids invalid_st_rst or replay rejections.
Scope and limitations. This guide documents the POST /Solver/cd (and /cd alias) contract in /openapi.json as of 2026-10-22. It makes no pass-rate, latency, or throughput claims, and targets can still reject requests for session, IP, or application-layer reasons. Use POST /Solver/cd only on systems you own or hold explicit written authorization to test.
Evidence and sources
All field definitions, enum values, and error codes in this article come from the primary references below:
- Catmouse OpenAPI 3.1 specification (
/openapi.json) and API reference (/reference.html#pow). Supports:POST /Solver/cd, the/cdalias, theCdRequestschema (host,platform,ct,pscript,st,rst,telemetry,seed,kpsdkVersion), theCdResponseerror codes, and the cd usage count inGET /Solver/getBalance. Reviewed 2026-10-22. - IETF RFC 9110 (HTTP Semantics) and IANA HTTP Status Code Registry. Supports: HTTP status codes
200,400,401,403,422, and503(includingRetry-After). - IETF RFC 6585 (Additional HTTP Status Codes). Supports: HTTP
429 Too Many Requests. - MDN Performance.now() and High Resolution Time documentation. Supports: how browser scripts measure monotonic elapsed time relative to a time origin.
Methodology and limits. Documented: the Catmouse CdRequest and CdResponse schemas and validation rules. Not claimed: vendor internal specifications or performance numbers. Reviewed 2026-10-22.
Frequently asked questions
Can I reuse the same x-kpsdk-cd header across multiple protected API requests?
No. Per the Catmouse OpenAPI specification (/openapi.json), x-kpsdk-cd is a single-use proof header. Reusing a value across two protected requests or generating it long before sending the request causes the target edge to reject the call.
What are st and rst in a POST /Solver/cd request?
st and rst are timing anchors associated with the session. In POST /Solver/cd, you must either send st and rst together or omit both so the API generates a coherent pair; sending only one returns HTTP 400 with error invalid_st_rst.
Where do the proof-of-work parameters for POST /Solver/cd come from?
They come either from the pscript field you supply in the request body (the target site's /p.js source) or from the per-host cache the Catmouse server keeps warm for operator-configured hosts. The server never makes outbound requests to your target.
What platforms are supported by POST /Solver/cd?
POST /Solver/cd accepts platform values of web or ios. Sending android returns HTTP 422 with error cd_platform_unproven, and any other string returns HTTP 400 with error invalid_platform.
How is POST /Solver/cd billed on a Catmouse API key?
POST /Solver/cd requires the cd service to be enabled on your key (otherwise it returns HTTP 403 service_not_enabled) and is charged to the key's USD balance at the cd price (the cd count is reported as cdUsageCount in GET /Solver/getBalance).