The settlement was first mentioned in 1218, at which time it was already the district headquarters of the German settlers called by the queen to the Hernád Valley. Later it was a part of Boldogkővár, which was then put in pawn by King Sigismund to the Czudar family at the end of the 14th century.
Several landowners appeared in the 15th century. From among them, the Rozgonyi and the Perényi families distinguished themselves. In 1454 it was mentioned as a market town. Its significance is raised by the fact that it is located close to the main road to Kosice (Hu: Kassa, Slovakia).