The consent of your ex-spouse is necessary for the sale of a joint apartment, we assume that you acquired the apartment during the marriage and is therefore part of the so-called joint ownership of spouses (BSM). It is not clear from your question whether the property has already been settled since your divorce or not, and also how much time has passed since the divorce decision became final.
If more than three years have passed since the divorce, your share in the apartment is considered joint ownership. In this case, you can conclude a purchase contract in which you transfer your share in the apartment to the buyer. This contract must be in writing, as it relates to immovable property, and rights are acquired only after registration in the land register. You can agree on the related fees for cadastral proceedings with the buyer in the contract.
If you need legal assistance in drafting a contract, I recommend contacting a lawyer.
