Heterocyclic compounds that modulate C3a receptors and their use in the treatment or prevention of inflammatory diseases, infectious diseases, cancers, metabolic disorders, obesity, type 2 diabetes, metabolic syndrome and associated cardiovascular diseases are described. The use of the compounds in stimulating or suppressing an immune response is also described together with pharmaceutical compositions comprising the compounds or their pharmaceutically acceptable salts.