The main building of the Shirvanshahs’ Palace adjoins Divankhana, a small fine pavilion situated inside a small yard surrounded by a gallery-arcade on three sides. The Divankhana pavilion consists of an octahedral hall covered with a stone cupola both inside and outside. It adjoins a rectangular apartment of the vestibule. Inside the apartment the vestibule is linked with the entrances into the gallery-arcade, into the hall and beneath the floor of the hall into an octahedral chamber under which there is a second chamber of a rectangular shape in the dungeon as an entrance of which serves an opening on the ground level to the north side. In the rock serving as a basis for the second chamber there is a mouth of a five-metre deep well. The functional purpose of these two chambers as well as that of the entire apartment remains unknown as a whole.
The well-proportioned high portal of the main entrance is decorated with an ornament and inscriptions of extraordinary refinement and beauty. The ornament pictures the interlacing fig and vine leaves. Besides this, the portal is decorated with two medallions inside of which there are inscriptions in the Arabic language in graphic print of Cufa. To an unfamiliar viewer it seems only as a mere ornament.
The architectural composition and planning of Divankhana are original and do not have analogues in the other Oriental countries. The construction of Divankhana was not finished which is testified by the incompleteness of the ornamentation of the capitals and the bases of the colonnade and other details of the building. The construction of the building might have been stopped in connection with the military developments of 1500-1501. The features of the style and the partial incompleteness of the decoration work date Divankhana back to the end of the XV century.
There are different opinions related to the purpose of Divankhana. Some think that it was a trial place, justice being carried out in its cupola hall with a round opening in the middle of the stone floor. Following the pronouncement of death sentence the head of the criminal was chopped off by an executioner directly above that opening, and the body of the executed was floated into the sea through certain underground channels.
Others suggest that it served for legal proceedings, receptions or state councils or was a mausoleum. In the XIII-XV centuries the financial department was headed by a sahib-divan. The Divankhana pavilion under the domination of the Shirvanshahs might have been the lodging of the sahib-divan, of his functionaries and the treasury itself. The mysterious opening in the cupola, covering the chamber, coming out in the centre of the octahedral hall was apparently made later, perhaps during the developments of 1501, during the seizure of the city by the Safavis and the ravage of the palace in search of the treasury. The Safavis were said to have discovered a lot of gold and valuables in the cupola of the pavilion.
A mausoleum version is also possible. This is proved by the existence of a two-chamber vault in its dungeon and Surah from the Koran on the portal of the entrance: “The God calls to the abode of the world and leads whomever he desires to a true path… This is the abode of the paradise where they stay forever.” It is curious that in the surviving legends the entire territory of Divankhana, especially the underground chamber with a well called a milky well was considered a holy place where the women who had lost their milk were healed. The territory occupied by Divankhana and the palace must have been a holy place back in the pre-Islamic period.