History of Kayasthas
The first historical reference to the term Kayastha, not necessarily related to the modern community, comes from a Mathura inscription of the Kushan emperor Vasudeva I, dated to around 171-172 CE, which records the gift of an image of the Buddha by a Kayastha Śramaṇa. The term also finds mention in an inscription of the Gupta emperor Kumaragupta I, dated to 442 CE, in which prathama-kāyastha (chief officer) is used as an administrative designation. The Yājñavalkya Smṛti, also from the Gupta era, and the Vishnu Smriti describe kayasthas as record keepers and accountants.
Kayasthas are recorded in Brahmanical religious texts from as early as the 7th century, being described a distinct caste with responsibility for writing secular documents and keeping records. In some of the Sanskrit works of Kshemendra, in the Vikramankadevacharita of Bilhana and in Kalhana’s historical chronicle known as the Rajatarangini (“River of Kings”), written in the early-medieval Kashmir, the term kayastha may have been used to denote the members of bureaucracy ranging from Gṛhakṛtyamahattama (the chief secretary in the charge of home affairs) to the Asvaghasa-kayastha (officer in charge of the fodder for horses), whose principal duty, besides carrying on the general administration of the state, consisted in the collection of revenue and taxes.
Chitraguptavanshi Kayasthas
The Chitraguptavanshi Kayastha trace their lineage from the Hindu god Chitragupta, who has been tasked to record the karma of human beings. The Chitraguptavanshi Kayasthas of Northern India are named thus because they have a myth of origin that says they descend from the 12 sons of the Hindu god Chitragupta, the product of his marriages to Devi Shobhavati and Devi Nandini. The suffix -vanshi is Sanskrit and translates as belonging to a particular family dynasty.
At least some Chitraguptavanshi subcastes seem to have formed by the 11th or 12th centuries, evidenced by various names being used to describe them in inscriptions. Although at that time, prior to the Muslim conquests in the Indian subcontinent, they were generally outnumbered by Brahmins in the Hindu royal courts of northern India, some among these Kayasthas wrote eulogies for the kings. Of the various regional Kayastha communities it was those of north India who remained most aligned to their role of scribes, whereas in other areas there became more emphasis on commerce.