Geofences use the Haversine formula for accurate distance calculations on Earth’s surface. All radius values are in meters.
Business Value
| Scenario | How Geofencing Helps |
|---|---|
| Store proximity | Push a mobile offer when a customer is within 200m of a retail location |
| Event marketing | Trigger welcome messages at a conference venue boundary |
| Competitor conquest | Detect when customers visit competitor locations and follow up with a retention offer |
| Dwell-based triggers | Send a survey after a customer spends 15+ minutes in-store |
How It Works
Define geofences
Create geofence records with a center point (latitude/longitude), radius in meters, and trigger configuration (enter, exit, or dwell).
Receive location updates
Your mobile app or IoT system sends location updates to the Geofence Check API with the customer’s coordinates.
Match against active geofences
The engine calculates the Haversine distance from the customer’s position to each geofence center and returns all matches where the distance is within the radius.
Configuration
Creating a Geofence
Geofence Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable name for the geofence |
description | string | No | Optional description |
latitude | number | Yes | Center point latitude (-90 to 90) |
longitude | number | Yes | Center point longitude (-180 to 180) |
radiusMeters | integer | No | Radius in meters. Default: 500 |
triggerOn | string | No | When to fire: enter, exit, or dwell. Default: enter |
dwellMinutes | integer | No | Minutes the customer must remain inside before triggering (only for dwell type) |
cooldownMs | integer | No | Milliseconds before the same customer can re-trigger this geofence. Default: 86400000 (24 hours) |
action | object | No | Arbitrary JSON payload describing the action to take on trigger |
status | string | No | active or inactive. Default: active |
Trigger Types
| Type | Behavior |
|---|---|
enter | Fires when a customer’s location first falls within the radius |
exit | Fires when a customer’s location moves outside the radius after being inside |
dwell | Fires when a customer remains inside the radius for at least dwellMinutes |
Checking Location
To check whether a customer is inside any active geofences:Response
Integration with Decision Flows
A common pattern is to chain geofence detection with a Recommend API call:- Mobile app detects location change, calls
/api/v1/geofences/check - If matches are returned, extract the
decisionFlowIdfrom the action payload - Call
/api/v1/recommendwith the decision flow ID and customer context - Display the personalized offer via push notification or in-app message
API Reference
See the full Geofences API Reference for all CRUD endpoints, the check endpoint, field descriptions, and error codes.Next Steps
Geofences API
Full CRUD and check endpoint documentation.
Event Ingestion
Feed location events into the trigger engine.
Triggers
Configure rules that fire actions based on events.
Channels
Set up push notification delivery via Firebase or webhook adapters.