Get Business Place ID using Google Place API

The Google Places API is a powerful tool that allows businesses to retrieve essential location details, such as the Place ID, which plays a crucial role in mapping services, SEO, and enhancing user experiences. In this article, we will explore how to leverage the Google Places API to obtain the Place ID of business.

1. Understanding the Google Places API

The Google Places API is part of the Google Maps Platform and serves as a gateway to accessing location-based data with ease. It offers an array of functionalities, enabling businesses to search for places, retrieve place details, obtain user reviews, and access location-based photos and images.

2. Getting an API Key

To harness the capabilities of the Google Places API, you will need an API key. This unique identifier allows Google to track your API usage and apply usage limits. Getting an API key is a simple process that involves visiting the Google Developer Console and following the provided instructions.

3. Using the Google Places API to Get the Place ID

The Place ID is a distinctive and stable identifier assigned by Google to each place in its vast database. It is a valuable asset for businesses, as it ensures consistency when referencing locations across different platforms and services.

To obtain the Place ID for your business, you can follow these steps:

Step 1: Construct the Request URL

The base URL for the “Find Place from Text” request is This request requires parameters such as the input (business name) and inputtype (textquery). Additionally, you need to specify the fields parameter to include the desired information – in this case, the Place ID. Finally, append your API key to the URL as the key parameter.

Step 2: Send the HTTP Request

You can use various PHP HTTP client libraries, such as file_get_contents or curl, to send the HTTP request to the Google Places API. The API will respond with the requested data in JSON format.

Step 3: Parse the Response and Extract the Place ID

Upon receiving the response from the Google Places API, you need to parse the JSON data and extract the Place ID from it. The Place ID can be found within the candidates array in the API response.

4. Using Place ID We Can Get Information and Functionalities

An acquired Place ID opens up many possibilities to enhance your business’s online presence and user experience:

  1. Place Details: With the Place ID, you can access comprehensive details about your business, such as its name, address, phone number, website, opening hours, and more.
  2. Location on Google Maps: Displaying your business location on Google Maps helps customers find your establishment easily and obtain directions.
  3. Check-ins and Reviews: Retrieve user reviews and ratings to gauge customer satisfaction and address feedback.
  4. Photos and Images: Showcase images associated with your business to enhance its credibility and attract potential customers.
  5. Place Photos Service: Use the Place ID to access high-quality photos of your business, ideal for integrating visual content into your website or app.
  6. Autocomplete and Suggestions: Enable location-based autocomplete suggestions in search fields, improving user convenience.
  7. Nearby Places: Suggest nearby attractions, restaurants, or amenities to your users, enhancing their experience.
  8. Place Add/Delete/Update: Manage your business’s information, including adding new places, updating details, or removing incorrect entries.
  9. Place Types and Categories: Categorize your business accurately to filter and sort places based on user preferences.
  10. Geolocation and Geometry: Retrieve the geographical coordinates of your business, vital for mapping and location-based services.

5. PHP Code to Fetch Business Place ID using Google Place API :

Here’s a sample PHP function to get the Place ID for your business using the Google Places API:

// Sample PHP function to get the Place ID using Google Places API
function get_place_id($api_key, $business_name) {
    // Construct the request URL
    $base_url = "";
    $params = array(
        "input" => $business_name,
        "inputtype" => "textquery",
        "fields" => "place_id",
        "key" => $api_key
    $query_string = http_build_query($params);
    $request_url = $base_url . '?' . $query_string;

    // Send the HTTP request and get the response
    $response = file_get_contents($request_url);
    $data = json_decode($response, true);

    // Parse the response and extract the Place ID
    if ($data["status"] == "OK") {
        if (!empty($data["candidates"])) {
            $place_id = $data["candidates"][0]["place_id"];
            return $place_id;
        } else {
            echo "No results found.";
    } else {
        echo "Error occurred: " . $data["status"];

    return null;

// Replace 'YOUR_API_KEY' with your actual API key
$api_key = "YOUR_API_KEY";

// Replace 'BUSINESS_NAME' with your business name keyword
$business_name = "BUSINESS_NAME";

$place_id = get_place_id($api_key, $business_name);
if ($place_id) {
    echo "Place ID: " . $place_id;

Replace API KEY and BUSINESS NAME, and then it will return the results as a response. It can also return multiple Place IDs due to similar business names.

Output :

Place ID: ChIJgYZ9bERDXz4R4fxbiFi4iFU

Response :

Google Place API Response


The Google Places API provides businesses with a wealth of location-based data, with the Place ID serving as a foundational element. By leveraging this powerful tool, you can obtain your business’s Place ID and access vital details, display your location on Google Maps, manage user reviews, and offer enhanced user experiences through autocomplete suggestions and nearby place recommendations. Embrace the potential of the Google Places API to elevate your business’s online presence and establish a seamless and satisfying user journey for your customers. Always remember to adhere to Google’s API guidelines and ensure your usage complies with their terms and conditions. You can find more Google API and Google Map related posts in our blog.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.