Places API allows you to lookup information on a particular place using a combination of the location name and details about the physical location. Attributes like address, city, region or even latitutde/longitude. You may request attributes from Safegraph Core, Geometry, or Pattern datasets.

Request Parameters: Query

query parameters are used to lookup POI details using Name and Location.

Parameter

Description

location_name

Name of the location

street_address

Street Address

city

Name of the city

region

Name of the Region

postal_code

The numeric postal code

iso_country_code

ISO Country code

latitude

The latitude with a precision of at least 3 decimal points.

longitude

The longitude with a precision of at least 3 decimal points.

🚧

Required Fields

When querying by location & address, it's necessary to have at least the following combination of fields to return a result:

  • location_name + street_address + city + region + iso_country_code
  • location_name + street_address + postal_code + iso_country_code
  • location_name + latitude + longitude + iso_country_code
query {
  lookup(
    query: {
      location_name: "Taco Bell"
      street_address: "710 3rd St"
      city: "San Francisco"
      region: "CA"
      iso_country_code: "US"
    }
  ) {
    placekey
    safegraph_core {
      location_name
      street_address
      postal_code
      phone_number
      category_tags
    }
  }
}
curl --location --request POST 'https://api.safegraph.com/v1/graphql' \
--header 'apikey: {your-api-key}' \
--header 'content-type: application/json' \
--data-raw '{"query":"query {\n\tlookup(query: {\n\t\t\tlocation_name: \"Taco Bell\", \n\t\t\tstreet_address: \"710 3rd St\", \n\t\t\tcity: \"San Francisco\", \n\t\t\tregion: \"CA\", \n\t\t\tiso_country_code: \"US\"\n\t\t}) { \n\t\tplacekey \n\t\tsafegraph_core {\n\t\t\tlocation_name\n\t\t\tstreet_address\n\t\t\tpostal_code\n\t\t\tphone_number\n\t\t\tcategory_tags\n\t\t}\n\t}\n}","variables":{}}'
# pip install safegraphQL
import safegraphql.client as sgql

sgql_client = sgql.HTTP_Client(apikey = 'your-api-key')

location_name = 'Taco Bell'
street_address = '710 3rd St'
city = 'San Francisco'
region = 'CA'
iso_country_code = 'US'

cols = [
    'location_name',
    'street_address',
    'postal_code',
    'phone_number',
    'category_tags'
]

sgql_client.lookup_by_name(
    product = 'core', 
    location_name = location_name,
    street_address = street_address,
    city = city,
    region = region,
    iso_country_code = iso_country_code,
    columns = cols
)
{
  "data": {
    "lookup": {
      "placekey": "[email protected]",
      "safegraph_core": {
        "location_name": "Taco Bell",
        "street_address": "710 3rd St",
        "postal_code": "94107",
        "phone_number": "+14159791587",
        "category_tags": [
          "Counter Service",
          "Late Night",
          "Lunch",
          "Fast Food",
          "Drive Through",
          "Breakfast",
          "Mexican Food",
          "Dinner"
        ]
      }
    }
  },
  "extensions": {
    "row_count": 1,
    "version_date": "1635494405__2021_10"
  }
}