updated api to support secret keys