Can I exclude pages from the site map without using an app?

I have products I have added noindex to. The reason for this is that they are “dummy products”. They are products of variants of the same product and simply redirect to a main product with that variant selected. So I added noindex to these as otherwise it would appear that I was trying to do something dodgy with the pages other than their real purpose which is to improve user experience.

now that I have these pages set with noindex, they currently still exist in the sitemap so Google sees them as being set to noindex as an error. It’s no great big deal but I would like to wrap up the logic by having them removed from the sitemap.

as I set the noindex using a tag on the product, can I run the admin api on the product template code based on this tag in the same way and auto set the product of accordingly? Is this how you run the admin api as a script in the store code?