The Ratirahasya is a medieval Indiansex manual written by Kokkoka, a poet, who is variously described as Koka or Koka Pundit. The exact date of its writing is not known, but it is estimated the text was written in the 11th or 12th century. It is speculated that Ratirahasya was written to please a king by the name Venudutta. Kokkoka describes himself in the book as siddha patiya pandita, i.e. "an ingenious man among learned men". The manual was written in Sanskrit. Unlike the Kama Sutra, which is an ancient sex manual related to Hindu literature, Ratirahasya deals with medieval Indian society. During the medieval age, India became more conservative compared to ancient India, freedom of women decreased, and premarital and extramarital sex were frowned upon. A sex manual was needed that would be suitable for the medieval cultural climate, and Ratirahasya was written, quite different from the ancient text Kama Sutra. There are fifteen pachivedes and 800 verses in Ratirahasya which deal with various topics such as different physiques, lunar calendar, different types of genitals, characteristics of women of various ages, hugs, kisses, sexual intercourse and sex positions, sex with a strange woman, etc. Kokokka describes various stages of love inRatirahasya, the fifth stage being weight loss, the ninth is fainting, and the tenth and last stage is death. Ratirahasya makes classifications of women, and describes erogenous zones and days that lead to women's easy arousal. Ratirahasya is the first book to describe in detail Indian feminine beauty. The book classified women into four psycho-physical types, according to their appearance and physical features.
On the basis of the size of the genitals, the text classifies sexual intercourse into nine different types. Aphrodisiacs are also described in the book. According to W.G. Archer, Kokkoka "is concerned with how to make the most of sex, how to enjoy it and how to keepa woman happy." In writing this text, Kokokka depended on a number of other authors including, among others Nandikeshvara, Gonikaputra, and Vatsyayana. Arabic, Persian and Turkish translations of the book are entitled Lizzat-al-Nissa. Alex Comfort, author of The Joy of Sex, made an English translation of Ratirahasya in 1964 titled The Koka Shastra, Being the Ratirahasya of Kokkoka, and Other Medieval Indian Writings on Love. Another English translation was made by S. C. Upadhyaya, entitled Kokashastra of Pundit Kokkoka. Some commentaries have been written on this text by Avana Rama Chandra, Kavi Prabhu, and Harihara. It is a popular text in India, second only to the Kama Sutra among sex manuals.