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 find geofences near a location from a client, use Search geofences, which accepts a publishable key. To create geofences in bulk from a CSV file or a scheduled sync, see Detect geofence events and place visits. For the file format, see CSV import columns.
Geofence object
A geofence represents a custom region or place monitored in your project. You can reference a geofence by Radar_id, or by its tag and externalId together.
Example geofence
This geofence is a circle with a radius of 50 meters.List geofences
Lists geofences. Geofences are sorted descending byupdatedAt.
- Endpoint:
GET /v1/geofences - Authentication: Secret key
- Rate limit: 10 requests per second
Query parameters
Response
A200 response contains meta, with a hasMore boolean, and geofences, an array of geofence objects. To get the next page, pass the updatedAt of the last geofence as updatedBefore. See Pagination.
Example
This request gets the most recently updated geofence with the tagstore.
Errors
Get a geofence
Gets a geofence. Reference the geofence by Radar_id, or by tag and externalId.
- Endpoint:
GET /v1/geofences/:idorGET /v1/geofences/:tag/:externalId - Authentication: Secret key
- Rate limit: 10 requests per second
Path parameters
Response
A200 response contains meta and geofence, a geofence object.
Example
This request gets the geofence with the tagstore and the external ID store-42.
Errors
A
404 response looks like this:
Upsert a geofence
Upserts a geofence. Reference the geofence bytag and externalId, or by Radar _id. If a geofence with the specified tag and externalId exists, Radar updates it. If not, Radar creates it. Because the result is the same when you repeat the request, this is the recommended way to sync geofences from your own system.
- Endpoint:
PUT /v1/geofences/:tag/:externalIdorPUT /v1/geofences/:id - Authentication: Secret key
- Rate limit: 10 requests per second
- Used by: Detect geofence events and place visits, Build store locators
Path parameters
Body parameters
When you reference the geofence by Radar
_id, you can also send tag and externalId in the body to change them.
A restaurant that is open only for lunch and dinner on Sundays uses this operatingHours value:
Response
A200 response contains meta and geofence, the created or updated geofence object.
Example
This request creates or updates a circle geofence with a radius of 50 meters.Errors
A
400 response looks like this:
Delete a geofence
Deletes a geofence. Reference the geofence by Radar_id, or by tag and externalId.
- Endpoint:
DELETE /v1/geofences/:idorDELETE /v1/geofences/:tag/:externalId - Authentication: Secret key
- Rate limit: 10 requests per second
Path parameters
Response
A200 response contains only meta.
Example
This request deletes the geofence with the tagstore and the external ID store-42.
Errors
Get users in a geofence
Gets the users currently in a geofence. Users are sorted descending byupdatedAt.
- Endpoint:
GET /v1/geofences/:tag/:externalId/usersorGET /v1/geofences/:id/users - Authentication: Secret key
- Rate limit: 10 requests per second
Path parameters
Query parameters
Response
A200 response contains meta, with a hasMore boolean, and users, an array of user objects.
Example
This request lists the users in the geofence with the tagstore and the external ID store-42.
Errors
CSV import columns
A geofence CSV file has a header row followed by one row per geofence. The same columns apply to an import on the Geofences page and to a nightly geofence sync. Both upsert ontag and externalId: a row that matches an existing geofence updates it, and any other row creates a geofence. For the import and sync procedures and an example file, see CSV import.
Rows missing from the file aren’t deleted. To retire a location, keep its row in the file and set
enabled to false, or delete the geofence in the dashboard or with Delete a geofence.
Geofence settings
These settings change when a geofence generates entry and exit events. The project-level settings are in the Geofences section of the Settings page of the Radar dashboard. The per-geofence fields are set in a CSV import, with Upsert a geofence, or in the dashboard.Stop detection
With Geofence stop detection on, Radar generates an entry event only when the user stops in the geofence, not when they pass through it. A user counts as stopped when the location update hasstopped set to true according to your tracking options, or when the update was made in the foreground.
Turn it on for the whole project on the Settings page, or per geofence with the stopDetection field, which overrides the project-level setting.
Buffer entries and exits
These two project settings trade missed events against early ones.Operating hours
SetoperatingHours on a geofence to tell Radar when the location is open. Radar then adds a boolean currentlyOperating to every event for that geofence. To restrict event generation to operating hours for the whole project, use the setting in the Geofences section of the Settings page.
Set operating hours in a CSV import, with Upsert a geofence, or in the Advanced section when you create or edit a geofence in the dashboard.
Place matching
Place matching links a geofence you import to the corresponding place in Radar’s dataset, so that the geofence can use the place’s location and shape instead of a hand-entered point and radius.Place matching must be enabled for your project and requires Places. Contact your Radar account team.
- During CSV import: In the import dialog on the Geofences page, turn on Enable place matching and select the chains to match your rows against. After the import, the import history page shows the outcome for each row.
- Per geofence: Set
placeIdto the_idof a Radar place in a CSV row or an API request.
A row that didn’t match keeps the coordinates you supplied.