The present invention relates to 3-substituted-1,2,4-oxadiazole and thiadiazole compounds of formula (I) or formula (II) and their use to inhibit the programmed cell death 1 (PD-1) signaling pathway and/or for treatment of disorders by inhibiting an immunosuppressive signal induced by PD-1, PD-L1 or PD-L2.