In 1492, the Venetian Bailo in Constantinople, Girolamo Marcello, was expelled on the charge of espionage. The post remained vacant, and Gritti assumed the task of representing Venice at the Ottoman court. Lacking an official appointment, however, his position was precarious, especially as, with another Ottoman–Venetian conflict looming in 1499, he used his commercial correspondence, sent via Corfu and the Ragusan merchant Nicolò Gondola, to transmit encoded information to the Venetian Senate regarding the movements of the Ottoman navy (referred to as "carpets" in one letter) and troop concentrations. This activity did not remain hidden from the Turks for long, however: after capturing couriers bearing Gritti's letters, in August 1499 he was imprisoned in the Yedikule Fortress, escaping execution only through his friendship with the grand vizier. According to contemporary reports, his imprisonment caused great consternation among his many friends—including Turks—at the Ottoman capital, as well as the many women who were enamoured of him.