该剧改编自星零的小说《帝皇书》。 相传韩帝两家共创大靖,然而十年前,帝家因谋逆获罪,仅余下一名孤女被囚玳山。十年后,一心救下帝家孤女的太子韩烨(龚俊 饰),在前往帝家故里靖南剿灭海贼时,竟遇上一个口口声声非他不嫁的娇俏水匪。女水匪自称任安乐(迪丽热巴 饰),她拿出三万水师,登临京师求聘太子,却又在死缠烂打韩烨的过程中,展现出了过人的才智。只有暗中协助任安乐的刑部尚书洛铭西知道,她就是帝家孤女帝梓元,此来正是为了家族翻案。任安乐连破科举舞弊案、江南水灾案,还与镇边公主安宁打得火热。而韩烨也因两人家国立场的一致,对她心生好感,但此时,任安乐的替身,假帝梓元也回到京城,奉旨参选太子妃,本就阴谋遍布的宫廷,因此陷入了更大的旋涡之中。Di Zi Yuan seeks revenge after her entire family was falsely accused of treason and beheaded under the emperor's edict 10 years ago. As the only survivor, she changes her name to Ren An Le and schemes her way into the palace. While she admires Crown Prince Han Ye's empathy for the common people's welfare and slowly develops feelings for him, she remains haunted by her past and is unable to put behind the enmity between the Di and Han families. Driven by his deep love for Di Zi Yuan, Han Ye vows to resolve their differences at any cost.