1. Setup Your Developer Account

Thanks for choosing the Places API to build location-based experiences into your app or website. We know that getting started with a new API can be challenging, so we’ve created a step-by-step guide that walks you through how to create a Foursquare Developer account, make your first API call and more.


2. Register as a Developer

If you are an existing Foursquare user, you will be able to use your own account to register. If not, you will have to either Sign Up for Foursquare or login using Facebook.

Create Developer Account


3. Create A New Foursquare App

On the next page, choose a name for your app and enter the URL where it will be hosted.


4. Obtain Your Client ID and Secret Key

Once you’ve created your app, make note of your client ID and secret key, as we will need this in the next step. Please note the key below has been generated for this guide and will not be usable in an application.

newapp


5. Make Your First API Call

Using the client ID and secret obtained previously, lets make our first API call!. The examples below show you how to find a coffee shop near a given location.

Preview Language:
|
|
|
curl -X GET -G \
  'https://api.foursquare.com/v2/venues/explore' \
    -d client_id="CLIENT_ID" \
    -d client_secret="CLIENT_SECRET" \
    -d v="20170801" \
    -d ll="40.7243,-74.0018" \
    -d query="coffee" \
    -d limit=1
import json, requests
url = 'https://api.foursquare.com/v2/venues/explore'

params = dict(
  client_id='CLIENT_ID',
  client_secret='CLIENT_SECRET',
  v='20170801',
  ll='40.7243,-74.0018',
  query='coffee',
  limit=1
)
resp = requests.get(url=url, params=params)
data = json.loads(resp.text)
const request = require('request');

request({
  url: 'https://api.foursquare.com/v2/venues/explore',
  method: 'GET',
  qs: {
    client_id: 'CLIENT_ID',
    client_secret: 'CLIENT_SECRET',
    ll: '40.7243,-74.0018',
    query: 'coffee',
    v: '20170801',
    limit: 1
  }
}, function(err, res, body) {
  if (err) {
    console.error(err);
  } else {
    console.log(body);
  }
});
// Response shortened to display relevant information
{
  "meta": {
    "code": 200,
    "requestId": "5991c2dbdd57972dfdf5831b"
  },
  "response": {
    "headerLocation": "SoHo",
    "headerFullLocation": "SoHo, New York",
    "headerLocationGranularity": "neighborhood",
    "query": "coffee",
    "totalResults": 101,
    "groups": [
      {
        "items": [
          {
            "venue": {
              "id": "573498df498e6df2eb8b36a7",
              "name": "La Colombe Torrefaction",
              "location": {
                "address": "154 Prince St",
                "crossStreet": "B/T W. Broadway & Thompson",
                "lat": 40.7258839175593,
                "lng": -74.0010660462815,
                "distance": 186,
                "postalCode": "10012",
                "cc": "US",
                "city": "New York",
                "state": "NY",
                "country": "United States",
                "formattedAddress": [
                  "154 Prince St (B/T W. Broadway & Thompson)",
                  "New York, NY 10012",
                  "United States"
                ]
              },
              "categories": [
                {
                  "id": "4bf58dd8d48988d1e0931735",
                  "name": "Coffee Shop",
                  "pluralName": "Coffee Shops",
                  "shortName": "Coffee Shop",
                  "icon": {
                    "prefix": "https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_",
                    "suffix": ".png"
                  },
                  "primary": true
                }
              ],
              "stats": {
                "checkinsCount": 2097,
                "usersCount": 893,
                "tipCount": 12
              },
              "url": "https://lacolombe.com",
              "price": {
                "tier": 1,
                "message": "Cheap",
                "currency": "$"
              },
              "rating": 9.2,
              "hours": {
                "status": "Likely open",
                "isOpen": true,
                "isLocalHoliday": false
              },
              "hereNow": {
                "count": 1,
                "summary": "One other person is here"
              }
            },
            "tips": [
              {
                "createdAt": 1468075940,
                "text": "The iced coffee is no longer an iced red eye, it's cold brew. If you want the red eye ask for it; it's the same price.",
                "type": "user",
                "canonicalUrl": "https://foursquare.com/item/57810fa4498e1542398875fa",
                "likes": {
                  "count": 1,
                  "groups": [],
                  "summary": "1 like"
                },
                "agreeCount": 3,
                "user": {
                }
              }
            ],
            "referralId": "e-0-573498df498e6df2eb8b36a7-0"
          }
        ]
      }
    ]
  }
}

6. Next Steps

Now that you’re all set to make API calls, be sure to check out these additional pages about our Rate Limits, Authentication, Versioning, and Terms of Use. Also, feel free to explore all the endpoints we have!

API Endpoints