Search code examples
javascriptnode.jsgoogle-search-console

Error: You do not own this site, Google Search Console API


I keep receiving the error:

'Error: You do not own this site, or the inspected URL is not part of this property.'

when trying to inspect a URL using the Google Search Console API although I am the verified owner of the domain.

I am able to list sites with my credentials without issue.

My code:

app.get("/inspecturl", (req, res) => {
  searchconsole.urlInspection.index.inspect(
    {
      siteUrl: "sc-domain:my-domain.co.uk",
      inspectionUrl: "www.my-domain.co.uk",
    },
    (err, response) => {
      if (err) return res.status(500).send(`Error: ${err}`);
      res.send(response.data);
    }
  );
});

Solution

  • I found the issue, when inspecting the root domain, the inspectionUrl provided must end with a '/'