Heian was undefended. The Rashomon gate was flanked by a few tens of metres of wall - and the rest of the city perimetre, 20 km or so, was merely demarcated with something like a pair of shallow ditches.

How serious were the defences of provincial capitals?

Tagajo was a real defensive work against Emishi. Something like over 3 km perimetre wall. It WAS sacked and burned by Emishi - once, in 780.

How effectively was Tagajo defended against this kind of attacks? It failed once - did it successfully repel any other attacks?

How high and steep was the Tagajo wall, for a serious raiding party seeking to storm and penetrate any undermanned stretch of the defences? And how many gates were in the wall to try to break down?

And how about the other provincial capitals?

Akitajo was a similar fortress against Emishi. Dazaifu was a fortified headquarters against a Chinese or Korean invasion, that never came.

Japan had over 60 provincial capitals (kokufu). All of them had the rectangular plan, and the typical size seems to have been 700...900 m a side.

How many were fortresses like Tagajo? Were there any that were completely unfortified, like Kyoto was?