Gleim came to Halberstadt in 1747 to take up the post of cathedral secretary. As such, he was responsible for the financial and legal affairs of the cathedral chapter. He lived in the house next to Halberstadt Cathedral, now the Gleim House, for over 50 years.