Prerequisites

Step 1: Create Google Cloud Project

  1. Go to Google Cloud Console
  2. Click on project dropdown and select “NEW PROJECT”
  3. Enter project name (e.g., “indexing-api-project”)
  4. Click “CREATE”

Step 2: Enable Google Indexing API

  1. In your new project, navigate to “APIs & Services” > “Library”
  2. Search for “Google Indexing API”
  3. Click on it and then click “ENABLE”
  4. Wait for the API to be enabled

Step 3: Create Service Account

  1. Go to “APIs & Services” > “Credentials”
  2. Click “+ CREATE CREDENTIALS” and select “Service Account”
  3. Enter service account name (e.g., “indexing-api-service”)
  4. Add description: “Service account for Google Indexing API submissions”
  5. Click “CREATE AND CONTINUE”
  6. Skip granting roles (not needed for this API)
  7. Click “DONE”

Step 4: Generate Service Account Key

  1. In the Credentials page, find your service account
  2. Click on the service account name
  3. Go to “KEYS” tab
  4. Click “ADD KEY” > “Create new key”
  5. Select “JSON” as key type
  6. Click “CREATE”
  7. The JSON key file will be downloaded automatically
  8. Rename it to service-account-key.json and place it in the same directory as the script

Step 5: Verify Website Ownership

  1. Go to Google Search Console
  2. Add your property (e.g., https://rkoots.github.io/)
  3. Verify ownership using any available method (HTML file, DNS, etc.)
  4. This step is required for the Indexing API to work

Step 6: Install Dependencies

pip install requests google-auth google-auth-httplib2 google-auth-oauthlib

Step 7: Configure Script

Edit the configuration variables at the top of index.py:

Step 8: Run the Script

python index.py

Important Notes

Troubleshooting

API Response Types

Security Considerations