When Quentin Coldwater killed Ember, the Old Gods took away magic as punishment for killing a god. Several months later, Eliot Waugh petitioned the Great Cock, who gave Waugh and his friends a quest to find the keys and restore magic. After collecting the keys, Coldwater and his friends traveled to Castle Blackspire to reactivate the Wellspring, but were stopped by Alice Quinn, who used magic gained from Fairy Dust to destroy the keys.
However, Julia Wicker sacrificed her magical power as a goddess to forge a new set of keys, allowing Coldwater and his friends to restore magic in the universe.
The story of the keys was told as a tale to young children in Fillory. Most fillorian adults didn't believe it, however, sometimes pirates were said to venture into the After Island in search of it.
In the books, the keys do not have abilities beyond opening the door of The End of the World, and creating random portals which lead the key's holder somewhere they did not wish. This happened to Quentin Coldwater and Julia Wicker, when King Q decided to experiment with the key's abilities. He was sent to Earth directly, not crossing through The Neitherlands. This happened again, when, back in Fillory, Quentin opens a portal for Poppy Kline, in hope that it leads her back home, but instead sends them to the Neitherlands, where they meet Penny.
In the TV show, however, each key was created by the god Prometheus. Using his divine magic he created and imbued each key with powerful magic independent of the wellspring. Each key has a particular magical power, and are able to create portals, usually to send the one who holds them further down the quest to collect all seven keys. The keys are also linked to a children's book with no author, "The Tale Of The Seven Keys". Whenever a key is discovered the book reveals a new chapter that shows the next steps in the quest to acquire all the keys and use them to return magic using the wellspring fountain in Castle Blackspire.
The first key was found by Eliot Waugh, in the After Island. The key was collected from a monk in a village, who tricked the people's village into thinking they were being attacked by a magical monster, and that he was the only one able to fight it by using the key. After the village was attacked and a villager killed in the presence of High King Eliot, he figures out that the key could create illusions of the thing you fear the most and the monk himself was responsible for the deaths in the village. Eliot takes the key from the monk, leaving him to the mercy of the villagers he had been deceiving and killing for so long. Eliot comes to use the keys magic to escape from cannibals in the Neitherlands by sending an illusion of his greatest fear, his father, to distract them. These illusions are incredibly lifelike as the monster created by the monk could create strong winds with the flap of it's wings and Elliot's father began to berate him on his appearance and homosexuality before Eliot convinced him to approach the cannibals.
The second key was collected by Rupert Chatwin in Fillory, and given to his lover when he came back to Earth. The boy quickly understands that the key can reveal hidden truths when he felt compelled to confess his love to Rupert. When his father came into contact with the key he discovered his son's homosexuality and killed him over it, stealing the key. The key was hidden in his house, until Julia Wicker found it through a locator spell. This is one of the most used keys as it is used to see hidden things like Penny, who was stuck in the Astral Plane and communicate with Fairies without making a Fairy Deal. The key also revealed the truth behind Julia's magic spark which originated from Reynard the Fox.
The third key was locked in a difficult puzzle in Fillory, which could only be solved by completing a mosaic that reflected the beauty of all life. The true meaning of the puzzle was to show that the beauty of all life was in living a full life. So the puzzle could only be solved if someone spent their entire life trying to solve it. This Key was used by Jane Chatwin to power her magic pocket watch, and by doing so, using its magic to create the time loops, and the Clock Barrens. Quentin and Elliot were transported into Fillorys past to solve the puzzle and obtain the key. After living out their entire lives Elliot died of old age and an elderly Quentin finally solved the puzzle and obtained the key. Elderly Quentin then passed the key to a young Jane Chatwin who would go on to create the time loops necessary to kill the Beast. Elderly Quentin then sent present day Margo a letter explaining the situation and informing her of the location of the key. Margo then acquired the key after digging up Jane's grave, then prevented Elliot and Quentin from enduring an entire life of trying to solve the puzzle by using the keys magic to travel to earth and stop them moments before they traveled to Fillory's past.
The fourth key was found by Poppy Kline at a dragon breeding ground in Fillory. The key causes the most recent person who touches it with their bare hands to see and hear another version of themselves that only they can perceive. This other version is an amalgamation of all the darkest and most negative parts of that person. Poppy referred to this entity as a "depression monster" that slowly pushes that person to suicide, as such, half of the people traveling with Poppy killed themselves while the rest survived by passing the key back and forth before they died after their ship hit an iceberg. Poppy survived on a life raft and was stuck with the key, having been holding it when her ship sank and no one else to pass it to before being rescued by the Muntjac. The only way to alleviate the keys power is to pass it on to someone else and afflict them with it. The key effects everyone differently as Poppy was able to endure the key much longer than her shipmates by being "A badass about it" stating the others were weak and "couldn't handle it". When holding the key for only a few minutes Benedict Pickwick committed suicide by jumping into the ocean and getting devoured by a dragon. Penny Adiyodi managed to retrieve the key from Benedict in the underworld and send it to the Library's Sattelite Branch where the physical kids retrieved it while being very careful not to allow the key to touch their skin.
The Unity Key was found in possession of a Traumesser who fed on humans joy. This daemon trapped Josh Hoberman, after he was abandoned by his friends, In a parallel dimension where he, Josh and a full group of illusion-made people partied all day in a replica of the Physical Kids' Cottage where party magic was the only magic that worked. Eventually, Quentin, Alice and Kady were teleported to this dimension, by playing a specific piano song that the book, The Tale Of The Seven Keys, revealed to them. Within the demon's pocket dimension, they found the key hidden inside a piano by playing the demon's favorite note, E, and freed Josh from the dimension by using the keys magic which telepathically unified the physical kids across the multiverse allowing them to sing together. After their performance the daemon was fully satiated and released them all from his dimension taking the key with them.
The Vision Key was first mentioned when Josh and Julia are summoned by a Tesla Flexion created by Timeline 23's Josh and Marina. After learning that a key rests around the neck of the Beast in timeline 23 and allows him to keep his magic, Josh and Julia are transported their by another key and intend to kill the Beast and take it. Upon encountering The Beast they learn he is, in fact, Timeline 23's Quentin Coldwater who became the new Beast after timeline 23's Alice resurrected him without his shade. The key also grants him visions of the future and after Julia gave Quentin her shade he tells her of a vision in which he saw Julia, "Opening a lock at the end of the world...and releasing a monster," before killing himself, horrified at the atrocities he committed without his shade. Julia reclaims her shade and the key before returning to Timeline 40 (the current timeline) with her Josh, and Timeline 23's Penny and Marina.
This key lies within the Fairy Realm in Fillory. According to the Fairy Queen, this key was used centuries ago when a large group of Fairies fled from Earth to Fillory to avoid being hunted to extinction for their magic. They escaped to Fillory then used the key to create their own fairy realm within it. The key created and sustained this realm and without it would collapse. After king Margo negotiated a deal with the Fairy Queen, the fairies provided Margo with the key in exchange for a settlement in Fillory where the fairies could live in peace.