Rachel "Rae" Parilla is a twenty-year-old cancer patient who has spent three years in hospitals, losing her hair, her friends, and any chance at a normal future. Her younger sister Alice reads aloud from their favorite fantasy series,
Time of Iron, set in the cursed kingdom of Eyam, built on the edge of a dread ravine filled with fire and the walking dead. Rae harbors a secret: she never paid attention to the first book, zoning out during scenes about the virtuous heroine Lia and devouring the later volumes for the Emperor, a ruthless antihero who rises from obscure origins to rule the world. After a tearful argument with Alice, a mysterious woman reveals Rae's prognosis is terminal and offers a bargain: enter Eyam, pluck the Flower of Life and Death when it blooms in the imperial greenhouse, and wake cured. If she fails, she never wakes. Rae steps through the hospital door into light.
She awakens in the body of Lady Rahela Domitia, Lia's wicked stepsister, who is locked in her chamber and scheduled for execution. She meets Key, a peasant recently made palace guard after killing ghouls, and Emer, Rahela's resentful longtime maid. Claiming amnesia, Rae proposes a forbidden blood oath: her body weight in gold for a year of loyal service. Key swears; Emer quietly withholds hers. Rae and Key fight to the throne room, where Rae confesses Rahela's crimes but claims the gods granted her prophetic visions. She predicts the arrival of foreign visitors nobody could expect. When a messenger confirms the prophecy, King Octavian grants Rae a conditional pardon as his official prophet.
Rae seeks the Golden Cobra, the Marquis of Popenjoy, a notorious spymaster who reveals he too is from the real world. His name is Eric Mitchell, a boy from New York City struck by a car at fourteen who entered Eyam through the same bargain. Eric built the Cobra identity using foreknowledge from the books. He blackmailed Lord Marius Valerius, a warrior known as the Last Hope, into vouching for him at court to access the greenhouse. Eric's adopted mother was caught trying to pick the Flower and executed; his real-world body has been unconscious too long, and he is effectively dead. He agrees to help Rae if she uses her knowledge to fix the story he fears he broke. She tells him the grim trajectory: Lia assassinated, Marius dying alone, the Cobra killed by Marius's hand. They plan to steal the king's greenhouse key at an upcoming ball and have it copied by a blacksmith in the Cauldron, the city's lawless slum district.
Court life proves dangerous. During a ghoul attack on the courtyard, Key saves Rae and sucks poison from her wound. He also rescues Lia, and Rae assumes this marks the doomed crush the books described. Princess Vasilisa, a foreign dignitary from Tagar attending court for alliance negotiations, loses her bodyguard Karine when a guard fires on Karine for drawing a sword in the king's presence, and Marius discovers evidence someone deliberately baited the ghouls. Octavian tries to kiss Rae in private; she refuses, and he revokes her invitation to the ball.
Rae and Key sneak into the Cauldron, where she learns it is Key's birthday. They share a kiss. Key reveals his devastating history: abandoned as a baby, sold as a child laborer, rescued by an old peasant he loved. When the man died, Key killed the guild that had worked his father to death and burned their hall, earning a mistaken reputation as a hero. Rae sells her dress to buy Key's father a burial stone. Key admits he had planned to kill her for the price of that dress. Rae tells him she already knew.
Rae secures a ball invitation from Lia by offering an enchanted gauntlet. At the ball, Rae and the Cobra create a spectacle while the Cobra lifts the king's keys. Marius spots the theft and chases Eric, catching him and throwing the copied key into the river. Meanwhile, assassins bearing the royal seal attack Rae and Lia on the balcony. Key smashes through the glass doors and kills them. When Key insults Octavian for arriving too late, the king sentences him to fifteen lashes with an enchanted whip. Rae stays silent to preserve her access to the Flower. Octavian transfers his favor to Lia and announces the Queen's Trials, a tournament to choose his bride.
Key heals with suspicious speed. Rae persuades Octavian to reforge the royal sword into the legendary blade Longing for Revenge and warns him of future invasions. At the Trials, no champion volunteers for Lia, so she declares she will fight the chained manticore herself. Rae leaps into the arena beside her, and Emer steals an enchanted battleaxe to join them. When the beast breaks free, the sky turns blood-red, a sign of awakening imperial power. Rae presents Lia as the winner and future queen.
Rae warns Princess Vasilisa that her brother the Ice King will die young, hoping to prevent a future war. Vasilisa departs for her homeland of Tagar with Lord Fabianus Nemeth, a courtier who declares his love for her. But Rae has triggered a worse disaster: Vasilisa's message reveals the Ice King is being poisoned, Tagar blames Eyam, and the full army mobilizes.
When Octavian demands Rae resume her predecessor's arrangement as his favorite, she deflects, and he raises his hand to strike her. Key catches his wrist, punches the king, and shatters the reforged sword with his common blade. Guards overwhelm Key, and Emer is arrested for stabbing a guard with her embroidery needle. Rae obtains the snake bracelet from Lia, a token carrying the king's authority, and uses it to save Emer. For Key, who struck the king, there is no mercy. Octavian forces Rae to deny any feelings for Key to his face. She complies. The king orders Key's throat cut. Key dies looking at Rae.
In their shared grief, Rae tells Emer she is not Rahela but a dying girl from another world. Meanwhile, Marius visits an Oracle, sees visions of Eric's real life, and when ordered to execute the Cobra, kills the royal strike team and swears a blood oath to Eric instead. Eric reveals his Golden Brothel is a hidden refuge for people he saved using his foreknowledge. They flee with refugees as the Tagar army storms the capital and the dead rise from the ravine.
On the night the ravine opens, the Flower blooms. Rae plucks it and a glowing door appears, but she cannot leave while Lia awaits execution in the throne room. She gives the Flower to Lady Horatia Nemeth, a lady-in-waiting whose twin sister Hortensia is dying from ghoul wounds sustained in an earlier attack, to save Horatia's dying sister, then fights through ghouls to free Lia and sends her and Emer through a secret passage. Rae pushes Octavian off the battlements into the ravine and bars herself in the throne room.
The doors crash down. The Emperor enters carrying Octavian's severed head, wearing a crowned death mask. In his iron claw he holds Rae's ruby earring, the one she gave Key at the Night Market. Rae understands at last: The Emperor was never Octavian. The Emperor is Key. The prophecy described a godchild, a figure of divine origin reborn from the abyss, born as a nameless foundling on the ravine's edge. Key healed impossibly fast and lost his power near magic-nullifying stones, signs Rae dismissed because she assumed the hero must be the king, not the peasant guard. His throat cut on royal orders, Key was thrown into the ravine and confronted the First Duke, the ancient being ruling the abyss. He returned transformed, commanding the dead.
The Emperor chains Rae with the Abandon All Hope Diamond, a cursed jewel that binds its wearer, and seats her on the dead queen's throne. He speaks of love in the language of vengeance, the language Rae always romanticized from a reader's safe distance. Trapped in the catastrophe she created, Rae accepts the role of his evil queen, already planning her next scheme.