The present invention provides heterocyclic derivatives which activate the IP receptor. Activating the IP receptor signaling pathway is useful to treat many forms of PAH, pulmonary fibrosis and exert beneficial effects in fibrotic conditions of various organs in animal models and in patients. Pharmaceutical compositions comprising such derivatives are also encompassed.