oh sorry my bad for suggesting wrong steps. I wasn't attentive.
I had a same situation earlier. I solved it using Jose's method. I had to install ssl to a subdomain who basedir is api folder under primary domains root folder as the developers wanted to run api on subdomain and they didnt wanted to change the folder path. There are lots of ways to do that but you know developers, they want what they want.