Metrics Plugin API key creation

Trying to determine a way to programmatically create the API Key for the metrics plugin. administering over 150+ jenkins instances it would be beneficial to be able to programmatically create the API key instead of having to go through the Jenkins UI Configure System → Metrics → Generate key.
Anyone know of a way to do this programmatically? I can do this for the user API using a crumb and the generateNewToken API call. Just wondering if there is a similar approach with the metrics API key creation?

Hello @nylarthotep and welcome to this community :wave: .

Are you using Jcasc?
I don’t know if that makes sense, but you could maybe try to create one by hand, and see how it is saved via Jcasc…

Thanks for the suggestion and the welcome. I will look into that possibility.
our Jenkins instance’s are built using ansible and yaml files. Perhaps I can capture the creation of the api key when I do it manually and see what actions it actually does when I click the generate api key.