updated api with secure tls option