It is first attested in Middle Persian spelled as dpyw?n and dyw?n, itself hearkening back, via Old Persian, Elamite and Akkadian, ultimately to Sumerian dub, clay tablet. The word was borrowed into Armenian as well as divan; on linguistic grounds this is placed after the 3rd century, which helps establish the original Middle Persian (and eventually New Persian) form was d?v?n, not d?v?n, despite later legends that traced the origin of the word to the latter form. The variant pronunciation d?v?n however did exist, and is the form surviving to this day in Tajiki Persian.
In Arabic, the term was first used for the army registers, then generalized to any register, and by metonymy applied to specific government departments. The sense of the word evolved to "custom house" and "council chamber", then to "long, cushioned seat", such as are found along the walls in Middle-Eastern council chambers. The latter is the sense that entered European languages as divan (furniture).
The first d?w?n was created under Caliph Umar (r. 634-644 CE) in 15 A.H. (636/7 CE) or, more likely, 20 A.H. (641 CE). It comprised the names of the warriors of Medina who participated in the Muslim conquests and their families, and was intended to facilitate the payment of salary (?a, in coin or in rations) to them, according to their service and their relationship to Muhammad. This first army register (d?w?n al-jund) was soon emulated in other provincial capitals like Basra, Kufa and Fustat. Al-Mughira ibn Shu'ba, a statesman from the Thaqif tribe who was versed in Persian, is credited with establishing Basra's d?w?n during his governorship (636-638), and the d?w?n of the Caliphate's other garrison centers followed its organization.
With the advent of the Umayyad Caliphate, the number of d?w?ns increased. To the d?w?n al-jund, the first Umayyad caliph, Mu'awiya (r. 661-680), added the bureau of the land tax (d?w?n al-khar?j) in Damascus, which became the main d?w?n, as well as the bureau of correspondence (d?w?n al-rasil), which drafted the caliph's letters and official documents, and the bureau of the seal (d?w?n al-kh?tam), which checked and kept copies of all correspondence before sealing and dispatching it. A number of more specialist departments were also established, probably by Mu'awiya: the d?w?n al-bar?d in charge of the postal service; the bureau of expenditure (d?w?n al-nafaq?t), which most likely indicates the survival of a Byzantine institution; the d?w?n al-?adaqa was a new foundation with the task of estimating the zak?t and ?ushr levies; the d?w?n al-mustaghall?t administered state property in cities; the d?w?n al-?ir?z controlled the government workshops that made official banners, costumes and some furniture. Aside from the central government, there was a local branch of the d?w?n al-khar?j, the d?w?n al-jund and the d?w?n al-rasil in every province.
Under Caliph Abd al-Malik ibn Marwan (r. 685-705), the practices of the various departments began to be standardized and Arabized: instead of the local languages (Greek in Syria, Coptic and Greek in Egypt, Persian in the former Sasanian lands) and the traditional practices of book-keeping, seals and time-keeping, only Arabic and the Islamic calendar were to be used henceforth. The process of Arabization was gradual: in Iraq, the transition was carried out by Salih ibn Abd al-Rahman under the auspices of the governor al-Hajjaj ibn Yusuf in 697, in Syria by Sulayman ibn Sa'd al-Khushani in 700, in Egypt under Caliph al-Walid I's governor Abdallah ibn Abd al-Malik in 706, and in Khurasan by Ishaq ibn Tulayq al-Nahshali on the orders of Yusuf ibn Umar al-Thaqafi, governor of Iraq, in 741/42.
Under the Abbasid Caliphate the administration, partly under the increasing influence of Iranian culture, became more elaborate and complex. As part of this process, the d?w?ns increased in number and sophistication, reaching their apogee in the 9th-10th centuries. At the same time, the office of vizier (waz?r) was also created to coordinate government. The administrative history of the Abbasid d?w?ns is complex, since many were short-lived, temporary establishments for specific needs, while at times the sections of larger d?w?n might also be termed d?w?ns, and often a single individual was placed in charge of more than one department.
Caliph al-Saffah (r. 749-754) established a department for the confiscated properties of the Umayyads after his victory in the Abbasid Revolution. This was probably the antecedent of the later d?w?n al-?iy, administering the caliph's personal domains. Similarly, under al-Mansur (r. 754-775) there was a bureau of confiscations (d?w?n al-mudara), as well as a d?w?n al-a?sh?m, probably in charge of palace service personnel, and a bureau of petitions to the Caliph (d?w?n al-ri). Caliph al-Mahdi (r. 775-785) created a parallel d?w?n al-zim?m (control bureau) for every one of the existing d?w?ns, as well as a central control bureau (zim?m al-azimma). These acted as comptrollers as well as coordinators between the various bureaus, or between individual d?w?ns and the vizier. In addition, a d?w?n al-malim was created, staffed by judges, to hear complaints against government officials. The remit of the d?w?n al-khar?j now included all land taxes (khar?j, zak?t, and jizya, both in money and in kind), while another department, the d?w?n al-?adaqa, dealt with assessing the zak?t of cattle. The correspondence of the d?w?n al-khar?j was checked by another department, the d?w?n al-kh?tam. As in Umayyad times, miniature copies of the d?w?n al-khar?j, the d?w?n al-jund and the d?w?n al-rasil existed in every province, but by the mid-9th century each province also maintained a branch of its d?w?n al-khar?j in the capital.
The treasury department (bayt al-m?l or d?w?n al-s?m?) kept the records of revenue and expenditure, both in money and in kind, with specialized d?w?ns for each category of the latter (e.g. cereals, cloth, etc.). Its secretary had to mark all orders of payment to make them valid, and it drew up monthly and yearly balance sheets. The d?w?n al-jahbad?ha, responsible for the treasury's balance sheets, was eventually branched off from it, while the treasury domains were placed under the d?w?n al-?iy, of which there appear at times to have been several. In addition, a department of confiscated property (d?w?n al-mus?dar?n) and confiscated estates (d?w?n al-?iy al-maqba) existed.
Caliph al-Mu'tadid (r. 892-902) grouped the branches of the provincial d?w?ns present in the capital into a new department, the d?w?n al-d?r (bureau of the palace) or d?w?n al-d?r al-kab?r (great bureau of the palace), where "al-d?r" probably meant the vizier's palace. At the same time, the various zim?m bureaux were combined into a single d?w?n al-zim?m which re-checked all assessments, payments and receipts against its own records and, according to the 11th-century scholar al-Mawardi, was the "guardian of the rights of bayt al-m?l [the treasury] and the people". The d?w?n al-nafat played a similar role with regards to expenses by the individual d?w?ns, but by the end of the 9th century its role was mostly restricted to the finances of the caliphal palace. Under al-Muktafi (r. 902-908) the d?w?n al-d?r was broken up into three departments, the bureaux of the eastern provinces (d?w?n al-mashriq), of the western provinces (d?w?n al-maghrib), and of the Iraq (d?w?n al-saw?d), although under al-Muqtadir (r. 908-932) the d?w?n al-d?r still existed, with the three territorial departments considered sections of the latter. In 913/4, the vizier Ali ibn Isa established a new department for charitable endowments (d?w?n al-birr), whose revenue went to the upkeep of holy places, the two holy cities of Mecca and Medina, and on volunteers fighting in the holy war against the Byzantine Empire.
Under Caliph al-Mutawakkil (r. 847-861), a bureau of servants and pages (d?w?n al-maw?l? wa 'l-ghilm?n), possibly an evolution of the d?w?n al-a?sh?m, existed for the huge number of slaves and other attendants of the palace. In addition, the d?w?n al-kh?tam, now also known as the d?w?n al-sirr (bureau of confidential affairs) grew in importance. Miskawayh also mentions the existence of a d?w?n al-?aram, which supervised the women's quarters of the palace.
As the Abbasid Caliphate began to fragment in the 9th century, its administrative machinery was copied by the emergent successor dynasties, with the already extant local d?w?n branches likely providing the base on which the new administrations were formed.
The administrative machinery of the autonomous Tahirid dynasty of Khurasan is almost unknown, except that their treasury was located in their capital of Nishapur. Ya'qub al-Saffar (r. 867-879), the founder of the Saffarid dynasty who supplanted the Tahirids, is known to have had a bureau of the army (d?w?n al-?ar?) for keeping the lists and supervising the payment of the troops, at his capital Zarang. Under his successor Amr ibn al-Layth (r. 879-901) there were two further treasuries, the m?l-e kha, and an unnamed bureau under the chief secretary corresponding to a chancery (d?w?n al-rasil or d?w?n al-insh).
The Buyids, who took over Baghdad and the remains of the Abbasid Caliphate in 946, drew partly on the established Abbasid practice, but was adapted to suit the nature of the rather decentralized Buyid "confederation" of autonomous emirates. The Buyid bureaucracy was headed by three great departments: the d?w?n al-waz?r, charged with finances, the d?w?n al-rasil as the state chancery, and the d?w?n al-jaysh for the army. The Buyid regime was a military regime, its ruling caste composed of Turkish and Daylamite troops. As a result, the army department was of particular importance, and its head, the ?ari? al-jaysh, is frequently mentioned in the sources of the period. Indeed, at the turn of the 11th century, there were two ?ari?s, one for the Turks and one for the Daylamites, hence the department was often called "department of the two armies" (d?w?n al-jayshayn). A number of junior departments, like the d?w?n al-zim?m, the d?w?n al-?iy, or the d?w?n al-bar?d were directly inherited from the Abbasid government. Under Adud al-Dawla (r. 978-983), however, the d?w?n al-saw?d, which oversaw the rich lands of lower Iraq, was moved from Baghdad to Shiraz. In addition, a d?w?n al-khil?fa was established to oversee the affairs of the Abbasid caliphs, who continued to reside in Baghdad as puppets of the Buyid emirs.
The Great Seljuks tended to cherish their nomadic origins, with their sultans leading a peripatetic court to their various capitals. Coupled with their frequent absence on campaign, the vizier assumed an even greater prominence, concentrating the direction of civil, military and religious affairs in his own bureau, the "supreme d?w?n" (d?w?n al-a?l?). The d?w?n al-a?l? was further subdivided into a chancery (d?w?n al-insh wa'l-?ughr?, also called d?w?n al-rasil) under the ?ughr or munsh? al-mam?lik, an accounting department (d?w?n al-zim?m wa'l-ist?f) under the mustawf? al-mam?lik, a fiscal oversight office (d?w?n al-ishr?f or d?w?n al-mumal?t) under the mushrif al-mam?lik, and the army department (d?w?n al-?ar? or d?w?n al-jaysh) under the ?ari? (further divided into the recruitment and supply bureau, d?w?n al-raw?tib, and the salary and land grants bureau, d?w?n al-iq). A number of lesser departments is also attested, although they may not have existed at the same time: the office charged with the redress of grievances (d?w?n al-malim), the state treasury (bayt al-m?l) and the sultan's private treasury (bayt al-m?l al-kha), confiscations (d?w?n al-mudara), the land tax office (d?w?n al-khar?j) and the department of religious endowments or waqfs (d?w?n al-awq?f). A postal department (d?w?n al-bar?d) also existed but fell into disuse. The system was apparently partly copied in provincial centres as well.
Following the Ottoman conquest of North Africa, the Maghreb was divided into three provinces, Algiers, Tunis, and Tripoli. After 1565, administrative authority in Tripoli was vested in a Pasha directly appointed by the Sultan in Constantinople. The sultan provided the pasha with a corps of Janissaries, which was in turn divided into a number of companies under the command of a junior officer or Bey. The Janissaries quickly became the dominant force in Ottoman Libya. As a self-governing military guild answerable only to their own laws and protected by a Divan (in this context, a council of senior officers who advised the Pasha), the Janissaries soon reduced the Pasha to a largely ceremonial role.
The Divan-? Hümayun or Sublime Porte was for many years the council of ministers of the Ottoman Empire. It consisted of the Grand Vizier, who presided, and the other viziers, the kadi'askers, the nisanci, and the defterdars.