You can use api.system.bat.get() API. But this is designed to work on the RAK3172 Evaluation Board. This board is based on WisBlock Base board and has built-in voltage divider.
You can also try to use analog read directly and choose on two analog inputs of RAK3172.
We have example code for the Analog read.
You can change ADC1 or ADC2 via WB_A0
or WB_A1
respectively.