A heterocyclic derivative represented by formula (I) or a pharmaceutically acceptable salt thereof, which has an inhibitory effect on activation of STAT3 protein and is useful for prevention or treatment of diseases associated with activation of STAT3 protein Salt or stereoisomer.STAT3タンパク質の活性化に対して阻害効果を有し、STAT3タンパク質の活性化と関連する疾患の予防または処置に有用である、式(I)により表されるヘテロ環式誘導体またはその薬学的に許容される塩もしくは立体異性体。