--- url: /deployment.md --- # Deployment xhr.dev ships as a single Docker image. It runs entirely inside your infrastructure — there is no call back to xhr.dev at runtime, and no traffic, proxy credentials, or target-site data ever leaves your environment. > **Multi-platform.** The image supports both ARM64 (Apple Silicon, ARM > Linux) and x86-64 hosts. Docker pulls the correct architecture > automatically. ## Prerequisites Onboarding gives you three things: 1. **An invite to a private GitHub organisation** — `xhrdev-`, created for you. Accept it before anything else; the image is published there and isn't public. 2. **`licence.json`** — your licence (customer ID, enabled features, validity window). 3. **`licence.sig`** — a cryptographic signature over the licence. The container verifies the licence pair **locally, at startup** — there is no network call to an xhr.dev licence server, and the runtime is not permitted to make one (see [Network posture](/on-prem#network-posture)). If the licence is missing, expired, or tampered with, the container exits immediately with `{"event":"launcher_failed"}` and a non-zero exit code. When your licence nears expiry, xhr.dev sends updated `licence.json` / `licence.sig` files — no image rebuild or redeploy of anything but those two files is needed. Don't have a licence yet? [Contact us](mailto:info@xhr.dev) or [book a call](https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ2uDlsqLG_VZLl3s3ri_-YIXD3xXi5WzY21o0dFuk6Gq4HhcXwJBxUz-1K6kMGxTEf4oIPny-nV). ## Pulling the image The image is **private**, published to your own organisation's GitHub Container Registry namespace. Accept the org invite first, then authenticate to `ghcr.io` with a GitHub personal access token that has the `read:packages` scope: ```bash echo "$GITHUB_TOKEN" | docker login ghcr.io -u --password-stdin docker pull ghcr.io/xhrdev-/xhrdev:latest ``` Substitute the namespace xhr.dev gave you — it's `xhrdev-` followed by your organisation name, and every example below uses `ghcr.io/xhrdev-/xhrdev:latest` for it. ::: warning `denied` / `manifest unknown` on pull Almost always one of three things, in this order: you haven't accepted the org invite; your token is missing `read:packages`; or you're pulling `ghcr.io/xhrdev/…` rather than your own `ghcr.io/xhrdev-/…` namespace. `docker login` succeeding proves the token is valid, not that it can see the package. ::: CI and orchestrators need the same credential. On Kubernetes that's an `imagePullSecret` of type `kubernetes.io/dockerconfigjson`; on ECS, a repository credential in Secrets Manager. ## Running ### Option A — volume mount (recommended) Create a directory containing both licence files: ``` licence/ ├── licence.json └── licence.sig ``` Then mount it into the container: ```bash docker run -d \ --name xhrdev \ --restart unless-stopped \ --cap-drop=ALL \ --security-opt no-new-privileges:true \ --read-only \ --tmpfs /tmp:rw,noexec,nosuid,nodev,size=64m \ --pids-limit 512 \ -p 3000:3000 \ -v ./licence:/run/licence:ro \ ghcr.io/xhrdev-/xhrdev:latest ``` The flags after `--restart` are containment rather than configuration — see [Run the container locked down](/on-prem#run-the-container-locked-down) for what each one buys you, and for the resource caps to size to your own host. The solver runs with or without them; we would rather you ran it with them. ### Option B — environment variables Useful for AWS Secrets Manager, Kubernetes Secrets, or any setup where a mounted volume is inconvenient: ```bash docker run -d \ --name xhrdev \ --restart unless-stopped \ --cap-drop=ALL \ --security-opt no-new-privileges:true \ --read-only \ --tmpfs /tmp:rw,noexec,nosuid,nodev,size=64m \ --pids-limit 512 \ -p 3000:3000 \ -e LICENCE_JSON_CONTENT="$(cat licence.json)" \ -e LICENCE_SIG_BASE64="$(base64 licence.sig)" \ ghcr.io/xhrdev-/xhrdev:latest ``` ### Option C — Docker Compose ```yaml services: xhrdev: image: ghcr.io/xhrdev-/xhrdev:latest restart: unless-stopped ports: - "3000:3000" volumes: - ./licence:/run/licence:ro cap_drop: - ALL security_opt: - no-new-privileges:true read_only: true tmpfs: - /tmp:rw,noexec,nosuid,nodev,size=64m pids_limit: 512 ``` ```bash docker compose up -d ``` ### Health check ```bash curl http://localhost:3000/hc # {"status":"ok"} ``` The image also declares a Docker-native `HEALTHCHECK` — `docker ps` shows `(healthy)` once the solver is ready to accept requests. ## Environment variables | Variable | Default | Description | |---|---|---| | `LICENCE_JSON_CONTENT` | — | Licence JSON inline (alternative to volume mount) | | `LICENCE_SIG_BASE64` | — | Licence signature, base64-encoded (alternative to volume mount) | | `TIME_SOURCE_PRIORITY`, `REQUIRE_TIME_SOURCE`, `ALLOW_SYSTEM_CLOCK_FALLBACK` | see below | ECS licence-expiry hardening — see [Production notes](#hardening-licence-expiry-checks-on-ecs) | The API itself requires no proxy configuration to be set at the container level — proxies are passed **per-request** (`proxy` / `proxy_url` fields in the [Akamai](/api-akamai) and [DataDome](/api-datadome) APIs), so different requests can use different upstream proxies against the same running container. ## Renewing a licence Licences have an expiry window. Before it lapses, xhr.dev sends you a new `licence.json` / `licence.sig` pair. Replace the files in your mounted `./licence` directory (or update the `LICENCE_JSON_CONTENT` / `LICENCE_SIG_BASE64` secret values) and restart the container — no image pull or rebuild required: ```bash docker restart xhrdev ``` ## How the image is licensed The solver logic ships protected, and unlocks only against a valid licence. What that means for running it: * **The check is local and offline.** Startup verifies the signature over your licence and its `issued_at` / `expires_at` window without contacting xhr.dev — there is no licence server, and the runtime isn't permitted to reach one (see [Network posture](/on-prem#network-posture)). * **It fails closed.** A missing, expired, or tampered licence exits immediately with `{"event":"launcher_failed"}` and a non-zero code, rather than starting in a degraded state. * **The image is the same for every customer.** Only the licence differs, which is why renewal is a file swap and a restart rather than a new pull. See [Security](/security) for the trust model. ## Production notes ### Hardening licence-expiry checks on ECS Licence expiry checks trust your container's clock by default. On AWS/ECS deployments, xhr.dev recommends pinning that check to ECS task metadata instead: ```bash -e TIME_SOURCE_PRIORITY=ecs \ -e REQUIRE_TIME_SOURCE=ecs \ -e ALLOW_SYSTEM_CLOCK_FALLBACK=false ``` If you're not on ECS, leave these unset — the defaults are appropriate for most deployments. [Contact us](mailto:info@xhr.dev) if you're deploying somewhere else and want an equivalent hardened setup. ### Licence delivery via secrets manager Set `LICENCE_JSON_CONTENT` and `LICENCE_SIG_BASE64`; the launcher falls back to the mounted file paths when those env vars are absent. --- --- url: /on-prem.md --- # On-prem xhr.dev is **on-prem only**. You run the solver as a container on your own infrastructure, and it talks directly to the target sites and proxies you configure — never through infrastructure xhr.dev operates. Your traffic, cookies, and target-site data stay inside your network. There was once a hosted proxy. There isn't now, and the only solver we run is the [trial box](#the-hosted-trial-box) we lend to prospects during an evaluation. ## Network posture The container is designed to run on a box with **no general internet access**. That isn't only a deployment recommendation — the application enforces it on itself. ### The runtime runs under a restrictive permission model The runtime starts under [Node's permission model][perm], and keeps only what a solve actually needs. Verifiably, in the shipped image, the process: * **cannot spawn a subprocess or a shell** — `child_process` fails with `ERR_ACCESS_DENIED`, * **cannot write to the filesystem at all**, and * **can read only its own unpacked payload** — not your filesystem, not your mounted secrets. Reading `/etc/passwd` fails with `ERR_ACCESS_DENIED`. Those permissions are granted at startup by the launcher and cannot be widened by anything that runs afterwards, including the challenge script. ::: warning What this does *not* constrain It does not restrict outbound network destinations, and we would rather say so than imply otherwise. The runtime is started with `--allow-net=0.0.0.0:3000`, which names the port it serves you on — but Node's `--allow-net` is a boolean and takes no address allowlist, so read that as intent rather than as enforcement. It is also one permission covering both listening and connecting: a process that serves you an API cannot give up outbound without giving up the ability to bind its own port. So the runtime either has network or it does not. What it actually *does* with it is narrower than that permission suggests. A DataDome solve makes no outbound request at all: `iframeData` is required because the container cannot fetch the challenge document itself (omitting it returns `400`), and a `proxy` in the body is accepted and ignored — an unroutable one returns the same prepared submission as none. The outbound path that does get used is Akamai's server-side solve, which fetches the sensor script from the target (it never submits the payload; you do that) — and which routes that through the `proxy` you name, defaulting to `127.0.0.1:8080` if you name none. So "it never phones home" is not something a runtime flag can prove to you. What can prove it is your own network, which is why the check below is behavioural rather than a config dump. Egress rules on the host, or an `--internal` docker network, are what actually bound where this process can reach — and unlike a flag, you control and can audit them. ::: ::: tip Verify it yourself, behaviourally Don't take our word for it, and don't settle for reading a config either — make the container prove it. Run it with egress restricted to your proxy and nothing else: ```bash # no default route to the internet; only your proxy is reachable docker network create --internal xhrdev-net docker run -d --name xhrdev --network xhrdev-net ... ghcr.io/xhrdev-/xhrdev:latest ``` Solves keep working. Then point a packet capture or your egress firewall logs at it for as long as you like: the only outbound flows are to the proxy you configured. That's a stronger artifact for a security review than any policy document or config dump, because it's an observed property of the running system rather than a claim about it. It's also the reason this passes review at shops that can't route traffic through a vendor's proxy at all. ::: [perm]: https://nodejs.org/api/permissions.html ### The sandbox has no network at all One layer further in: the anti-bot vendor's obfuscated challenge script is untrusted code, and it runs in a sandbox whose network surfaces are patched rather than real. `XMLHttpRequest`, WebRTC, and Workers are reimplemented and answered in-process, so the challenge script cannot open a socket even in principle — its "requests" never leave the process, let alone the box. ### What that means for your firewall Lock the box down. The container needs: | Direction | Destination | Why | |---|---|---| | inbound | port `3000`, from your scrapers only | the API | | outbound | your proxy | fetching the Akamai sensor script from the target | Nothing else — no DNS to xhr.dev, no registry access at runtime, no NTP dependency unless you've opted into [time-source hardening](/deployment#hardening-licence-expiry-checks-on-ecs). Egress restricted to your proxy pool is a supported, tested configuration. ::: warning The network is the only access control There is no per-request authentication and no API key — the licence gates startup, not requests. **Anything that can reach port 3000 can use the solver.** That's the trade for having no auth to misconfigure, and it means reachability is your whole access-control story. See [Security](/security). ::: ### Run the container locked down The runtime confines itself, but it runs on your infrastructure and the container boundary is yours. We ship and test against this flag set, and recommend you deploy with it: ```bash docker run -d \ --name xhrdev \ --restart unless-stopped \ --cap-drop=ALL \ --security-opt no-new-privileges:true \ --read-only \ --tmpfs /tmp:rw,noexec,nosuid,nodev,size=64m \ --pids-limit 512 \ --memory 6g \ --cpus 3 \ --dns 1.1.1.1 --dns 8.8.8.8 \ -p 3000:3000 \ -v ./licence:/run/licence:ro \ ghcr.io/xhrdev-/xhrdev:latest ``` | Flag | What it buys you | |---|---| | `--cap-drop=ALL` | Nothing here needs a Linux capability; it binds `:3000` as an unprivileged uid. | | `--security-opt no-new-privileges` | Closes the setuid route to more privilege. | | `--read-only` | The image filesystem cannot be modified, so nothing can be left behind that survives a restart. | | `--tmpfs /tmp` with `noexec,nosuid` | Provides the scratch space the runtime needs without allowing a binary to be staged in it. | | `--pids-limit`, `--memory`, `--cpus` | A runaway workload degrades this container rather than the host. Size to your box — `--cpus` must not exceed the cores actually available. | | `--dns` | Keeps the container off your VPC resolver, which on AWS, GCP and OCI often shares an address with the instance metadata service. | Two more worth doing at the network layer, which Docker flags can't express: * **Block egress to `169.254.169.254`.** On the major clouds that address serves instance credentials to anything that can reach it. If your resolver lives there too, allow UDP/TCP 53 and drop the rest. * **Stop the container connecting to the host itself** and to the rest of your private range. It only ever needs your proxy and your targets. None of this changes how the solver behaves — every gate in our release pipeline runs against a container started this way. ## Licence, not phone-home A signed licence file unlocks the container at startup: it verifies the Ed25519 signature over your licence and checks the `expires_at` deadline, entirely locally. There's no licence server to call, which is why the egress-restricted deployment above works at all: run it with no route to us and licensing still functions. If the licence is missing, expired, or tampered with, the container exits immediately with `{"event":"launcher_failed"}` and a non-zero code. It fails closed, not open. See [Deployment](/deployment) for delivery and renewal. ## What it solves * **Akamai Bot Manager** — sensor challenges (`_abck` / `bm-sz`) and SBSD. Direct HTTP solve, or a streaming WebSocket session for browser-automation setups. [API reference](/api-akamai) * **DataDome** — captcha and interstitial challenges, via a single-shot HTTP call. [API reference](/api-datadome) Don't see what you need? [Message us](mailto:info@xhr.dev). ## The hosted trial box The one exception to all of the above. During an evaluation we'll point you at a solver we run, so you can try the API before deploying anything. It sits behind a reverse proxy that requires an `x-api-key` header on `/akamai/*` and `/dd/*` (`/hc` stays open), and the key is issued with the trial and revoked when it ends. That key exists because the box is on the public internet. **It has no equivalent in a self-hosted deployment** — your own container has no API key and ignores the header. It's also the only configuration in which any of your traffic touches a machine we operate; the moment you deploy your own container, that stops. The [OpenAPI spec](/openapi.yml) carries both: the trial server with `ApiKeyAuth`, and your own container with no security requirement. ## Next * [Deployment](/deployment) — pulling the image and running it * [Security](/security) — the full trust model * [How to integrate](/integrate) --- --- url: /integrate.md --- # How to integrate Everything below talks to the container you're already running (see [Deployment](/deployment)). There's no SaaS endpoint and no account — requests go to your own host, e.g. `http://localhost:3000`. ## Pick a path There are really only two decisions: **do you need a browser**, and if so, **which one**. Pick on what the rest of your job needs, not on which sounds more robust. | | Cost | TLS fingerprint | Use when | |---|---|---|---| | [**Via the API**](/integrate-api) | ~4 HTTP requests | yours | you're in a language we don't ship an example for | | [**Via HTTP (Node, Python)**](/integrate-http-clients) | ~4 HTTP requests | yours | you just need the clearance cookie | | [**Via a browser (Playwright)**](/integrate-browser) | a full Chrome per session | Chrome's, genuinely | the site needs a browser anyway | | [**Via a browser (Lightpanda)**](/integrate-lightpanda) | a ~70MB binary per session | Chrome's, via a local proxy | you need a browser at volume | | [**Via Claude**](/integrate-claude) | — | — | you want an agent to write the integration | **If all you want is a cookie, don't use a browser.** The HTTP path is dramatically cheaper — four requests and a few hundred milliseconds — and it's what most integrations should take. Reach for a browser when you were going to drive one regardless: the site is a SPA, needs a login flow, or renders content you can't get from raw HTML. Between the two browsers, start with **Playwright and Chrome**. Lightpanda is the same shape at a fraction of the memory, but it needs a re-originating proxy in front of it and has several failure modes that don't look like themselves — [its page](/integrate-lightpanda) covers them. ## Calling the API Every approach is plain HTTP (plus a WebSocket, for Akamai in the browser flow) against your container: | Endpoint | What it does | |---|---| | `GET /hc` | Health check — `{"status":"ok"}` | | `GET /stats` | Solve counts and success rates, for your own monitoring | | `POST /dd/solve` | Solve a DataDome captcha or interstitial | | `POST /akamai/solve` | Solve an Akamai sensor challenge from a URL | | `WS /akamai/session` | Streaming Akamai session for browser-driven solving | | `POST /akamai/sbsd/generate-session` | Issue an SBSD ledger for one live document | | `POST /akamai/pixel/generate` | Produce the POST Akamai's pixel collector would send | | `POST /f5/solve` | Solve an F5/Shape challenge → attested headers for one request | Full contracts: [Akamai](/api-akamai) · [DataDome](/api-datadome) · [F5 / Shape](/api-f5) · [OpenAPI spec](/openapi.yml). See [Via the API](/integrate-api) for the raw request-by-request flow in curl. If you're in TypeScript, the [SDK](/sdk) gives you typed request and response shapes for these endpoints (types only — you still make the calls yourself). ### Authentication There is none, and there's no API key to obtain. The container is **licence-gated at startup, not per-request** — once it's running, anything that can reach port 3000 can use it. That's deliberate: the security boundary is the network, not a header. The container is designed to run on a box whose egress you've locked down (see [Network posture](/on-prem#network-posture)), reachable only from your own scrapers. Put it on a private subnet or behind firewall rules and you're done. ::: tip Why the examples send `x-api-key` Scripts in [xhrdev/examples](https://github.com/xhrdev/examples) thread an optional `solver_api_key` through as an `x-api-key` header. That's for the **hosted trial box** we lend to prospects during an evaluation, which sits behind a reverse proxy that checks the header. Your own deployment ignores it — leave `solver_api_key` unset and the examples send nothing. ::: ## Two rules that decide whether this works Almost every "the solve failed" report comes down to one of these. ### 1. Submit from the IP you'll browse from Anti-bot vendors bind the clearance cookie to whichever IP submitted it. If the solver submits on your behalf, you get a cookie that's valid *for the container* and void from your scraper — a fresh 403 on the very next request, which looks exactly like a failed solve. `/dd/solve` is built around this: it returns a prepared submission rather than sending one, so you make the request from the address you'll browse from. See [why you send the submission](/integrate-http-clients#why-you-send-the-submission). ### 2. Keep the identity consistent The `profile` / `js_profile` you send the solver has to match the headers you actually put on the wire — user agent, `sec-ch-ua`, platform, language, timezone. These get cross-checked. Changing a user agent in one place and not the other is the single most common way to get a solve rejected, and the error it produces looks nothing like the cause. ## Solving is not the same as staying unblocked Worth setting expectations: the solve can succeed and the site can still refuse you afterwards. Clearance cookies get you past the challenge; whether the site then honours the cookie depends on separate signals — chiefly your TLS fingerprint and IP reputation. If you're solving successfully but still getting blocked: * **Datacenter IPs** are frequently rejected regardless of a valid cookie. Try a residential pool. * **Non-browser TLS fingerprints** are visible to the site even when the cookie is good. This is a different problem from solving, and it's the main reason to use the [browser approach](/integrate-browser) despite the cost. ## Next * [Via the API](/integrate-api) — the raw endpoints, in curl * [Via HTTP (Node, Python)](/integrate-http-clients) — undici, axios, fetch, requests, httpx * [Via a browser (Playwright)](/integrate-browser) · [Via a browser (Lightpanda)](/integrate-lightpanda) * [Via Claude](/integrate-claude) — a prompt and a skill for agent-written integrations * [SDK](/sdk) --- --- url: /integrate-api.md --- # Via the API The lowest layer. Everything else on this site — the HTTP client examples, the Playwright bridge, the SDK — is a wrapper over the endpoints below. If you're integrating from a language we don't ship an example for, start here. There's no SaaS endpoint and no account. Requests go to the container you're running (see [Deployment](/deployment)), e.g. `http://localhost:3000`. ## The endpoints | Endpoint | What it does | |---|---| | `GET /hc` | Health check — `{"status":"ok"}` | | `GET /stats` | Solve counts and success rates, for your own monitoring | | `POST /dd/solve` | Solve a DataDome captcha or interstitial → a prepared submission | | `POST /akamai/solve` | Solve an Akamai sensor challenge from a URL | | `WS /akamai/session` | Streaming Akamai session for browser-driven solving | | `POST /f5/solve` | Solve an F5/Shape challenge → attested headers for one request | Full contracts: [Akamai](/api-akamai) · [DataDome](/api-datadome) · [F5 / Shape](/api-f5) · [OpenAPI spec](/openapi.yml) ([browse](https://docs.xhr.dev/api.html)). ## Authentication None. There's no API key, no token, and no account — the container is licence-gated at startup, not per-request, so anything that can reach port 3000 can use it. ```bash curl http://$host:3000/stats # that's the whole thing ``` The boundary is the network. Run it on a host whose egress you control and whose port 3000 only your own scrapers can reach — see [Network posture](/on-prem#network-posture). ::: tip Why the examples send `x-api-key` Scripts in [xhrdev/examples](https://github.com/xhrdev/examples) thread an optional `solver_api_key` through as an `x-api-key` header. That's for the **hosted trial box** we lend to prospects during an evaluation, which sits behind a reverse proxy that checks the header before forwarding. Nothing in the container itself reads it. Leave `solver_api_key` unset against your own deployment and the examples send nothing. ::: ## The DataDome flow in curl Four requests. Only step 3 touches your container; steps 1, 2 and 4 go to the target and to DataDome, through your proxy. ```bash target=https://www.seloger.com/ geo=https://geo.captcha-delivery.com proxy=http://user-sessid-42:pass@proxy.example.com:8000 # session-pinned # 1. Trip the challenge. DataDome answers 403 with an inline `var dd = {…}`. # It's single-quoted, so swap the quotes to make it JSON. curl -sx "$proxy" -H "user-agent: $ua" "$target" >blocked.html dd=$(sed -n "s/.*var dd=\({[^}]*}\).*/\1/p" blocked.html | tr "'" '"') [ -n "$dd" ] || { echo 'no challenge to solve'; exit 0; } # 2. Rebuild the URL DataDome's c.js would have requested, and fetch it. # `dd.cookie` — not `dd.cid` — is what goes in the `cid` parameter. doc_url=$(jq -rn --argjson dd "$dd" --arg geo "$geo" --arg ref "$target" ' ($dd.rt | if . == "c" then "/captcha/" else "/interstitial/" end) as $path | [ "initialCid=\($dd.cid|@uri)", "hash=\($dd.hsh|@uri)", "cid=\($dd.cookie|@uri)", "t=\($dd.t // "fe"|@uri)", "referer=\($ref|@uri)", "s=\($dd.s // 0)", (if $dd.e then "e=\($dd.e|@uri)" else empty end), "dm=cd" ] | $geo + $path + "?" + join("&")') curl -sx "$proxy" -H "referer: $target" -H 'sec-fetch-dest: iframe' \ "$doc_url" >document.html # 3. Ask the solver to build the submission. Direct — not through the proxy. # --rawfile keeps half a megabyte of HTML off the command line. jq -n --argjson dd "$dd" --arg url "$target" --arg docUrl "$doc_url" \ --arg proxy "$proxy" --rawfile html document.html \ '{ url: $url, proxy: $proxy, ddCookie: $dd.cookie, dd: { cid: $dd.cid, hsh: $dd.hsh, rt: $dd.rt, s: ($dd.s // 0) }, iframeData: { html: $html, url: $docUrl }, profile: { id: "chrome-149-macos", "…": "…" }, js_profile: { "…": "…" } }' \ >solve.json curl -s -X POST "http://$host:3000/dd/solve" \ -H 'content-type: application/json' \ ${solver_api_key:+-H "x-api-key: $solver_api_key"} \ --data-binary @solve.json >prepared.json # 4. Submit it YOURSELF, over the same pinned proxy session. # GET when `body` is absent (captcha), POST when present (interstitial). curl -sx "$proxy" \ -H "origin: $(jq -r .origin prepared.json)" \ -H "referer: $(jq -r .referer prepared.json)" \ -H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \ "$(jq -r .url prepared.json)" # {"cookie":"datadome=…; Max-Age=31536000; Domain=.seloger.com; …"} ``` The response is a full `Set-Cookie` string; split on `;` and keep the value. Then replay step 1 with `cookie: datadome=` and you get the real page. A complete, runnable version of exactly this — [`dev-resources/curl`](https://github.com/xhrdev/examples/blob/master/dev-resources/curl) — lives in the examples repo. It is the clearest place to see the raw HTTP. ::: warning curl's TLS fingerprint is not Chrome's This never stops the solve — the solver only ever sees the challenge you hand it — but it changes what the *site* is willing to give you afterwards. Sites vary: some serve curl the real page once it has a clearance cookie, some re-challenge it immediately, and some refuse before there's anything to solve (the challenge document comes back as a block page and the solver reports `IP is banned`). If a site rejects curl, that's the fingerprint talking, not the solver. Use a real client, or a curl build that impersonates Chrome. See [solving ≠ staying unblocked](/integrate#solving-is-not-the-same-as-staying-unblocked). ::: ## The Akamai flow in curl Akamai's `POST /akamai/solve` is one call — hand it a URL and a profile and it fetches the script and solves, returning the submission for you to send: ```bash curl -X POST "http://$host:3000/akamai/solve" \ -H 'content-type: application/json' \ -d '{ "url": "https://target.example.com/login", "proxy": "'"$proxy"'", "profile": { "id": "chrome-146-macos", "…": "…" }, "js_profile": { "…": "…" } }' ``` ```json { "success": true, "mode": "abck", "submission": { "method": "POST", "url": "…", "body": "…", "request_headers": { "…": "…" } }, "…": "…" } ``` The response is the built sensor submission, **not sent** — you make that request yourself from your own IP, the same property `/dd/solve` has. (The legacy `submit` field is ignored; the solver never submits.) The stateful [WebSocket session](/api-akamai-sensor#websocket-session) is the other option, and it's what you want when a real browser is driving. ## Backpressure Each container admits 8 concurrent solves with a queue depth of 32 and a 10s max queue wait. Past that, solves fail with `outcome_reason: "queue_full"` or `"queue_wait_timeout"` (both `500`). Treat either as the signal to scale out horizontally — run more containers behind a load balancer. ## Monitoring `GET /stats` reports counts and rates only — no URLs, payloads, or proxy details — so it's safe to scrape into your own monitoring: ```bash curl "http://$host:3000/stats" ``` ```json { "memory": { "heapTotal": 0, "heapUsed": 0, "rss": 0 }, "pid": 7, "solves": { "attempts": 210, "resolved": 205, "successful": 198, "failed": 7, "abandoned": 5, "successRate": 0.9658, "successPercent": 96.58, "failurePercent": 3.42, "abandonedPercent": 2.38, "bySolver": { "akamai": { "…": "…" }, "datadome": { "…": "…" } }, "byType": { "captcha": { "…": "…" }, "interstitial": { "…": "…" }, "sensor": { "…": "…" }, "capture": { "…": "…" } }, "byProfile": { "chrome-146-macos": { "…": "…" } } }, "ts": "2026-08-16T12:00:00.000Z", "uptimeSeconds": 86400 } ``` Two definitions worth knowing before you alert on this: * **`attempts` is everything; `resolved` is what the solver finished.** `abandoned` means the caller went away mid-solve — a disconnected socket or an expired idle session. * **The success rates are over `resolved`, not `attempts`.** A client that hangs up early therefore can't drag your success rate down and make a caller-side timeout look like a solver defect. `abandonedPercent` is the one rate computed over `attempts`. Rate fields are `null` until something has resolved. ## Generating a client The [OpenAPI spec](/openapi.yml) covers `/hc`, `/stats`, `/akamai/solve`, and `/dd/solve`, so any generator will give you a client in your language. The Akamai WebSocket session isn't in it — OpenAPI 3.0 can't express a WebSocket protocol — and is documented by hand in the [Akamai API reference](/api-akamai-sensor#websocket-session). ## Next * [Via HTTP (Node, Python)](/integrate-http-clients) — the same flow with a real client * [Akamai](/api-akamai) · [DataDome](/api-datadome) · [F5 / Shape](/api-f5) API reference * [SDK](/sdk) — typed request/response shapes for TypeScript --- --- url: /integrate-http-clients.md --- # Via HTTP (Node, Python) No browser. Your code makes the requests, hands the captured challenge to the solver, and sends the solved submission itself. This is the cheapest way to integrate and what most projects should use. Five interchangeable versions of the same flow, so you can copy whichever matches your stack — **undici**, **axios**, and Node's built-in **fetch** below, plus **requests**, **httpx**, and a standard-library-only **urllib** version [in Python](#other-languages). If your language isn't here, the raw HTTP is on [Via the API](/integrate-api). The examples below use **DataDome** and target grainger.com, mirroring the runnable versions in [xhrdev/examples](https://github.com/xhrdev/examples) (`src/datadome/`). ::: info Shared helpers in these snippets To keep the three client examples comparable, they call the same small helpers the examples repo factors into `src/datadome/http-utils.ts`: | Helper | What it does | |---|---| | `parseBlockPage(html)` | pulls the `var dd = {…}` literal out of a 403 body; returns `null` when you weren't challenged | | `challengeDocumentUrl(dd, targetUrl)` | builds the `geo.captcha-delivery.com` challenge document URL | | `solveRequestBody({…})` | assembles the `/dd/solve` payload shown below | | `readClearanceCookie(body)` | pulls the cookie value out of DataDome's `Set-Cookie` string | | `navigationHeaders()` / `documentHeaders()` / `submissionHeaders()` | the header sets for each request | | `PROFILE` | the browser identity, shared with the solve payload | None of them are library code — they're ~100 lines you'd write once and own. Copy them from the examples repo rather than retyping. ::: ## The flow Four requests, whichever client you use: ``` 1. GET https://www.grainger.com/ -> 403 + var dd={…} + datadome cookie 2. GET geo.captcha-delivery.com/captcha/… -> challenge document HTML 3. POST /dd/solve -> a prepared submission 4. GET geo.captcha-delivery.com/captcha/check? -> {"cookie":"datadome=…"} then: GET https://www.grainger.com/ + cookie -> 200, the real page ``` Step 3 is the only call to your container. Steps 1, 2 and 4 go to the target and to DataDome, through your proxy. ## Recognising a challenge A blocked response is a 403 whose body carries an inline `dd` object: ```html ``` Those fields are the challenge. `cookie` is the same value DataDome set in the `datadome` response cookie, and it's what you pass as `ddCookie`. `rt` tells you which type you got: | `rt` | type | how it's solved | |---|---|---| | `c` | **captcha** | a puzzle page — GET `/captcha/check` with the payload in the query string | | `i` | **interstitial** | a "verifying your browser" page — POST a payload | An interstitial often escalates to a captcha when DataDome is unconvinced. Handle both. ## Why you send the submission `/dd/solve` never submits for you. It returns a **prepared submission** — a request for you to make: ```json { "body": "", "origin": "https://geo.captcha-delivery.com", "referer": "", "url": "" } ``` Captcha solves carry their payload in the query string (send `GET`); interstitials post a body (send `POST`). Branch on whether `body` is present. ## The solve request New-style challenge documents load their logic from a separate script rather than inlining it, and the solver can't fetch that itself — you extract the ` ``` If you see an `/akam//` script, the property runs the pixel collector. It is independent of the other two channels and is commonly present alongside them. ## How it works Like [SBSD](/api-akamai-sbsd) and [DataDome](/api-datadome), this is a single request and a **browser bridge**: the solver computes the body, and your client sends it, on its own connection, through its own cookie jar. 1. Fetch the document and keep its HTML. 2. Fetch the collector script from the `src` the document names. 3. `POST /akamai/pixel/generate` with both. 4. Send the returned `request` — method, URL, body, `Content-Type` — through the same session that fetched the page. 5. Keep the `ak_bmsc` cookie the response sets, in that same jar. ::: warning The solver sends nothing There is no `proxy` field. The request is **not** sent to the origin from the container; it is returned to you. That is also why it has to travel through your own cookie jar: the cookie it earns belongs to your session. ::: ## `POST /akamai/pixel/generate` ### Request body ```json { "document": { "url": "https://www.example.com/checkout", "html": "", "cookieHeader": "ak_bmsc=…; bm_sz=…" }, "script": { "url": "https://www.example.com/akam/13/6f2b9c1d", "source": "" }, "profile": { "id": "chrome-151-macos" } } ``` | Field | Type | Notes | |---|---|---| | `document.url` | string | The document's URL. Absolute `https`. Max 8 KiB. | | `document.html` | string | The document as served. Max 8 MiB. | | `document.cookieHeader` | string | Optional. `document.cookie` — the JavaScript-visible jar, not the HTTP header. Max 64 KiB. | | `script.url` | string | The collector's **absolute** URL, as the document names it. Absolute `https`, **on the document's own origin**. | | `script.source` | string | The collector as served. Max 2 MiB. | | `profile.id` | string | `chrome--`, registered on the container. | | `seed` | string | Optional. Max 256 bytes. Send the same value across requests that describe one device. | `script.url` has to be a script the document actually loads. A document with no `