Introduction
When you publish a new page on your website, you want Google to immediately notice it and add it to its index. However, under normal circumstances, it may take time for Google bots to crawl your site. This is where the "Google Indexing API" comes into play. In this article, we will explain in detail how you can quickly notify Google of your site and get it indexed with the Google Index API.
What is Google Index API?
The Google Index API is specifically designed for news sites and sites with frequently changing content. With this API, you can instantly notify Google when a page is added, updated, or deleted.
Advantages
-
New pages are indexed in minutes.
-
Updated content is quickly updated.
-
Deleted pages can be immediately removed from the index.
-
Improves SEO performance.
What You Need to Use Google Index API
-
A Google Cloud Platform account
-
Creating a project
-
Defining API keys
-
Authorized service account
-
Service account key file in JSON format
-
A PHP or Python script (or manual curl commands)
Google Index API Setup Step by Step
1. Create a Google Cloud Platform Project
-
Go to Google Cloud Console.
-
Create a new project. For example: "Site Index API"
2. Activate Indexing API
-
Go to "APIs & Services > Library" in the left menu.
-
Search for "Indexing API" and activate it.
3. Create a Service Account
-
Go to the "IAM & Admin > Service Accounts" tab.
-
Click the "Create Service Account" button.
-
Give it a name: like "index-api-user".
-
Select "Project > Owner" as the role.
-
Create a key in JSON format and download it to your computer.
4. Authorize Domain (Domain Verification)
-
Log in to your Search Console account.
-
Add your project's domain and verify ownership.
-
Add the service account email as an authorized user.
5. Preparing the Script (PHP Example)
A simple working example with PHP:
<?php
require_once 'vendor/autoload.php';
$client = new Google_Client();
$client->setAuthConfig('service-account.json');
$client->addScope('https://www.googleapis.com/auth/indexing');
$httpClient = $client->authorize();
$url = 'https://indexing.googleapis.com/v3/urlNotifications:publish';
$data = [
'url' => 'https://www.yourwebsite.com/new-article',
'type' => 'URL_UPDATED'
];
$response = $httpClient->post($url, [
'json' => $data
]);
echo $response->getBody();
6. Run the Script
-
Run the PHP file above on your server.
-
Your URL will be reported to Google in seconds.
FAQ (Frequently Asked Questions)
Is Index API usage open to everyone? Yes, it is especially recommended for sites with frequently updated content. Like news sites, blogs, etc.
Which page types can it be used for? Suitable for newly published, updated, or deleted pages.
Is there a daily limit? Yes. Google accepts a maximum of a certain number of URLs per day. (Approximately 200 submissions are recommended.)
Do I have to send a separate request for each URL? Yes, a separate notification must be made for each URL.
Conclusion
By using the Google Index API, you can instantly notify Google of your site's new pages, updated content, and deleted links. This puts you one step ahead of your competitors and significantly improves your SEO performance. By following this step-by-step guide, you can quickly include your site in the Google index.
If you need support, you can contact us to receive professional service.