Skip to main content
kasadaproof-of-workapi8 min readBy Catmouse Engineering

Kasada x-kpsdk-cd Single-Use Headers, st/rst Timestamps, and Clock Skew

Last reviewed
Short answer

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
  1. How does x-kpsdk-cd differ from the session x-kpsdk-ct header?
  2. Why do pre-computed x-kpsdk-cd queues and clock skew cause rejections?
  3. How do you call POST /Solver/cd right before a protected request?
  4. What error codes can POST /Solver/cd return and how should you handle them?
  5. Key takeaways
  6. Conclusion and scope
  7. Evidence and sources
  8. 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:

Table 1. Lifecycle comparison between x-kpsdk-ct and x-kpsdk-cd headers
Dimensionx-kpsdk-ct (Client token)x-kpsdk-cd (Challenge data proof)
How it is obtainedReturned by the target on /fp and refreshed on /tlComputed by the client script or via POST /Solver/cd
Reuse policyCarried across protected calls within the active sessionSingle-use; generate one immediately before each protected call
Input dependenciesIssued after POST /Solver/solve + /tl acceptanceDepends on host, platform, session ct, /p.js, and st/rst
Catmouse endpointPOST /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 st and rst as integers. Sending one without the other is rejected immediately with HTTP 400 (invalid_st_rst).
  • Generate just-in-time: When you omit st and rst, POST /Solver/cd generates a coherent pair at call time. Because the proof is anchored to that timestamp, your client should attach the returned cd string and dispatch the outbound HTTP request immediately rather than stockpiling proofs in a worker pool.
Three-stage lifecycle for single-use x-kpsdk-cd headers: 1. Target /tl response returns x-kpsdk-ct and x-kpsdk-r timing anchors, while /p.js supplies per-host proof-of-work parameters. 2. Client calls POST /Solver/cd right before a protected action with host, platform, and ct. 3. Client attaches the returned cd value as x-kpsdk-cd once only on the protected API request.
Figure 1. Just-in-time 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-ct token. When provided, it must be at least 16 characters long or the server returns HTTP 400 invalid_ct.
pscript (optional string)
The target site's /p.js source text. Sending pscript refreshes the server's per-host proof-of-work parameter cache without requiring the server to contact the target.
st and rst (optional integers)
Custom timing anchors. Must be sent together as a pair or omitted together so the API generates a coherent pair.
telemetry and seed (optional enums)
telemetry accepts real (default), zeroed, or derived; seed accepts auto (default), bare, ct, or ct-lhw.
kpsdkVersion (optional string)
The served x-kpsdk-v string; on ios it 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. Ensure platform is web or ios, ct is at least 16 characters, and st/rst are either both present or both omitted.
  • 403 Forbidden (service_not_enabled): The cd service 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.js text in the pscript field 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 the Retry-After: 2 response header before retrying.

Key takeaways

  • Single-use only: Generate a fresh x-kpsdk-cd via POST /Solver/cd right before each protected request; never reuse a header across two calls.
  • Keep timing coherent: Omit both st and rst to let the API generate a coherent pair at call time, or pass both integers together.
  • Supply pscript for custom hosts: Pass the target's /p.js source in pscript when testing a host that is not pre-warmed (`pjs_host_unwarmed`).
  • Same USD balance: POST /Solver/cd uses the cd service permission and is charged to the key's USD balance (balanceUsd in GET /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:

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).