Add a Geofence
API Parameters
client_id
The unique ID associated with your developer project.
Type: string, Required: trueoauth_token
The access token generated via your web application as described here.
Type: string, Required: truename
A custom string that you can set to help you identify the set of geofences.
Type: string, Required: truevenueId
A single FoursquarevenueId. Required if adding a geofence around a FSQ venue & if either acategoryIdor achainIdis not provided.
Type: stringcategoryId
A single FoursquarecategoryId. Required if adding a geofence around a FSQ venue & if either avenueIdor achainIdis not provided.
Type: stringchainId
A single FoursquarevenueId. Required if adding a geofence around a FSQ venue & if either avenueIdor acategoryIdis not provided.
Type: stringpolygon
A string of URL encoded lat/lng points separated by semicolon, with start and end as the same points. Must provide between 4 and 15 points in a clockwise fashion to successfully create the polygon. Required if adding a geofence using a custom polygon.
Type: stringcenter
A comma separated lat/lng coordinate. Required if adding a lat/long coordinate based geofence.
Type: stringradius
Area around the lat/lng that will trigger a geofence event. Default and minimum radius is 50 meters with a max of 5000. Required if adding a lat/long coordinate based geofence.
Type: int32dwellTime
Number of minutes user needs to be inside of a geofence to trigger a dwell event. Default is 1 minute. Applies only to polygon and lat/long coordinate-based geofences.
Type: int32v
The API version date as documented here
Type: string, Required: true
Example Request
curl --request POST \
--url https://api.foursquare.com/v2/apps/client_id/geofences/add \
--header 'accept: application/json'
Example Response
{
"meta": {
"code": 200,
"requestId": "5caac6f5dd57977ccc9f0876"
},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
}
],
"response": {
"geofence": {
"type": "Venue",
"name": "My Deals and Offers",
"id": "5caac6f56e69af002502df37",
"venueIds": [
"3fd66200f964a520d0e41ee3"
],
"boundary": {
"radius": 100
},
"dwellTime": 2
}
}
}