Keeping pet rats and other pets in an apartment is only partially possible. Unsupervised encounters with other species should not occur.
Rats are social pack animals that must always be kept in groups. However, socialization with other animal species is generally not possible! Rats see small rodents such as mice, degus, and hamsters as prey and eat them. Your rats would even nibble through the cage bars at mice, hamsters, and co. when they ran freely in the apartment. For this reason, the different species should remain spatially separated.
Other small mammals such as guinea pigs, rabbits, and chinchillas can be kept in the same room as rats if there is enough space. But here, too, it is strongly discouraged to bring them together (in the run and enclosure)! Chinchillas and rabbits are physically superior to rats and can seriously injure the rodents – if they defend their territory. Rabbits in particular can be very aggressive and defend themselves by scratching and biting. Guinea pigs and rats also do not get along and in the worst-case bite each other bloody.
Cats and dogs usually see rats as prey. Even if a cat “just wants to play” and would not harm the rats, the meeting can mean stress for the rodents. Make sure that your cat has access to the rat room and cage only under supervision. A joint run under supervision may be possible if the rats slowly get to know the cats and the cats show neither aggression nor hunting behavior.
Of course, this is only possible if your rats show no shyness or fear of the cat. The same applies to dogs as to cats. They should not be left unsupervised with rats. If your dog accepts the rats and neither chases nor barks, the animals can be kept together in one apartment. If your dog is absolutely peaceful towards rats, the animals can possibly be allowed to run together under supervision.