Send Request Context from Your Backend
The Opportify JS script describes the browser it runs in. Some signups never go through it: an OAuth callback, a plain email form, a server-rendered page, or a request from a script that skipped your page entirely. For those, your backend is the only place that saw the visitor's HTTP request.
The Request Context standard lets your backend forward that request to the Fraud Protection API as a few short strings. It is optional. If you send nothing, scoring is unchanged.
What to send
Add these keys to formData in the analyze request, together with the top-level userIp.
| Key | Value | Notes |
|---|---|---|
user_agent | The visitor's User-Agent header, unmodified | The visitor's, not your server's. Your HTTP client's own agent (axios/1.x, python-requests/2.x) is the wrong value. |
accept_language | The visitor's Accept-Language header | Stored with the analysis record. |
referer | The visitor's Referer, reduced to scheme, host and path | Remove the query string and fragment first. They can carry tokens or personal data. |
sec_ch_ua | The visitor's Sec-CH-UA header | Send it only when the header is present. Chromium browsers send it; Firefox and Safari do not. |
sec_ch_ua_platform | The visitor's Sec-CH-UA-Platform header | Send it only when present. |
sec_ch_ua_mobile | The visitor's Sec-CH-UA-Mobile header | Send it only when present. |
Rules that apply to every formData entry:
formDatais a flat map of strings. Numbers, booleans, arrays and nested objects return400 MALFORMED_REQUEST.- At most 20 keys. Keys up to 100 characters. Values up to 512 characters. Empty values are dropped.
- Send the IP in the top-level
userIpfield. Asource_ipkey insideformDatais not used for scoring.
POST https://api.opportify.ai/intel/v1/fraud/analyze
Content-Type: application/json
x-opportify-token: YOUR_API_KEY
{
"email": "jhon.doe@gmail.com",
"userIp": "203.0.113.42",
"submissionType": "signup",
"formData": {
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
"accept_language": "pt-BR,pt;q=0.9,en;q=0.8",
"referer": "https://www.example.com/signup",
"sec_ch_ua": "\"Chromium\";v=\"142\", \"Google Chrome\";v=\"142\", \"Not_A Brand\";v=\"99\"",
"sec_ch_ua_platform": "\"macOS\"",
"sec_ch_ua_mobile": "?0"
}
}
Examples
- Node.js (Express)
- PHP (Laravel)
- Python (Flask)
const analysis = await fraud.analyze({
email: req.body.email,
userIp: req.ip, // set "trust proxy" so this is the visitor, not your load balancer
submissionType: 'signup',
formData: {
user_agent: req.get('user-agent'),
accept_language: req.get('accept-language'),
referer: stripQuery(req.get('referer')),
sec_ch_ua: req.get('sec-ch-ua'),
sec_ch_ua_platform: req.get('sec-ch-ua-platform'),
sec_ch_ua_mobile: req.get('sec-ch-ua-mobile'),
},
});
$result = $client->analyze([
'email' => $email,
'userIp' => request()->ip(),
'submissionType' => 'signup',
'formData' => array_filter([
'user_agent' => request()->userAgent(),
'accept_language' => request()->headers->get('accept-language'),
'referer' => stripQuery(request()->headers->get('referer')),
'sec_ch_ua' => request()->headers->get('sec-ch-ua'),
'sec_ch_ua_platform' => request()->headers->get('sec-ch-ua-platform'),
'sec_ch_ua_mobile' => request()->headers->get('sec-ch-ua-mobile'),
]),
]);
result = client.analyze({
"email": email,
"userIp": request.remote_addr,
"submissionType": "signup",
"formData": {
k: v for k, v in {
"user_agent": request.headers.get("User-Agent"),
"accept_language": request.headers.get("Accept-Language"),
"referer": strip_query(request.headers.get("Referer")),
"sec_ch_ua": request.headers.get("Sec-CH-UA"),
"sec_ch_ua_platform": request.headers.get("Sec-CH-UA-Platform"),
"sec_ch_ua_mobile": request.headers.get("Sec-CH-UA-Mobile"),
}.items() if v
},
})
stripQuery and strip_query are your own helpers that keep only the scheme, host and path of a URL. Skip any header that is missing. Do not send empty strings or placeholders.
Behind a load balancer or CDN, your framework may report the proxy's address. Configure your framework's trusted-proxy setting so userIp is the visitor's address. Do not read X-Forwarded-For directly unless your proxy overwrites it, because visitors can set it themselves.
What Opportify does with it
| Signal | When it appears | Meaning |
|---|---|---|
request:tool-user-agent | user_agent names an HTTP library, command-line tool or headless automation tool | The request was likely made by a script, not a person in a browser. Native mobile app agents are not flagged. |
session:ua-mismatch | You also send the opportifyToken, and the browser family or operating system in user_agent differs from the one the JS script recorded | The request that reached your backend did not come from the browser that loaded your page. Small version differences are ignored. |
request:client-hints-mismatch | A sec_ch_ua* value contradicts user_agent: a different Chromium version, a different operating system, a mobile flag that disagrees, or sec_ch_ua sent with a Firefox or Safari agent | The request was probably built by a tool that set a browser user agent without matching hints. A missing hint never counts. |
How these signals behave:
- They add to the score, they do not decide it. A script-like agent on a clean address with a clean email stays in the middle of the range. The same agent together with another risk signal, such as a risky IP or a disposable email, raises the score further. You keep the decision.
- No context, no signal. Missing keys never count against a visitor.
- They can be spoofed. The values come from your server, and the visitor controls what the browser sends. Treat them as one input among several, not as proof.
accept_languageandrefererare stored with the analysis record. They do not change the score today.
These keys are not treated as form content, so a long user-agent string is never scored as gibberish.
Device and network fingerprints without the script
When a request has no opportifyToken, Opportify builds the same device, network and client fingerprints the JS script would have produced, from user_agent and userIp. A visitor already known to Opportify is then recognized even when your backend calls the API directly. If that fingerprint is on a blocklist, the response carries request:client-fingerprint-blocklisted and a high score. The fingerprints themselves are internal and are not returned in the response. Send user_agent and userIp together to get this.
The script observes behavior in the page: typing, pointer movement, timing, and automation tools. Request Context only carries what your server received. Use the script where you can, and Request Context where you cannot.
Next steps
- Analyze endpoint reference for the full request and response schema.
- Assessed Signals for the signal categories Opportify evaluates.
- Turn Fraud Signals into Helpful Guidance for acting on the response.