Taihō Code
It was established by the Taihō Code of early 8th century. The ministry was replaced in the Meiji period.