According to the job class system of the Edo bakufu, the oniwaban was one of the Hiroshiki officials (inner apartment supply officers for Edo-jo Castle) which were organized with only men and belonged to Ooku, the harem of shogun.
御庭番は江戸幕府の職制では大奥に属する男性の職員である広敷役人のひとつである。