- About the IPQS APIs
- Proxy & VPN Detection API
- Email Verification API
- Phone Number Validation API
- Malicious URL Scanner API
- Device Fingerprint API
- Mobile Device Fingerprinting SDK
- Gaming Fraud Detection SDK
- Dark Web Leak API
- Malware File Scanner API
- Request List API
- Fraud Reporting API
- Account Management APIs
- Bulk Validation CSV
- Allowlist Blocklist APIs
- Plugins Platforms Integrations
- IP Reputation Database
- IP Address Abuse Feed
- Email Verification Database
-
Custom Integrations
- Getting Started
- Authentication
- Refresh Secret
- IP & Proxy Checks
- Email Verification Checks
- Phone Number Validity Checks
- Device Tracker
- List Device Trackers
- Device Tracker Statistics
- Login Tokens
- Overview Statistics
- Recent Proxy Statistics
- Recent Email Statistics
- Fraud Reporting
- Retrieve Requests by ID
- Country List API Documentation
- Release Notes
How to Verify Results
As security best practice, you should not trust any information in the client-side browser. To ensure that the user hasn't tampered with the results after passing through a JavaScript redirect. We offer a simple API that can retrieve the results server-side. Requests to this API and all reporting APIs will not consume an API lookup credit.
You'll need to use the Fetching Results code from the Device Fingerprint API documentation. This involves passing the device ID to your server via Ajax or appending the value to a hidden form element. Once you've successfully made the "Fetching Results" request, you can proceed to make a GET/POST request to the URL below. Replace "USER_IP_HERE" and "DEVICE_ID_HERE" with their respective values.
https://www.ipqualityscore.com/api/tracker/results/YOUR_API_KEY_HERE/USER_IP_HERE/DEVICE_ID_HERE
<?php
// Get the end user's IP.
$user_ip = $_SERVER['REMOTE_ADDR']; // $_SERVER['HTTP_CF_CONNECTING_IP'] if using cloudflare.
// Get the device ID from our device tracker request.
$device_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
// Generate our URL.
$url = sprintf('https://www.ipqualityscore.com/api/tracker/results/%s/%s/%s', $api_key, $user_ip, $device_id);
// Get JSON result.
$json = file_get_contents($url);
// Decode the result
$result = json_decode($json, true);
if(isset($result['success']) && $result['success'] === true){
if(isset($result['id'])){
if($device_id === $result['id']){
// Request was valid. You can also use $request['fraud_chance'] here.
}
}
} else {
// Something went wrong.
}
# THIS SHOULD NEVER BE USED IN PRODUCTION AS IS!
# You may need to install Requests pip
# python -m pip install requests
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import requests
hostName = "localhost"
serverPort = 8080
class IPQS:
key = "YOUR_API_KEY_HERE"
def device_fingerprint_verification(self, userIP: str, deviceID: str) -> dict:
url = "https://www.ipqualityscore.com/api/tracker/results/%s/%s/%s" % (self.key)
x = requests.get(url)
return (json.loads(x.text))
class MyServer(BaseHTTPRequestHandler):
"""This is an example basic web server. we limited it to handle "/" path only."""
def do_GET(self):
if self.path == "/":
ipqs = IPQS()
print(ipqs.device_fingerprint_verification(self.client_address[0], "request_id"))
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes("<body>", "utf-8"))
if __name__ == "__main__":
webServer = HTTPServer((hostName, serverPort), MyServer)
print("Server started http://%s:%s" % (hostName, serverPort))
try:
webServer.serve_forever()
except KeyboardInterrupt:
pass
webServer.server_close()
print("Server stopped.")