Foursquare LogoFoursquare Developers Logo

Description

Bulk add up to 1000 geofence objects at the same time. A geofence object must have either one of venueId, categoryId, chainId, center, or polygon.

Request

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

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
geofences [{"name":"FavoriteCoffeeShop","venueId":"4b5901d3f964a520167828e3","dwellTime":5,"radius":100},{"name":"LatLngFence","dwellTime":10,"radius":175,"center":"40.7001,-73.988"}] required Array of pilgrim geofence objects. Must be URL encoded.
replace true Replace all the existing geofence entries with the new geofences. Will append new geofences if false.
returnGeofences true Returns all created geofences in a JSON array.

Response Fields

Field Description
geofencesCreated Number of successfully created geofences.
id A unique string identifier for this geofence.
type Can be either Venue, LatLng, or Polygon.
name Name of the geofence that will appear in the Pilgrim Console.
venueIds Venues that were geofenced.
chainIds Chains that were geofenced.
categoryIds Categories that were geofenced.
boundary Bounds of the geofence. For polygons it will be an array of points.

Response

{
  "meta": {
    "code": 200,
    "requestId": "5cabb780f594df4b0a39764f"
  },
  "notifications": [
    {
      "type": "notificationTray",
      "item": {
        "unreadCount": 0
      }
    }
  ],
  "response": {
    "geofencesCreated": 3,
    "geofences": [
      {
        "type": "Polygon",
        "name": "SF-ChinaTown",
        "id": "5cabb781bed483002c4b0bd5",
        "boundary": {
          "points": [
            {
              "lat": 37.79315153932501,
              "lng": -122.40858972072601
            },
            {
              "lat": 37.790353670610145,
              "lng": -122.40798890590668
            },
            {
              "lat": 37.79366023134501,
              "lng": -122.40449666976929
            },
            {
              "lat": 37.79315153932501,
              "lng": -122.40858972072601
            }
          ]
        },
        "dwellTime": 2
      },
      {
        "type": "Venue",
        "name": "Favorite Coffee Shop",
        "id": "5cabb781bed483002c4b0bd7",
        "venueIds": ["4b5901d3f964a520167828e3"],
        "boundary": {
          "radius": 100
        },
        "dwellTime": 5
      },
      {
        "type": "LatLng",
        "name": "LatLngFence",
        "id": "5cabb781bed483002c4b0bd8",
        "boundary": {
          "center": {
            "lat": 40.7001,
            "lng": -73.988
          },
          "radius": 175
        },
        "dwellTime": 10
      }
    ]
  }
}