With the new REST API, teams can securely rotate secrets automatically and atomically, which is especially useful if you have a lot of repositories, projects, and pipelines to manage. This new REST API was designed to save you time while enhancing your security practices.
For more details on how to begin automating your key rotation, check out our Contexts REST API documentation. If you have any questions, please contact our support team or leave a reply below.
At the moment there isn’t a way to set the restrictions via the API, and you are correct that it can only be done in the UI after the creation of the context.
I will note that when you first create a context there will not be any associated variables, so from a security standpoint not allowing the restrictions at creation shouldn’t be a concern. However, I do know it’s not ideal, especially if you are trying to automate setups.
With that in mind I have added a feature request:
I would recommend adding yourself as a ‘vote’ as you’ll then be automatically notified of any updates from the Product team. I hope that helps clarify and let us know if you need anything else!