refactors api url