Remotly update Jenkins X.509 credential

Hello there,
I want to remotely (programatically) update Jenkins X.509 client certificate credentials.
My use case : I have a job to update Docker API certificates and want to update the credentials in Jenkins at the same time.
I tried with Jenkins Rest API. I can create or update a X.509 client certificate credential providing an xml file I create, but the certificates are jumbled once created. Basically I’m not able to send the return lines for ca and cert and the key content is not right neither (should it be encoded ?).
Any hint welcome. Since it’s a work in progress, I can even use another method. Only limitation, I have only access remotely to Jenkins. I can’t touch the filesystem.