This story is told by Janshah, the young man crying between two graves, to the traveller Buluqiya.
King Tighmus of Kabul and the Banu Shahlan is elderly but has no son. Finally he marries the princess of Khorasan and they have a son, Janshah. One day Janshah is out hunting and follows a gazelle away from his group, all the way to the sea, with only six slaves as company. When he tries to return to shore in his boat, he is blown off course. When he lands on an island, his group is attacked by cannibals who can split themselves in two, and three of the slaves are eaten. On anotheer island Janshah finds the crystal palace of Solomon, where a society of apes live. They crown Janshah as their king and he leads them in battle against some ghouls. He finds a tablet left by Solomon with instructions on escaping the land of the apes by passing through the valley of the ants. However, Janshah is the only one to survive the escape.
He reaches the Jewish capital city and learns that the next caravan to Islamic land will not start until the next year. He hears a man call for help and offer a reward, so he volunteers. He gets a good meal, spends the night with a lovely slave girl, and is then taken to a mountain. The man kills a mule and has Janshah hide in the skin. A huge bird picks him up and carries him to the top of the mountain. In its nest, Janshah finds jewels which he throws down to the man. However, the man then leaves him in the nest to starve.
Janshah walks around the mountain and finds a castle, guarded by an old man called Sheikh Nasr, the king of the birds. Janshah is allowed to wait there until a bird can take him home, and is given the keys but told to enter one specific room. However, he can't resist. In the forbidden room he finds a garden and a fountain. Three birds land there, take off their robes of feathers and become beautiful women in order to bathe. When they're done, they fly away again. Janshah is lovesick, and Sheikh Nasr allows him to wait for them to return in a year. The next year, Janshah steals one of the feather robes, trapping the most beautiful of the three girls with him. She agrees to go home with him, and King Tighmus builds her a palace, hiding the feather robe in the foundations. However, the girl, Shamsa, digs it up, puts it on, and flies away. Before she disappears, she tells Janshah that he can prove his love by finding her at Takni, the Castle of the Jewels.
King Tighmus is at war with King Kafid of India. Janshah leaves in secret and goes back to the city of the Jews, where once again he hides in a mule's skin and goes to the top of the mountain. He asks the birds, but none of them have heard of the Castle of the Jewels. The king of the beasts doesn't know either, but the jinn King Shimakh - who was imprisoned by Solomon for disobedience - sends Janshah to a monk and magician. Janshah travels there on the back of a bird with four wings and an elephant's paws. However, the monk doesn't know where Takni is either, but one of the birds has heard that it stands behind Mount Qaf. Janshah goes there and finds it, and is reunited with Shamsa. They marry and live in Takni for two years, but then decide to live in Kabul and Takni for alternating years. The jinn take them to Kabul and they help King Tighmus win the war against Kafid. However, one year when they make their trip, Shamsa is eaten by a shark. Janshah builds a tomb for her and one for himself next to it, and stays there to weep and await his own death.
- The motif of a hero being sewn into an animal hide and carried up a mountain by a bird also appears in Sindbad the Seaman and Hasan of Basra. Hasan of Basra also features the forbidden door and the lost bird-princess.
- In al-Tha'labi's version of The Adventures of Buluqiya, this character is replaced by the Islamic prophet Salih, who is waiting between his parents' graves.