ThreatMetrix
Profile the device against the merchant's session. Read the merchant's profiling script configuration and reuse the exact transaction session ID that its risk query will reference.
{
"clientKey": "capzy_YOUR_API_KEY",
"task": {
"type": "ThreatMetrixTask",
"target_url": "https://www.kleinanzeigen.de/m-einloggen.html",
"org_id": "181rzcrc",
"page_id": "94",
"session_id": "3029471b-4b25-41cd-8d78-46598448325e",
"custom_domain": "dfme.kleinanzeigen.de",
"proxyType": "http",
"proxyAddress": "ip",
"proxyPort": "port",
"proxyLogin": "username",
"proxyPassword": "password"
}
}Illustrative values. Replace the inputs with values from your current integration.
Read the profiling request.
Read the merchant's profiling script configuration and reuse the exact transaction session ID that its risk query will reference.
Your API key authenticates Capzy.
Provider keys, challenge IDs, images, and session values belong inside task.
Read org_id, page_id, and custom_domain.
- In Network, locate the merchant's ThreatMetrix tags.js profiling request.
- Copy org_id and pageid from the profiling query. Put the pageid value into task.page_id, preserving both values as strings. Copy the request's host into custom_domain.
- Use the full page that loads profiling as target_url. Keep a supplied User-Agent consistent with the transaction request.
https://YOUR_PROFILING_HOST/fp/tags.js?org_id=YOUR_ORG&pageid=YOUR_PAGE&session_id=YOUR_TRANSACTION_IDThe illustrated URL shows where values live. Use the merchant's actual host/path and query values.
How ThreatMetrix works
ThreatMetrix (LexisNexis Risk Solutions) is a fraud-prevention SDK used by banks and e-commerce sites. It fingerprints the device and browser during login or checkout, producing a risk score the merchant checks server-side. Our solver profiles the device against your session_id so ThreatMetrix recognises it as a genuine, profiled device.
Send the merchant's target_url, org_id, page_id, custom_domain, and exact transaction session_id with your session proxy. We profile that transaction through the proxy and return session_id, the thx_guid/tmx_guid cookies, and the profiling userAgent. Keep the same proxy, cookies, and identity for the protected transaction and use that session_id in the merchant's existing risk query.
- Fast profiling — a solve typically completes in a couple of seconds
- Profiling egresses through your proxy so the device IP matches your follow-up request
- Returns the thx_guid + tmx_guid device cookies ready to replay
- Works on any ThreatMetrix-protected login, checkout, or account flow
Know what goes in.
Choose a field to see its purpose, where to get it, and its place in the request. Optional values omitted from the example can be added when your flow uses them.
Keep your proxy exit and session identity consistent when using this result.
Request authentication
Required task inputs
Optional context
Proxy connection
target_url
stringRequiredFull URL of the page that loads ThreatMetrix (e.g. the login or checkout page).
Copy the full URL of the page loading this integration from the address bar or your client request.
Open the input guidehttps://www.kleinanzeigen.de/m-einloggen.html{
"clientKey": "capzy_YOUR_API_KEY",
"task": {
"type": "ThreatMetrixTask",
"target_url": "https://www.kleinanzeigen.de/m-einloggen.html",
"org_id": "181rzcrc",
"page_id": "94",
"session_id": "3029471b-4b25-41cd-8d78-46598448325e",
"custom_domain": "dfme.kleinanzeigen.de",
"proxyType": "http",
"proxyAddress": "ip",
"proxyPort": "port",
"proxyLogin": "username",
"proxyPassword": "password"
}
}The selected field is highlighted when present. Preserve the declared value type and current challenge context.
Make your first request.
Create the task, keep its taskId, and poll until status is ready. Then read the selected variant's solution.
- Create the task
Send
clientKeyand the selectedtaskto/createTaskfrom your server. Keep the returnedtaskId. - Wait for the solution
Send that same key and ID to
/getTaskResult. While processing, wait two seconds before checking again. Stop on Ready or an error. - Apply the result
Preserve the returned profiling session_id, cookie/device context, and User-Agent for the merchant transaction. Use that same session ID in the existing risk query rather than submitting a generic CAPTCHA token.
import json, os, time
import requests
API = "https://api.capzy.ai"
KEY = os.environ["CAPZY_API_KEY"]
task = json.loads("{\"type\":\"ThreatMetrixTask\",\"target_url\":\"https://www.kleinanzeigen.de/m-einloggen.html\",\"org_id\":\"181rzcrc\",\"page_id\":\"94\",\"session_id\":\"3029471b-4b25-41cd-8d78-46598448325e\",\"custom_domain\":\"dfme.kleinanzeigen.de\",\"proxyType\":\"http\",\"proxyAddress\":\"ip\",\"proxyPort\":\"port\",\"proxyLogin\":\"username\",\"proxyPassword\":\"password\"}")
def call(path, payload):
response = requests.post(f"{API}/{path}", json={"clientKey": KEY, **payload}, timeout=30)
response.raise_for_status()
data = response.json()
if data.get("errorId", 0) or data.get("status") == "failed":
raise RuntimeError(data.get("errorDescription") or data.get("errorCode") or "Task failed")
return data
created = call("createTask", {"task": task})
for attempt in range(60):
result = call("getTaskResult", {"taskId": created["taskId"]})
if result.get("status") == "ready":
solution = result["solution"]
print(solution)
break
time.sleep(2)
else:
raise TimeoutError("Task is still processing; keep the taskId to check it later.")
Before runningReplace all illustrative inputs with your captured values. Set CAPZY_API_KEY in your environment. Install requests with pip install requests.
Polling and failuresThe example checks HTTP/API failures, uses 30-second request timeouts, and stops after 60 result checks. Retain taskId if your task is still processing.
Understand what comes back.
Follow this task from creation to completion. Response fields and usage follow your selected request variant.
Device cookies + matching session ID
Preserve the returned profiling session_id, cookie/device context, and User-Agent for the merchant transaction. Use that same session ID in the existing risk query rather than submitting a generic CAPTCHA token.
- string
- Echo of the session_id you submitted, confirmed as profiled. Use this in your ThreatMetrix server-side API query.
- object
- The ThreatMetrix device-identity cookies { thx_guid, tmx_guid }. Send both on your follow-up request.
- string
- The User-Agent used during profiling. Set this on your subsequent request for fingerprint coherence.
{
"errorId": 0,
"status": "ready",
"solution": {
"session_id": "3029471b-4b25-41cd-8d78-46598448325e",
"cookies": {
"thx_guid": "YOUR_THX_GUID",
"tmx_guid": "YOUR_TMX_GUID"
},
"userAgent": "YOUR_PROFILING_USER_AGENT"
}
}Illustrative values. Additional metadata may be returned; only Ready contains a completed solution.
Continue the same profiled transaction
Carry thx_guid and tmx_guid, the returned userAgent, and the same solving proxy into the original merchant transaction. Its backend risk query must use solution.session_id, equal to the task's ID. Match the merchant's actual field/header names; profiling does not return a generic CAPTCHA token or a risk decision.
Execution context result is the parsed Ready response from the polling example. session, when referenced, is your existing requests.Session (or browser-compatible session) with the original cookie jar, headers, and solving proxy configured in session.proxies for both http and https. Keep this client for the complete flow. task is the task object you submitted. For Shape, action_body is the original protected request body as bytes or a string, with its original Content-Type in session.headers. Install curl_cffi when the fragment imports it; match the target's required browser/TLS identity.
sol = result["solution"]
if sol["session_id"] != task["session_id"]:
raise RuntimeError("Profiling belongs to a different transaction")
from urllib.parse import urlsplit
for name, value in sol["cookies"].items():
session.cookies.set(name, value, domain=urlsplit(task["target_url"]).hostname, path="/")
session.headers["User-Agent"] = sol["userAgent"]
# Use the original merchant action and its actual session-ID field name.
response = session.post("https://target.example.com/checkout",
json={"session_id": sol["session_id"], "orderId": "YOUR_ORDER_ID"}, timeout=30)
# The merchant's backend risk query must reference this same session_id.When something doesn't work.
Check your captured values, the selected variant, and the response before starting another task.
Where do I find org_id, page_id, and custom_domain?
Inspect the target page source or the Network tab. Look for a script tag with src containing /fp/tags.js — copy org_id and map the pageid query value to task.page_id; the hostname is the custom_domain (e.g. dfme.kleinanzeigen.de).
What session_id should I use?
Generate a random UUID (v4) yourself before submitting the task. This is the same ID you will use when calling ThreatMetrix's server-side API (e.g. TransactionQuery). Our solver binds the device fingerprint to it so ThreatMetrix recognises it as a profiled session.
Do I need to send the returned cookies?
Yes. Send both thx_guid and tmx_guid from the solution on your follow-up request — they are the device-identity cookies ThreatMetrix cross-references with the profiled session.
Why is proxy required?
ThreatMetrix's risk score includes the egress IP reputation. Our solver profiles through your proxy exit IP, so it must match the IP you use on the follow-up request — a residential IP produces a much lower risk score than a datacenter range.
Can I reuse a session_id?
No. Each session_id should be profiled exactly once and used immediately. ThreatMetrix is stateful: a second profiling run on the same ID may update or invalidate the earlier fingerprint.
Integration checks for ThreatMetrix
- proxy is required for all ThreatMetrix solves — the IP reputation is part of the fingerprint, and it must match the IP on your follow-up request.
- Send both returned cookies (thx_guid + tmx_guid) on your follow-up request. A missing ThreatMetrix cookie can trigger a challenge or deny outcome even on a clean residential IP.
Connect ThreatMetrix to your workflow.
Get your Capzy API key and use this guide's integration.
ThreatMetrixTask · Live configuration