"Female officials" (nüguan 女官) or court ladies were seen in the imperial palaces of all imperial dynasties. Parts of them were secondary consorts and concubines, but most of them were appointed to specific tasks in the management of the private quarters of the imperial palace. According to the ancient ritual classic Zhouli 周禮, the women were during the Zhou period 周 (11th. cent.-221 BCE) subordinated to the Ministry of State (tianguan 天官) and were classified into the ranks of the Nine Concubines (jiupin 九嬪), hereditary consorts (shifu 世婦), secondary concubines (nüyu 女御), female supplicants (nüzhu 女祝), and female scribes (nüshi 女史). There were also a lot of female craftspersons in the palace, like winemakers, soy sauce makers, pickle makers, tailors, and so on.
The Qin dynasty 秦 (221-206 BCE) gave up these designations and introduced the Six Matrons (liushang 六尚) supervising the service for headgear (shangguan 尚冠), the service for wardrobe (shangyi 尚衣), the service for food (shangshi 尚食), the service for bathing (shangmu 尚沐), the service for furniture (shangxi 尚席), and the service for writing (shangshu 尚書). There were 14 ranks of female officials during the Han period 漢 (206 BCE-220 CE):
|昭儀||zhaoyi||Lady of Bright Deportment|
|婕妤||jieyu||Lady of Handsome Fairness|
|娙娥||xing'e||Lady of Graceful Beauty|
|傛華||ronghua||Lady of Lovely Countenance|
|充依||chongyi||Lady of Complete Deportment|
|長使||zhangshi||Senior Palace Woman|
|少使||shaoshi||Junior Palace Woman|
|五官||wuguan||Lady for Miscellenous Uses|
|順常||shunchang||Lady of Complaisant Constancy|
|無涓||wujuan||Lady Without Impurity|
To these were during the Later Han period 後漢 (25-220 CE) added the ranks of Lady of Reverent Gentleness (gonghe 共和), Lady who Pleases the Spirit (yuling 娛靈), Lady who Could Comfort a Multitude (baolin 保林), Lady of Excellent Employment (liangshi 良使) and Lady for Night Attendance (yezhe 夜者).
The short-lived Later Zhao dynasty 後趙 (319-350) increased the ranks to 18, later 24. This is somewhat different from the male officials that were ranked into nine ranks (jiupin 九品), each with a half-rank, resulting in 18 ranks.
Terminology changed under the early years of the Tang dynasty 唐 (618-907) which made use of 19 ranks of palace women (neiguan 内官) namely:
|昭儀||zhaoyi||Lady of Bright Deportment||1||2A|
|昭容||zhaorong||Lady of Bright Countenance||1||2A|
|昭媛||zhaoyuan||Lady of Bright Beauty||1||2A|
|修儀||xiuyi||Lady of Cultivated Deportment||1||2A|
|修容||xiurong||Lady of Cultivated Countenance||1||2A|
|修媛||xiuyuan||Lady of Cultivated Beauty||1||2A|
|充儀||chongyi||Lady of Complete Deportment||1||2A|
|充容||chongrong||Lady of Complete Countenance||1||2A|
|充媛||chongyuan||Lady of Complete Beauty||1||2A|
|婕妤||jieyu||Lady of Handsome Fairness||9||3A|
|才人||cairen||Lady of Talents||5||5A|
|寳林||baolin||Lady of Precious Bevy||27||6A|
|采女||cainü||Lady of Elegance||27||8A|
Emperor Xuanzong 唐玄宗 (r. 712-755) added the 1A-ranks of Gracious Consort (huifei 惠妃), Elegant Consort (lifei 麗妃) and Splendid Consort (huafei 華妃).
In the palace service (gongguan 宮官 "palace officials") were 24 directresses (si 司, rank 3A), 24 managers (dian 典, rank 6A) assisting them, and 24 handlers or leaders (zhang 掌, lower official ranks) in the third line. They were grouped into the general palace service (shanggong 尚宮), ceremonial service (shangyi 尚儀), wardrobe service (shangfu 尚服), food service (shangshi 尚食), housekeeping service (shangqin 尚寢) and workshops service (shanggong 尚功), each section thought as a parallel to the six ministries (liubu 六部) and headed by one of the six matrons (liushang, rank 3A). Accordingly, each of the six services was divided into four offices headed, for instance, by the directress of records (siji 司記), directress of communications (siyan 司言), directress of registration (sipu 司簿), directress of inner gates (siwei 司闈), directress of the library (siji 司籍), directress of music (siyue 司樂), directress of visitors (sibin 司賓), directress of ritual receptions (sizan 司贊), directress of seals (sibao 司寳), or the recorder of imperial intercourse (tongshi 彤史). The four consorts and nine concubines were not integrated into this service structure. The consorts had the task of advising the empress (huanghou 皇后), like the counsellors deliberated political matters with the emperor. The nine concubines were used for the ritual instruction of all palace women. The "Beauties" (meiren) handled offerings and the reception of guests. The Ladies of Talent (cairen) arranged the banquets, the ceremonial silk spinning, and received the tributes to the empress.
A similar system was used for the women of the households of princes with two Related ladies of excellence (liangdi 良娣, rank 3A), six *Filial ladies of excellence (liang'ai 良嬡, rank 4A), ten Ladies of inherent excellence (chenghui 承徽, rank 5A), 16 Ladies of clear instruction (zhaoxun 昭訓, rank 7A) and 24 Ladies of decorous service (fengyi 奉儀, rank 9A), each of them managing the various offices of their domain.
The Ming dynasty perpetuated this system of the six services with the service bureaus (liuju 六局). Female officials were to be selected after a kind of examination with the degree of "cultivated talent" (nü xiucai 女秀才).
There were in total 187 positions to be occupied. Girls serving in the palace were allowed to return to their parents after five or six years, in order to await marriage. Service in the imperial palace greatly raised the "value" of a girl ready for marriage. The tasks of the palace women were from the Yongle reign-period 永樂 (1403-1424) on exclusively managed by eunuchs, except that of seal-keepers (liu sibao 留司寶, zhangshou zhu baoxi 掌收貯寶璽).