Link to Koubou Daishi
Toji is a temple built by the government built upon the transfer of the Heiankyo capital. There were 2 temples built on the east, the east temple Toji, and the west temple Saiji to protect the capital. After the transfer under Emperor Kanmu, and later Emperor Saga appointed Koubou Daishi Kukai in charge of Toji. This made Toji the root training ground to the Shingon Esoteric Buddhism. Kukai immediately undertook the structuring of the main hall and temple. The 5-towered pagoda currently regarded as the symbol of Kyoto was also built at this time, 1200 years ago. Toji had experienced numerous natural disasters and had been restored the same amount of times, though the layout of the buildings are more or less the same as Kukai had planned.
Temple Remaining from Heiankyo
During times when battles between the Genji and Heishi became intense towards the end of the Heian period, Toji and Saiji both declined in power. Saiji unfortunately was never restored but Toji was restored by Unkei during the Kamakura period. Although going through multiple times of confusion, it is the only temple that still remains from the days of Heiankyo in the present.