Skip to main content
kasadacurl-cffitls-clientapi8 min readBy Catmouse Engineering

Integrating Kasada Solver APIs with curl_cffi and tls-client

Last reviewed
Short answer

Pairing the Catmouse HTTP solver (POST /Solver/solve) with a browser-impersonating transport library such as Python curl_cffi or Go tls-client keeps your TLS JA4, HTTP/2 SETTINGS, cookie jar, and sticky proxy exit IP coherent across the entire challenge lifecycle. Below: how to structure the session pool and manage your universal USD wallet balance.

Who this is for

Backend and automation engineers building high-concurrency Python, Go, or Node.js HTTP pipelines who want to integrate the Catmouse solver and universal USD wallet without running headless browsers.

On this page
  1. Why do curl_cffi and tls-client matter when using an HTTP solver?
  2. What is the four-step session flow for solving Kasada over HTTP?
  3. How do you wire SolveRequest in Python?
  4. How do you monitor your universal USD wallet and charge leases?
  5. Key takeaways
  6. Conclusion and scope
  7. Evidence and sources
  8. Frequently asked questions

Why do curl_cffi and tls-client matter when using an HTTP solver?

Transport impersonation is a technique that aligns the client TLS handshake and HTTP/2 framing with the browser profile inside the solved telemetry payload.

When you send a fetched ips.js script to the solver endpoint, the backend evaluates the virtualized bytecode under a trusted device profile selected by the engine field (chrome, wkw, snkrs, fl, whatnot-ios, or android). However, your own HTTP client is responsible for fetching ips.js, posting the returned /tl body to the target origin, and sending subsequent API requests. Using a transport library that impersonates the matching TLS and HTTP/2 stack prevents transport-to-payload mismatches (RFC 9113):

curl_cffi (Python binding for curl-impersonate)
The curl_cffi library is a Python wrapper that configures BoringSSL cipher suites, ALPN extension order, HTTP/2 SETTINGS frames, and pseudo-header order (:method, :authority, :scheme, :path) to match Chromium or Safari builds.
tls-client (Go / Node.js uTLS wrapper)
The tls-client package is a programmable transport client that exposes custom TLS ClientHello specs and persistent connection pools per sticky proxy session so ips.js, /tl, and protected POSTs reuse the same H2 connection.
Direct solver connection versus proxied target connection
Always call https://kasadaapi.catmouse.ai directly from your worker without a proxy to minimize round-trip overhead, while in contrast routing all requests to the target origin through a pinned sticky residential proxy exit.

What is the four-step session flow for solving Kasada over HTTP?

A complete session fetches the challenge script over a sticky proxy, calls the solve endpoint, submits telemetry to capture a session token, and mints proof-of-work values.

Comparing direct solver calls versus proxied target requests

The table below compares each step of the HTTP integration across destination host, proxy requirement, and key inputs:

Table 1. Four-step HTTP integration flow for Kasada solver sessions
StepTarget DestinationProxy RoutingKey Inputs & Outputs
1. Fetch challenge scriptTarget origin GET /<path>/ips.jsSticky residential proxy exitCaptures UTF-8 ipsBody and initial cookies (KP_UIDz)
2. Solve telemetryCatmouse SolveRequest endpointDirect (no proxy)Sends ipsUrl, ipsBody, tz, tzOffset, engine; returns payload
3. Submit /tlTarget origin POST /<path>/tlSame sticky proxy & H2 sessionSends decoded payload; captures refreshed x-kpsdk-ct token
4. Mint x-kpsdk-cdCatmouse CdRequest endpointDirect (no proxy)Sends host, platform, ct (and optional pscript); returns fresh x-kpsdk-cd
Four-part diagram of integrating Catmouse solver APIs with curl_cffi and tls-client: 1. Pinned TLS and proxy session fetches ips.js and /p.js from the target host. 2. Direct call to the solver aligns tz, tzOffset, and userAgent and returns the /tl payload and x-kpsdk values. 3. Origin /tl POST and API calls reuse the same sticky proxy IP and cookie jar. 4. Session coherence and universal USD wallet balance checks.
Figure 1. End-to-end session architecture pairing a pinned curl_cffi or tls-client proxy session with the Catmouse HTTP solver. Diagram by Catmouse Engineering.

How do you wire SolveRequest in Python?

Send the fetched script body and proxy timezone to the solve endpoint, then decode the returned payload into raw bytes before posting to the target telemetry path.

Constructing the SolveRequest JSON payload and decoding base64 bytes

The Python example below uses the exact field names defined in the Catmouse OpenAPI 3.1 specification (/openapi.json) to solve an ips.js challenge:

import os
import requests

solve_res = requests.post(
    "https://kasadaapi.catmouse.ai/Solver/solve",
    headers={"x-api-key": os.environ["CATMOUSE_KEY"]},
    json={
        "ipsUrl": "https://www.example.com/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/ips.js",
        "ipsBody": "<UTF-8 source of ips.js fetched from target>",
        "tz": "America/Chicago",
        "tzOffset": 360,
        "engine": "chrome",
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36",
    },
    timeout=25,
)
print(solve_res.status_code, solve_res.text)

How do you monitor your universal USD wallet and charge leases?

Query your wallet balance endpoint to inspect your spendable USD balance, micro-USD accounting, and the per-service prices.

Every newly provisioned wallet key operates on a unified micro-USD balance rather than isolated solve counters. Your workers can check remaining capacity before launching a batch job and rely on the trusted two-phase reserve/commit/refund charge model so failed upstream requests never spend wallet funds.

Key takeaways

  • Keep target traffic on one sticky proxy session: Fetch ips.js, POST /tl, and call protected endpoints over the same proxy exit IP and HTTP/2 connection.
  • Call kasadaapi.catmouse.ai directly: Do not route solver API requests through your residential proxy pool.
  • Check SolveResponse.encoding: Base64-decode payload into raw bytes when encoding is "base64" before posting to /tl.
  • Monitor spend via your USD wallet fields: Read balanceUsd and balanceMicroUsd to trigger automated crypto top-ups before a batch exhausts its balance.

Conclusion and scope

Combining a browser-grade TLS/HTTP2 client with the Catmouse HTTP solver gives your workers deterministic control over every cookie and timezone parameter without the memory overhead of headless browser instances.

Scope and limitations. All request and response schemas (SolveRequest, SolveResponse, CdRequest, CdResponse) are verified against the Catmouse OpenAPI 3.1 specification (/openapi.json) as of 2026-11-03. Use these techniques only on systems you own or have explicit written authorization to test.

Evidence and sources

The API contracts and transport specifications referenced in this guide are backed by the primary sources below:

Methodology and limits. Code samples are validated against tools/validate-samples.mjs and /openapi.json. No throughput or pass-rate benchmarks are claimed. Reviewed 2026-11-03.

Frequently asked questions

Why should you use curl_cffi or tls-client when calling a Kasada-protected origin?

Default language HTTP libraries emit distinct TLS JA4 and HTTP/2 SETTINGS fingerprints. Browser-impersonating libraries like curl_cffi and tls-client align the transport fingerprint with the User-Agent and engine profile solved by the Catmouse solve endpoint.

Should the Catmouse API call itself go through your residential proxy?

No. Call https://kasadaapi.catmouse.ai directly from your server over a fast connection, and use your sticky residential proxy session only for traffic to the target origin (fetching ips.js, posting /tl, and calling protected APIs).

How do you decode and send the /tl payload returned by the solve endpoint?

When SolveResponse.encoding is "base64" (for example on chrome), base64-decode the payload string into raw bytes and POST it to the target's /tl endpoint with Content-Type: application/octet-stream alongside the returned x-kpsdk-ct, x-kpsdk-dt, and x-kpsdk-v response fields.

How do you check your universal USD wallet balance from Python or Go?

Query the Catmouse balance endpoint with your x-api-key credential to read balanceUsd, balanceMicroUsd and unlimited.

What should your client do if the target returns HTTP 429 on a protected request?

Inspect the 429 response body or response fields for a fresh ips.js script URL, fetch the new ips.js over the same sticky proxy session, solve it via the solve endpoint, POST the new /tl payload, and retry the request with a fresh x-kpsdk-cd value.