IL-17A-producing T cells are present in autoimmune cholestatic liver diseases; however, little is known about the contribution of IL-17 to periductal immune responses. Here we investigated the role of IL-17 produced by antigen specific CD8+ T cells in a mouse model of cholangitis and in vitro in human cholangiocyte organoids.K14-OVAp mice express a MHC I restricted ovalbumin peptide sequence (SIINFEKL) on cholangiocytes. Cholangitis was induced by the adoptive transfer of transgenic OVA-specific OT-1 CD8+ T cells that either had OT-1wt or lacked IL-17A/F (OT-1IL17ko). The response of mouse and human cholangiocytes/organoids to IL-17A was assessed in vitro.Transfer of OVA-specific OT-1IL17ko cells significantly aggravated periductal inflammation in K14-OVAp recipient mice, compared to transfer of OT-1wt T cells. OT-1IL17ko T cells were highly activated in the liver and displayed increased cytotoxicity and proliferation. IL-17A/F produced by transferred OT-1wt CD8+ T cells induced upregulation of the inhibitory molecule PD-L1 on cholangiocytes, restricting cholangitis by limiting cytotoxicity and proliferation of transferred cells. In contrast, OT-1IL17ko T cells failed to induce PD-L1 on cholangiocytes, resulting in uncontrolled expansion of cytotoxic CD8+ T cells and aggravated cholangitis. Blockade of PD-L1 after transfer of OT-1wt T cells with anti-PD-L1 antibody also resulted in aggravated cholangitis. Using human cholangiocyte organoids, we were able to confirm that IL-17A induces PD-L1 expression in cholangiocytes.We demonstrate an important function of IL-17 in restricting cholangitis and protecting from CD8+ T cell mediated inflammatory bile duct injury that was mediated by upregulation of PD-L1 on cholangiocytes. Targeting of IL-17, which is an effective treatment for several autoimmune diseases, for the treatment of cholangitis should be undertaken with caution.