The base URL is
https://api.radar.io. Send your API key in the Authorization header. For key types, the error format, and rate limits, see Authentication, errors, and rate limits.
To receive events on your backend as they happen, use webhooks or another integration. The REST API doesn’t provide a general-purpose operation for listing historical events.
Event object
An event represents a change in user state. You can reference an event by its Radar_id.
An entry or exit event describes a transition. To read a user’s current state, such as the geofences they are in now, use the
user object instead of replaying events. Events can arrive late or be replayed after a device was offline, so use createdAt to order them. For the event types that each context type generates, see context types.
Example event
This event was generated whenuser-123 exited a geofence after 48 minutes.
Event confidence
Every geofence and place event has aconfidence from 1 (low) to 3 (high). For a geofence event, confidence depends on the accuracy of the location the device reported and on the shape of the geofence.
Small geofences and inaccurate locations produce lower confidence. If a low-confidence entry would cause a wrong decision, ignore events below the level you need.
For a place event, confidence uses location accuracy, the footprint of the place, how dense the area is, and other signals. In a mall or on a dense street, expect more medium and low confidence events than for your own geofences. A
user.entered_place event can include alternatePlaces, the other candidates Radar considered. To tell Radar which place was correct, see Verify an event.
Delayed and replayed events
Radar generates an event when the location update that causes it reaches Radar’s servers. How soon that happens depends on the tracking mode: immediately for a foregroundRadar.trackOnce() call, and within the update interval of the tracking preset for background tracking. The operating system can delay background updates further, for example in Low Power Mode on iOS or in Doze on Android.
Two fields tell you about delay:
createdAt: When the location was recorded on the device.actualCreatedAt: When Radar created the event on the server.
createdAt with the current time and skip actions that are no longer relevant.
Some tracking options store locations while the device is offline and send them later. Events from those updates have replayed set to true in the native SDKs, and a createdAt in the past. Treat them as history, not as a current arrival.
Every event has a unique _id. Store the IDs you have processed and ignore repeats, so that a webhook request delivered more than once doesn’t trigger the action twice.
Generate an entry or exit event
There is no operation that creates an entry or exit event directly. Radar generates these events when a location update changes a user’s state. To generate one, call Track with alatitude and longitude inside a geofence you created to produce an entry, then call it again with a location outside the geofence to produce an exit. The events are returned in the events array of each response.
On iOS and Android, use the SDK to track users. To test event generation without moving, see Test, troubleshoot, and go live.
Log a conversion
Logs a conversion to analyze alongside other location activity in your app. A conversion can represent a purchase, a signup, engagement with an in-app feature, or another action.- Endpoint:
POST /v1/events - Authentication: Publishable key
- Rate limit: 10 requests per second
- Used by: Detect geofence events and place visits
Custom conversions are available on the Enterprise plan.
Radar.logConversion().
Body parameters
Include at least one of
userId, deviceId, or installId. If no matching user exists, include deviceId or installId so Radar can record the conversion without a location.
Response
A200 response contains meta and event, an event object whose type is the conversion name. Conversions always have a confidence of 3.
Example
This request logs anin_app_purchase conversion with revenue and metadata for user-123.
Errors
A
400 response looks like this:
Verify an event
Accepts or rejects an event. Event verifications are used to improve the accuracy and confidence level of future events, for example after a user confirms or corrects a place check-in.- Endpoint:
PUT /v1/events/:id/verification - Authentication: Publishable key
- Rate limit: 10 requests per second
- Used by: Detect geofence events and place visits
Path parameters
Body parameters
Response
A200 response contains meta and event, the updated event object.
Example
This request accepts an event.Errors
A
404 response looks like this: