Hepu territory was located in the regions of modern coastal Guangxi, southwestern Guangdong, and Hainan.
Hepu Commandery was established in 112 BC, when the Han dynasty annexed the Nanyue kingdom.
In late Western Han period, it had a population of 15,398 households (78,980 individuals) in its 5 counties, namely Xuwen (徐聞), Gaoliang (高涼), Hepu (合浦), Linyun (臨允), Zhulu (朱盧).
The commandery was renamed to Zhuguan (珠官) in 228, while in the reign of Sun Liang the name was changed back.
When Jin dynasty unified China in 280, Cangwu consisted of 6 counties and recorded a population of 2,000 households.