Google Indexing API - 403 'Forbidden Response'

"Make sure that you have added the service account as an Owner in Google Search Console"

Yep. Use the following code snippet to examine the body response for a more detailed error msg.

    var body = result.Content.ReadAsStringAsync().Result;

if the error msg looks like the following, then this is the same problem.

"message": "Permission denied. Failed to verify the URL ownership."

Worth noting: The new version of the search console is lacking. At the bottom of the left-hand menu is a "go to the old version" link. Click this and then select "verification details" from the gear menu (upper right). Next, click on the link that says "verification details" (seriously!). Here, you will finally see a list of verified owners at the bottom of the page. You can add a new owner here, using the email address of your service account (addr can also be found in your json key file).


After couple days of headache, here is the answer. Open your Google search console.

Prerequisite: You must already have a google service account

click the tri dot button, and click manage property owners:

click the tri dot button, and click manage property owners

add google service account email as new owners:

add google service account email as new owners


Adding to @Glennstar's comment and @JMs reply there is no longer the old version link (perhaps I never had the old version) but if you click the 3 vertical dots to the right of user owner '(you)' and select 'manage property owners' then on the next page click each of the 'verification details' links to the right of your domain variations (example.com, http://www.example.com, https://www.example.com etc or whatever you have) and add the owner ie paste in the gserviceaccount.com email address from the json it will then say ownership delegated by current owner to that email address as well.

Once status of that email address had changed from 'full' permission to 'owner' back on the search console page I could then run the call fine and the original 403 error about being unable to verify URL ownership was gone. Thanks guys, would have been clueless without this.