Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Indexing API 403 & Permission Errors Fix

· 5 min read · Home Tech

In this article
  1. What Causes 403 and Permission Errors
  2. Prerequisites for Using the Indexing API
  3. Step-by-Step Fix for 403 Errors
  4. Common Mistakes and Misconceptions
  5. How to Test Your Setup
  6. Alternatives When the API Isn't Right
  7. Frequently Asked Questions

Google Indexing API 403 and permission errors mean your service account lacks the right role or the API isn't enabled, and you'll fix it by granting the Indexing API Service Agent role and verifying ownership. This article walks through the exact steps to resolve these errors, explains why they happen, and covers common pitfalls.

What Causes 403 and Permission Errors

The Indexing API lets you notify Google about new or updated pages, but it's strictly limited to job posting and broadcast event structured data. A 403 error means the request was understood but refused—typically because the service account doesn't have the required role, the API isn't enabled, or the property isn't verified. Permission errors often appear as Permission denied or User does not have sufficient permissions in the response body.

Common root causes:

  • Service account missing the Indexing API Service Agent role in Google Cloud Console.
  • The Indexing API not enabled for the project.
  • The property (website) not verified in Google Search Console.
  • The service account email not added as an owner in Search Console.
  • Using the wrong OAuth scope or not including the service account key file correctly.

Prerequisites for Using the Indexing API

Before troubleshooting, ensure you have:

  1. A Google Cloud project with billing enabled (the API is free but requires a project).
  2. The Indexing API enabled in the API Library.
  3. A service account created and its JSON key downloaded.
  4. Ownership (not just full user) of the property in Google Search Console.
  5. The service account email added as a user in Search Console (with full permission).

Without all these, you'll likely see 403 errors. The most overlooked step is adding the service account to Search Console—it's separate from the Cloud role.

Step-by-Step Fix for 403 Errors

Follow these steps in order. Most 403s resolve after step 3 or 4.

  1. Enable the API: Go to Google Cloud Console → APIs & Services → Library → search for "Indexing API" → click Enable.
  2. Create a service account: APIs & Services → Credentials → Create Credentials → Service Account. Give it a name and assign the role Indexing API Service Agent (or create a custom role with indexing.publish permission).
  3. Generate a key: In the service account's details, go to Keys → Add Key → Create New Key → JSON. Download and store securely.
  4. Add to Search Console: Open Google Search Console → select your property → Settings → Users and permissions → Add User → enter the service account email (e.g., your-sa@project.iam.gserviceaccount.com) with Full permission.
  5. Verify ownership: If the property isn't verified, do that first. The service account can't be added to an unverified property.
  6. Test with a simple script: Use a small Python script to send a test request. If you get 200, you're set.

If you still get 403 after these steps, check that the service_account_file path is correct and that the OAuth scope is https://www.googleapis.com/auth/indexing.

Common Mistakes and Misconceptions

Many developers confuse the Cloud IAM role with Search Console permissions. The service account needs both the API role in Cloud and being a user in Search Console. Another misconception is that the Indexing API works for any page—it doesn't. Only pages with JobPosting or BroadcastEvent structured data are accepted. Sending regular URLs will result in a 400 error, not 403, but it's still a common roadblock.

Also, note that the service account email is not the same as your personal Google account. You must add the service account email (ending in @project.iam.gserviceaccount.com) to Search Console, not your own email.

How to Test Your Setup

Use a simple HTTP request to verify. Here's a Python example using the google-auth and requests libraries:

from google.oauth2 import service_account
from google.auth.transport.requests import AuthorizedSession

SCOPES = ['https://www.googleapis.com/auth/indexing']
credentials = service_account.Credentials.from_service_account_file('key.json', scopes=SCOPES)
session = AuthorizedSession(credentials)

url = 'http://example.com/page'
payload = {'url': url, 'type': 'URL_UPDATED'}
response = session.post('https://indexing.googleapis.com/v3/urlNotifications:publish', json=payload)
print(response.status_code, response.text)

If you get 200, the setup is correct. If you get 403, re-check the steps above. If you get 404, the URL is malformed or the property doesn't match.

Alternatives When the API Isn't Right

If you can't resolve the 403 or your content isn't eligible, consider alternatives:

  • Use the URL Inspection tool in Search Console to manually request indexing (limited quota).
  • Submit a sitemap—Google will crawl it eventually.
  • Ensure your pages have proper internal links to help discovery.
  • For job postings, consider using schema.org markup and a sitemap; the API is just a faster notification.

Remember, the Indexing API doesn't guarantee indexing—it just notifies Google. If your pages are low quality or blocked by robots.txt, they may still not be indexed.

Frequently Asked Questions

Why do I get 403 even though I added the service account to Search Console?

Double-check that the service account email is spelled exactly (including the @project.iam.gserviceaccount.com suffix) and that you have Full permission, not restricted. Also, ensure the property is verified—if you only have pending verification, the user won't be accepted.

Can I use the Indexing API for all my pages?

No. The API only accepts URLs with JobPosting or BroadcastEvent structured data. Other URLs will return a 400 error. For regular pages, use sitemaps and URL Inspection.

What is the difference between 403 and 400 errors?

403 means authentication/permission failure—your request is valid but not allowed. 400 means bad request—the URL isn't eligible, or the payload is malformed. Both require different fixes.

Do I need to enable billing for the Indexing API?

Yes, you need a Google Cloud project with billing enabled, but the Indexing API itself is free. Billing is required for all API usage in Cloud, even free ones.

How long does it take for Google to process the notification?

Usually within a few days, but it's not guaranteed. The API just sends a notification; Google decides when to crawl. You can check the URL Inspection tool for status.

Can I use a service account from another project?

Yes, as long as the API is enabled in that project and the service account has the correct role. You must also add that service account to Search Console. It doesn't have to be the same project as the website.