use env to build endpoint url