How to get current version of process that is active?

Is there a way instead of hard-coding process version
ProcessApi.getProcessDefinitionId(“ProcessName”,“version”)
Assuming at one time only one version of that process is enabled, previous versions are disabled.
I am using microservice to create flow using ProcessApi, need to deploy everytime I am changing the process version, That is highly costly.
How to do this efficiently?

P.S: I am not connecting to my database from my service, so ruling out that option to fetch from db.
Please provide a better solution for this.
Thanks in Advance.

There could be multiple version of the process activated at the same time, so its not possible to get single active version of the process.

Cheers
Kiran

Maybe getLatestProcessDefinitionId is what you are looking for?

Yes this serves the purpose. Thanks