The yin 尹 was the highest civilian official of the administration of the capital city. Because the seat of the capital changed over time, the office was called Jingzhao yin 京兆尹 (for Chang'an 長安, modern Xi’an 西安, Shaanxi), Henan yin 河南尹 (for Luoyang 洛陽, Henan) or Danyang yin 丹陽尹 (for Danyang, Jiangsu). Durning the Five Dynasties period 五代 (907-960) the highest administrators of important prefectures were also given the title of yin, like Fengxiang fu yin 鳳翔府尹, Chengdu fu yin 成都府尹 or Jiangling fu yin 江陵府尹, a custom that was adhered to during the Song 宋 (960-1279), Liao 遼 (907-1125), Jin 金 (1115-1234) and Yuan 元 (1279-1368) periods. During the Ming period 明 (1368-1644), only the heads of the prefectures of Yingtian 應天 (modern Nanjing 南京, Jiangsu) and Shuntian 順天 (modern Beijing) were called yin, during the Qing period 清 (1644-1911) those of Shuntian and Fengtian 奉天, with an official rank 3A.
In earlier times the term yin was used for a wide variety of offices. During the Shang period 商 (17th-11th cent. BCE) the yin had the specialized task to supervise the opening of new fields or construction work by labour recruits. During the Western Zhou period 西周 (11th cent.-770 BCE) the yin was entrusted with ritual matters like handling edicts and proclamations, or managing certain offerings.