Refactor for api_url