1

I would like to programmatically submit new sitemaps to Google Search Console. I found that it can be done with Google Search Console API.

However, in this docs they say that request require authorization with the scope https://www.googleapis.com/auth/webmasters. I can not find anywhere how can I create an API key with this permission, that I can use to authenticate my server with Google Search API.

Should I create this from Google Admin Console or somewhere inside Google Search Console?

1 Answer 1

1

I know you are looking for an API, but a super simple way to do it, without needing an API, is by using a Sitemap Index File.

The code is very simple:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://www.example.com/sitemap1.php</loc></sitemap>
<sitemap><loc>https://www.example.com/sitemap2.php</loc></sitemap>
<sitemap><loc>https://www.example.com/sitemap3.php</loc></sitemap>
</sitemapindex>

Since this file exists on your server, you can generate it dynamically and keep it updated. You need to only submit it once to Google, and they will download it regularly.

1
  • I actually need an API because I am not submitting the sitemap for my website.
    – NeNaD
    Nov 12, 2022 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.