Example Queries

Searching for a place by address

query {
  search(filter: { address: { 
    location_name: ""
    street_address: "66 mint"
    city: "san francisco"
    # region: ""
    # postal_code: ""
    # iso_country_code: ""
  }}) {
    places {
      # confidence: [ HIGH, MEDIUM, FUZZY]
      results(first:10 after: "" confidence: FUZZY) {
        edges {
          node {
            # Node is the object for each POI
            placekey
            safegraph_core {
              location_name
              street_address
              city
              region
              iso_country_code
              latitude
              longitude
            }
            safegraph_geometry {
              # polygon_wkt
              wkt_area_sq_meters
            }
          }
        }
      }
    }
  }
}

Search for a location within a radius

query searchByRadius {
  search(filter: {
    by_radius: {
      latitude: 37.78247
      longitude: -122.407752
      distanceInMeters: 5000
    }
    # naics_code: 722513
  }) {
    places {
      results(first: 100) {
        edges {
          node {
            safegraph_core {
              location_name
              street_address
              category_tags
            }
          }
        }
      }
    }
  }
}

Using Variables

query search($location_name:String, $street_address:String, $city:String) {
  search(filter: { address: { 
    location_name: $location_name
    street_address: $street_address
    city: $city
    # region: ""
    # postal_code: ""
    # iso_country_code: ""
  }}) {
    places {
      results(first:10 after: "" confidence: FUZZY) {
        edges {
          node {
            placekey
            safegraph_core {
              naics_code
              location_name
              street_address
              city
              region
              iso_country_code
              latitude
              longitude
            }
            safegraph_geometry {
              wkt_area_sq_meters
            }
          }
        }
      }
    }
  }
}
{
  "location_name": "blue bottle",
  "street_address": "66 mint",
  "city": "san francisco"
}

Terms

  • Connection: A collection of objects such as edges or pageInfo
  • Page Info: Help with pagination such as hasNextPage or endCursor
  • Edges: The array of records or the link between the nodes.
  • Nodes: The returned record.
  • Cursors: The base64 encoded string to set the pagination offset or ID