Geofence API
Our standalone Geofence API is designed to work seamlessly with our device intelligence SDKs, providing detailed analysis of a device's geolocation relative to predefined geofences. It ensures accurate validation of device data, delivering reliable location information that meets compliance standards. The API offers insights into the device's location behavior, allowing businesses to better understand and manage geofence interactions for enhanced security and operational efficiency.
Good to know
- To use the Geofence API the integration of the latest Device Intelligence SDKs is required.
- Minimum SDK level is required for Geofence API compliance
- JavaScript 6.4.0 or v6-latest
- Android 6.6.0+
- iOS SDK 5.5.0+
- The SDK integration of Behavior Signals for fingerprint generation is required for more precise RAT detection on desktop environments.
- Collecting consent and necessary permissions from the user for location tracking is required.
- The SDK indicates if it encountered an error in the collection of permissions, behavior data or location. In the case of these errors, it is necessary to handle them in the customer integration and submit the request only in case of successful session generation.
- Geofence API is a standalone API but it could be connected with Fraud API transactions using the same user ID. In this case the connected transaction will be displayed on the Admin Panel.
- For geolocation data our standard 1 year data retention policy is applied. If you need a longer storage time, please contact support@seon.io.
Request
Request Attributes | Type | Required | |
---|---|---|---|
user_id | string | yes | |
device_ip | string | yes | |
geofence_id | string | yes | |
bet_id | string | no | |
session | string | yes | |
HTTP Endpoint
Response
The endpoint returns JSON structured response.
JSON Attributes | Type | |
---|---|---|
allow | boolean | |
request_id | string | |
integrity | object | |
location | object | |
Response
Integrating Device Intelligence SDKs
Integrating the device fingerprinting module can be done on web and mobile platforms. For web applications, use the JavaScript agent through a CDN-hosted script to ensure the latest version is loaded.
For web, iOS and Android SDKs are available on GitHub, where you can find documentation, integration requirements, and code samples. All SDKs gather detailed data on the user’s hardware and software configurations, helping to ensure comprehensive device profiling and security across different platforms.
It is important to note that geolocation checks are not performed periodically by default. The responsibility lies with the customer to determine when a user should undergo geolocation validation based on their specific requirements or use cases.
Do you have any questions?
Recommended configuration for Geofence API
To trigger a geofencing check, call the Geofence API using the configuration shown below, ensuring all key identifiers are correctly passed. This setup links the user, device, and session details, with optional bet tracking, to apply geolocation rules — currently tailored for Brazil.
User ID: Associate the current user with a UNIQUE ID. Max length is 64 characters
Device IP: Get the user's device IP address and pass it on
Geofence ID: For specific geofencing rules, currently Brazil
Bet ID: The ID of the current (gaming) session, not required. Max length is 64 characters
Session: Device Intelligence session, collected with `seon.getSession()
{
"user_id": USER_ID,
"device_ip": DEVICE_IP,
"geofence_id": "BR",
"bet_id": CUSTOM_BET_ID,
"session": SDK_SESSION
}
// User ID: Associate the current user with a UNIQUE ID. Max length is 64 characters
// Device IP: Get the user's device IP address and pass it on
// Geofence ID: For specific geofencing rules, currently Brazil
// Bet ID: The ID of the current (gaming) session, not required. Max length is 64 characters
// Session: Device Intelligence session, collected with `seon.getSession()
Recommended configuration for Web SDK
To optimize geofencing performance with SEON’s Web SDK (v6), it’s recommended to enable geolocation with high accuracy and a slightly shorter interval than industry norms for better responsiveness. The configuration below outlines key settings, including adjustable timeouts, to ensure consistent and precise location tracking.
For behavioural data collection, call `seon.init()` and let it run as long as possible before calling `getSession`.
Find more information on GitHub: https://github.com/seontechnologies/seon-web-sdk-public
seon.getSession({
// existing configurations
geolocation: {
enabled: true,
highAccuracy: true,
canPrompt: true,
// set this to below the industry requirements to allow for some leverage (eg. Brazil should check every ~30mins, so we do 25 here)
maxAgeSeconds: 25*60,
timeoutMs: Infinity
},
// can do fix timeout here (eg. 10_000) if the application requires it, or if there's a problem with Infinity
networkTimeoutMs: Infinity,
fieldTimeoutMs: Infinity
})
Recommended configuration for iOS SDK
To integrate geolocation with the SEON iOS SDK (Swift), configure the SEONGeolocationConfig object to enable location tracking and adjust key settings like service timeouts and cache age. Additionally, it’s recommended — though optional — to enhance detection by enabling behavior monitoring, which can feed enriched data into your Geofence or Fraud API requests.
For the Objective-C integration, please refer to the SEON Github documentation.
// Prompt the user for appropriate location permission(s)
// ...
// Customize how geolocation is collected by modifying the default values of `SEONGeolocationConfig`
let config = SEONGeolocationConfig() // creates a config object with the default values
config.geolocationEnabled = true // Enable the Geolocation feature
config.prefetchEnabled = false // Disable pre-fetching a valid location
config.geolocationServiceTimeoutMs = 3000 // Timeout for the location service in milliseconds
config.maxGeoLocationCacheAgeSec = 60 // Maximum allowed age of a location object in seconds
// Set the geolocation config for the SEONFingerprint object
SEONFingerprint.sharedManager().setGeolocationConfig(config)
// It's highly advised but optional to use our extended fingerprinting capabilities via behaviour monitoring.
// Start behaviour monitoring where appropriate eg. when the user opens the app
SEONFingerprint.sharedManager().startBehaviourMonitoring()
do {
// Get the fingerprint or stop behaviour monitoring
let fingerprintResult = try await seonfp.getFingerprintBase64()
// or
let fingerprintResult = try await seonfp.stopBehaviourMonitoring()
// Use the received value in your session property for your Geofence API or Fraud API request.
} catch {
// Handle any errors
print("Error fetching fingerprint: \(error.localizedDescription)")
}
Recommended configuration for Android SDK
To integrate geolocation in the SEON Android SDK using Kotlin, set up the SeonGeolocationConfig and explicitly enable geolocation within the SeonBuilder, making sure to request user permissions before collecting fingerprint data. For enhanced results, it’s highly recommended to activate behavior monitoring, which can gather additional signals and gracefully handle geolocation status codes when retrieving device fingerprints.
For the Java integration, please refer to the SEON Github documentation.
kotlin
// You should initialize the Seon SDK, enable geolocation collection,
// and prompt the user for appropriate location permission(s) before
// trying to retrieve a fingerprint with valid location data.
// Create an optional custom Geolocation Config object
val seonGeolocationConfig = SeonGeolocationConfigBuilder()
.withPrefetchEnabled(true) // When enabled, prefetch location from the API on init for better performance
.withGeolocationServiceTimeoutMs(3000) // The timeout in milliseconds for the location service
.withMaxGeoLocationCacheAgeSec(600) // Maximum Location data age permitted in seconds
.build()
// Pass the custom geolocation config object to SeonBuilder or use the default config values by omitting it.
val seon = SeonBuilder()
.withContext(applicationContext)
.withSessionId(UUID.randomUUID().toString())
.withGeolocationEnabled() // must be explicitly enabled to turn on the Geolocation feature
.withGeoLocationConfig(seonGeolocationConfig) // optional config
.build()
// Geolocation and SeonGeolocationConfig can also be set later on the Seon object
seon.setGeolocationEnabled(true)
seon.setGeoLocationConfig(seonGeolocationConfig)
// It's highly advised but optional to use our extended fingerprinting capabilities via behaviour monitoring.
// Start behaviour monitoring where appropriate eg. when the user opens the app
seon.startBehaviourMonitoring()
/* ---- Relevant user journey happens here ----
* Note: The behaviour analysis needs time to collect signals on user behaviour,
* so it's advisable to run it at least for a few seconds.
*/
try {
// When you want to collect the results, call stopBehaviourMonitoring() as you would getFingerprintBase64()
val seonCallback = object : SeonCallbackWithGeo {
override fun onComplete(response: String) {
// Successfully received fingerprint response with device location data.
}
override fun onCompleteWithGeoFailure(response: String, geoStatusCode: Int) {
// Successfully received fingerprint response, without valid location data and geolocation service status code.
}
}
seon.stopBehaviourMonitoring(seonCallback)
// OR
seon.getFingerprintBase64(seonCallback)
} catch (e: BehaviouralMonitoringException) {
// Handle behavioural monitoring failure
e.printStackTrace()
} catch (e: SeonException) {
e.printStackTrace()
}