Working in a private apartment is legal, as a self-employed person you do not have to have your apartment approved by an authority.
However, there are different regulations in the different cities as to whether you are allowed to work within or only outside restricted areas. Therefore, you should inform yourself beforehand about the restricted district regulation in your city, where apartment prostitution is permitted.
Ideally, your landlord is informed about your activity. Otherwise you sit on a hot chair: he can give you notice at any time if you have not registered your prostitution with him and have not been approved. A private apartment also poses an increased risk of outsourcing. It is more difficult to separate your private life from your professional life. There are customers who can find out your identity and even publish addresses in free forums. One should be aware of this danger. It would also be good if you let a customer believe that you are not alone in the apartment and that your friend is next door, even if this is not the case.
If you ever have trouble with a customer or even quarrel and you want to throw him out of your apartment, be aware that the neighbors can also notice this. Some sex workers also have a dog to protect themselves better. A dog scares off some customers, you should also be aware of this.
Another point is that you should check in advance whether your apartment is in a restricted area. In many cities like Munich, prostitution is not allowed in the restricted area. Almost every city in Germany, with the exception of Berlin and Rostock, has restricted areas that decide where sex work may and may not be carried out legally. (See chapter 2.2.2 Special regulations)