Below script may give you some idea, I haven't tried by myself so may require some minor changes
def projectManager = ComponentAccessor.getProjectManager()
def project = projectManager.getProjectObjByKey("KEY")
def versionManager = ComponentAccessor.getVersionManager()
versionManager.createVersion("Version Name", new Date(), new Date()+7, "New Version Description",project.id, null)
Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events