Create a Developer Account

If you do not have an existing Foursquare account, you will need to create an account in order to sign up as a developer.

Create A New Foursquare App

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

screenshot of the page to create an app

Obtain Your Client ID and Secret

Once you’ve created your app, make note of your Client ID and Client Secret since you will need these credentials in order to make a request. Please note the key below has been generated for this guide and will not be usable in an application.

screenshot of the page tshowing client ID and secret

Note: if you need to make authenticated calls using an OAuth access token, please refer to our documentation on authentication.

Make Your First API Call

We recommend you download and use our Postman Collection to test out the API. If that's not possible, you can use the below code snippets.

Using your client ID and secret, let's make our first API call! The examples below show you how to find a coffee shop near a given location.

curl -X GET -G \
  'https://api.foursquare.com/v2/venues/explore' \
    -d client_id="CLIENT_ID" \
    -d client_secret="CLIENT_SECRET" \
    -d v="20180323" \
    -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='20180323',
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: '20180323',
      limit: 1,
    },
  },
  function(err, res, body) {
    if (err) {
      console.error(err);
    } else {
      console.log(body);
    }
  }
);
$.ajax({
  dataType: "json",
  url: "https://api.foursquare.com/v2/venues/explore?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=20180323&limit=1&ll=40.7243,-74.0018&query=coffee",
  data: {},
  success: function( data ) {
    // Code for handling API response
    console.log(data);
  },
  error: function(jqXHR, textStatus, errorThrown) {
    // Code for handling errors
  }
});
  $url = "https://api.foursquare.com/v2/venues/explore?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=20180323&limit=1&ll=40.7243,-74.0018&query=coffee";
  $json = file_get_contents($url);
  $elements = json_decode($json);
  var_dump($elements);
// 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"
          }
        ]
      }
    ]
  }
}

Choose Your Account Tier

Need more requests? Need higher rate limits?

Choose the right API tier for you and upgrade your account to receive even more rich content, dedicated technical support, as well as discounts for higher call volumes.

screenshot of the page to select tier

Explore API Tiers

Next Steps

Now that you're all set to make API calls, be sure to check out these additional links to get you live:

API Endpoints

Rate Limits

Authentication

Attribution

Terms of Use