Google Indexing API with Python: A Working Guide for Faster URL Indexing
Digital Marketing

Google Indexing API with Python: A Working Guide for Faster URL Indexing

How to use Python and the Google Indexing API to submit URLs for faster indexing, including the one important limitation most tutorials skip.

ITSolvez Team9 min readDigital Marketing

New pages can sit unindexed on Google for days or weeks if you wait for a normal crawl. The Google Indexing API lets you ping Google directly and ask it to crawl a specific URL right away. Automating that with Python turns a manual, one-URL-at-a-time task into something you can run against a whole batch of pages in seconds.

The important limitation almost nobody mentions upfront

Google's documentation states the Indexing API is officially intended only for two page types: job posting pages and pages with a live video broadcast (using JobPosting or BroadcastEvent structured data). In practice, a large number of SEO practitioners use it for ordinary pages anyway, and it often does trigger a faster crawl. But Google has never guaranteed this works outside its documented use case, and pages submitted this way are not guaranteed to be indexed just because the API accepted the request. Worth knowing before you build a workflow around it: this is a widely used practitioner technique, not an officially supported general-purpose tool.

With that said, here is how to actually build and run it.

Step 1: Set up a Google Cloud project

  1. Go to the Google Cloud Console and create a new project (or use an existing one)
  2. Search for "Web Search Indexing API" in the API Library and enable it
  3. Go to IAM and Admin, then Service Accounts, and create a new service account
  4. Create a key for that service account and download it as a JSON file, keep this file private

Step 2: Give the service account access in Search Console

The service account needs permission to act on your property. In Google Search Console, go to Settings, then Users and Permissions, and add the service account's email address (found in the JSON key file) as an Owner.

Step 3: Install the required Python libraries

pip install google-api-python-client google-auth

Step 4: Write the submission script

from google.oauth2 import service_account
from googleapiclient.discovery import build

SCOPES = ["https://www.googleapis.com/auth/indexing"]
KEY_FILE = "service-account-key.json"

credentials = service_account.Credentials.from_service_account_file(
    KEY_FILE, scopes=SCOPES
)

service = build("indexing", "v3", credentials=credentials)

def submit_url(url, action="URL_UPDATED"):
    body = {"url": url, "type": action}
    response = service.urlNotifications().publish(body=body).execute()
    return response

result = submit_url("https://example.com/new-page")
print(result)

Use URL_UPDATED when a page is new or has changed, and URL_DELETED when a page has been removed and you want Google to drop it from the index faster.

Step 5: Submit a batch of URLs, respecting the quota

The default quota is 200 requests per day per project, and there is also a short-term rate limit, so submitting hundreds of URLs at once without pacing will start failing partway through. A simple batch runner with a delay handles this cleanly:

import time

urls = [
    "https://example.com/page-1",
    "https://example.com/page-2",
    "https://example.com/page-3",
]

for url in urls:
    try:
        submit_url(url)
        print(f"Submitted: {url}")
    except Exception as e:
        print(f"Failed: {url} - {e}")
    time.sleep(1)

Step 6: Handle errors properly, do not just ignore them

The most common failure is a 403 error, which almost always means the service account has not actually been added as an Owner in Search Console, or was added to the wrong property. A 429 means you have hit the rate limit and need to slow down. Logging the response for every submission, not just printing success messages, makes it much easier to spot a pattern when a batch partially fails.

What to actually use this for

The realistic, useful cases are: submitting a newly published page the moment it goes live rather than waiting for the next crawl, resubmitting a page after a significant content update, and notifying Google when a page has been deleted or redirected so it drops out of the index faster. It is not a substitute for having a clean sitemap, solid internal linking and genuinely crawlable site structure, which do far more for indexing at scale than any API call.

Where this fits with the rest of your SEO work

Automating URL submission solves one specific problem: the delay between publishing and Google noticing. It does not fix a page that will not rank once it is indexed, that still comes down to content quality, technical SEO fundamentals, and backlinks. Treat this as a small, useful piece of a bigger SEO workflow, not a shortcut around the rest of it.

If you are building automation like this into your own content or SEO pipeline and want it set up properly, alongside the technical SEO work that actually determines whether those pages rank once indexed, our digital marketing team and development team work on exactly this kind of tooling together.

Put this into practice for your business

ITSolvez works with businesses across India to implement exactly what you've just read — with the expertise to do it right.

Ready to talk?

Get a free consultation

Tell us what you need — we reply within one business day with clear next steps and honest pricing.

ISO 27001 certified — your details are handled securely and never shared.