Foursquare LogoFoursquare Developers Logo

Description

Create a geofence around any lat/lng coordinate.

Request

POST https://api.foursquare.com/v2/apps/CLIENT_ID/geofences/add

Authentication

This endpoint requires user authentication by your application and must include a valid client_id in the path parameters.

In addition to the client_id, calls to this endpoint require a valid OAuth access token in the query string of each request (&oauth_token=XXXX).

For more information about this authentication method and how to obtain an access token, see the Authentication docs.

Parameters

Name Example Description
name My Custom Location required A custom string that you can define to help you identify the set of geofences.
center 40.7435179,-73.988242149 required A comma separated lat/lng coordinate.
radius 100 required Area around the lat/lng that will trigger a geofence event. Default and miniumum radius is 50 meters with a max of 5000.
dwellTime 2 Number of minutes user needs to be inside of a geofence to trigger a dwell event. Default is 1 minute.

Response Fields

Field Description
id A unique string identifier for this geofence.
name Name of the geofence that will appear in the Pilgrim Console.
boundary Bounds of the geofence.

Response

{
  "meta": {
    "code": 200,
    "requestId": "5cab901e4c1f6715dfb6dee7"
  },
  "notifications": [
    {
      "type": "notificationTray",
      "item": {
        "unreadCount": 0
      }
    }
  ],
  "response": {
    "geofence": {
      "type": "LatLng",
      "name": "My Custom Location",
      "id": "5cab901ebfc6d0002ce1ff33",
      "boundary": {
        "center": {
          "lat": 40.7435179,
          "lng": -73.988242149
        },
        "radius": 100
      },
      "dwellTime": 2
    }
  }
}