Python script for Bulk Submit URLs to Google Search Console

Today in this article, we will learn how to use Python script for Bulk Submit Website URLs to Google Search Console for Indexing or Crawling purpose.
Updated November 2026: google-auth code guidance, a section on 403/429 errors, quota and supported page types, a sitemap alternative, and an FAQ.
We already learned how to set up the service account, project, and other configurations so that we can leverage Google’s Indexing API before.
Today in this article, we will cover below aspects,
If you have not performed mandatory prerequisites, please follow the below article for more details,
You may find the need to submit the URLs due to many reasons like article update due to new data or upgrade or article enhancement, etc.
In such scenarios, it is always difficult to perform indexing manually.
We shall be using below endpoints required for publishing the URLs,
SCOPES = [ “https://www.googleapis.com/auth/indexing“ ]
ENDPOINT = “https://indexing.googleapis.com/v3/urlNotifications:publish“
In your python script please add below “using” namespace,
from oauth2client.service_account import ServiceAccountCredentials import httplib2 import json
Sample Script
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
import json
SCOPES= [ "https://www.googleapis.com/auth/indexing" ]
ENDPOINT= "https://indexing.googleapis.com/v3/urlNotifications:publish"
# thecodebuzz-da659b2b8b0d.json is the private key that you created for your service account.
JSON_KEY_FILE = "thecodebuzz-da659b2b8b0d.json" #Specify your service account JSON here
credentials = ServiceAccountCredentials.from_json_keyfile_name(JSON_KEY_FILE, scopes=SCOPES)
http = credentials.authorize(httplib2.Http())
url="url-1"
content = {
"url": url,
"type": "URL_UPDATED"
}
response, content = http.request(ENDPOINT, method="POST", body=json.dumps(content))
print(response)
from_json_keyfile_name method uses the JSON file service account information which we created in the previous article.
The above code works perfectly fine for one URL which we are providing the variable “URL”
Please install packages like oauth2client or httplib2 as required.
Python script for Bulk Submit URLs to Google Search Console
You can use Python built-in function called enumerate to submit the URL list as below,
urlList=["url1","url2", "url3"]
for index, item in enumerate(urlList):
content = {
"url": item,
"type": "URL_UPDATED"
}
response, content = http.request(ENDPOINT, method="POST", body=json.dumps(content))
print(response)
Once successfully submitted the URLs for indexing, you can see the status code as 200 for the request.

References :
Please follow the below article for more details on prerequisites,
That’s all! Happy coding!
Does this help you fix your issue?
Do you have any better solutions or suggestions? Please sound off your comments below.
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published (2026) best practices and guidelines for software design and development.
Why the Indexing API returns 403 or 429, and what it officially supports
A 403 Forbidden almost always means the service account’s email address was never added as a user on your Search Console property. A 429 means you’ve used up the daily quota. Both are easy to fix once you know where to look.
How do you fix a 403 Forbidden response?
Open the property in Search Console, go to its users and permissions, and add the service account’s email (the client_email value in your JSON key) with owner-level permission. A lower role isn’t enough for this API.
You don’t need to grant the service account any IAM role in Google Cloud for this. The permission that matters lives on the Search Console side.
How do you handle a 429 quota error?
A 429 means the project has hit its daily limit for publish requests. Sources disagree on the default, with figures of 100 and 200 requests per day per property, so don’t hard-code either one. Check the quota page for the Indexing API in your own Google Cloud Console.
Handle it inside your submit loop:
- Stop or back off: when a response returns 429, break out of the loop, or wait and retry later. Hammering the API with the rest of the list wastes time and gains nothing.
- Record what you’ve sent: keep a file or small database of URLs that already returned 200. A rerun can then skip them instead of spending quota twice.
What does the Indexing API officially support?
Google officially supports the Indexing API only for pages that carry JobPosting or BroadcastEvent structured data. Some people report it working on ordinary blog pages. That use is unsupported and not guaranteed, so don’t build anything critical on it.
The API accepts two notification types:
- URL_UPDATED: asks Google to crawl or recrawl a URL, for a new page or a changed one.
- URL_DELETED: asks Google to remove a URL that no longer exists.
Single calls go to the urlNotifications:publish endpoint. Batch calls go to the separate https://indexing.googleapis.com/batch endpoint.
Note: A submission works like dropping a note in a librarian’s suggestion box. The librarian reads it, but still decides whether the book goes on the shelf.
That is the key point: a successful 200 is a request, not a command. Google still decides whether to index the page based on its quality and uniqueness.
How do you keep the service account key safe?
The JSON key file is a password for your Search Console property. Keep it out of git by adding its filename to .gitignore before your first commit. If it ever leaks, delete that key in Google Cloud, create a new one, and update your script.
Frequently asked questions
Does the Google Indexing API work for normal pages, or only JobPosting and BroadcastEvent?
Google officially supports the Indexing API only for pages with JobPosting or BroadcastEvent (livestream) structured data. Some SEOs report it working on other pages, but that use is unsupported and not guaranteed. For ordinary pages such as blog posts, submit a sitemap instead.
What is the daily quota for the Google Indexing API?
Sources give different defaults, 200 and 100 requests per day per property. The figure varies by project, so check the quota page in Google Cloud Console for your own limit. In your script, handle HTTP 429 responses by stopping the run or backing off before you retry.
How do I submit many URLs at once with the Indexing API?
Loop over your URL list and send one URL_UPDATED notification per URL, or use the batch endpoint at indexing.googleapis.com/batch. Batching saves HTTP round trips, but each URL still counts against your quota. Batching won’t let you submit more URLs than the quota allows.
Does submitting a URL guarantee Google will index it?
No. A submission is a request, not a command. Google still decides whether to index the page based on its quality and uniqueness, whichever submission method you use.
