At some point, Cui Hang passed the imperial examinations in the Jinshi class, although when he did so is not known.
After Emperor Yizong died in 873 and was succeeded by his son Emperor Xizong,[REF] Cui Hang was moved closer to the capital, to be the prefect of Yong Prefecture (永州, in modern Yongzhou, Hunan).