The first historical reference to Zhang Xi's own career as an official was in 700, during the reign of Emperor Gaozong's wife Wu Zetian, when Zhang Xi was serving as the deputy minister of civil service affairs. On that occasion, Zhang Changyi, the brother of Wu Zetian's lovers Zhang Yizhi and Zhang Changzong, had received a bribe from a reserve official with the surname of Xue to ask to be given an actual commission. Zhang Changyi took the bribe and his certificate of reserve commission and gave the certificate to Zhang Xi, ordering him to find a position for the man. Several days later, Zhang Xi found that he had misplaced the certificate, and he met Zhang Changyi to ask him what to do—to which Zhang Changyi replied, "How am I supposed to remember what his name was? The only way to salvage the situation is to give a commission to everyone named Xue." Zhang Xi, in fear, left Zhang Changyi's presence, and gave commissions some 60 reserve officials named Xue. Later in 700, Zhang Xi was made Fengge Shilang, the deputy head of the legislative bureau of government and given the designationTong Fengge Luantai Pingzhangshi, making him a chancellor de facto. At that time, Zhang Xi's nephew Li Jiao was already serving as chancellor, and as Wu Zetian did not want both uncle and nephew to serve as chancellors simultaneously, she removed Li Jiao from his office, but it was still regarded as a great honor to the family at the time to have him succeed his nephew. He continued to serve in the capacity as selector of officials, along with Zheng Gao. In 701, Zhang Xi was accused of revealing palace secrets and accepting bribes, and he was set to be executed. At the time of his arrest, he rode a horse to the jail for high-level officials, and continued, once there, to enjoy luxurious meals, while another chancellor who was also arrested, Su Weidao, slept on a mat on the floor and ate very simple meals. When Wu Zetian heard this, she released Su and returned him to office, while setting an execution date for Zhang Xi, but at the last moment spared him and exiled him to Xun Prefecture.
After Wu Zetian's reign
Wu Zetian was overthrown in a coup in 705, and her son Li Xian the Crown Prince, formerly emperor, was restored to the throne. Sometime during Emperor Zhongzong's reign, Zhang Xi was recalled to serve as the minister of public works and was also in charge of editing imperial histories, and was eventually put in charge of the eastern capital Luoyang. In 710, Emperor Zhongzong suddenly died—a death that traditional historians believed to be a poisoning carried out by his powerful wife Empress Wei and daughter Li Guo'er the Princess Anle, so that Empress Wei could become "emperor" like Wu Zetian did and that Li Guo'er could become crown princess. Meanwhile, though, Emperor Zhongzong's son by a concubine, Li Chongmao the Prince of Wen, was made emperor, with Empress Wei retaining power as empress dowager and regent. She conferred on Zhang Xi the designation of Tong Zhongshu Menxia Sanpin, again making him chancellor de facto, but had him remain in charge at Luoyang. Less than a month later, she and Li Guo'er were killed in a coup led by Emperor Zhongzong's sister Princess Taiping and nephew Li Longji the Prince of Linzi, and Li Longji's father Li Dan the Prince of Xiang, himself a former emperor, was restored to the throne. Emperor Ruizong demoted all of the chancellors that Empress Dowager Wei had commissioned, and Zhang Xi was demoted to be the prefect of Jiang Prefecture. Sometime after that, he was created the Duke of Pingyuan, and died after his retirement, but the date of his death is not known.