Added api_endpoint as parameter if needed