We undertook this study to examine the functional basis for epistasis between endoplasmic reticulum aminopeptidase 1 (ERAP1) and HLA-B27 in experimental spondyloarthritis (SpA). ERAP1-knockout rats were created using genome editing and bred with HLA-B27/human β2 -microglobulin-transgenic (HLA-B27-Tg) rats and HLA-B7-Tg rats. The effects of ERAP1 deficiency on HLA allotypes were determined using immunoprecipitation and immunoblotting, flow cytometry, allogeneic T cell proliferation assays, and gene expression analyses. Animals were examined for clinical features of disease, and tissue was assessed by histology. ERAP1 deficiency increased the ratio of folded to unfolded (β2 m-free) HLA-B27 heavy chains, while having the opposite effect on HLA-B7. Furthermore, in rats with ERAP1 deficiency, HLA-B27 misfolding was reduced, while free HLA-B27 heavy chain dimers on the cell surface and monomers were increased. The effects of ERAP1 deficiency persisted during up-regulation of HLA-B27 and led to a reduction in endoplasmic reticulum stress. ERAP1 deficiency reduced the prevalence of arthritis in HLA-B27-Tg rats by two-thirds without reducing gastrointestinal inflammation. Dendritic cell abnormalities attributed to the presence of HLA-B27, including reduced allogeneic T cell stimulation and loss of CD103-positive/major histocompatibility complex class II-positive cells, were not rescued by ERAP1 deficiency, while excess Il23a up-regulation was mitigated. ERAP1 deficiency reduced HLA-B27 misfolding and improved folding while having opposing effects on HLA-B7. The finding that HLA-B27-Tg rats had partial protection against SpA in this study is consistent with genetic evidence that loss-of-function and/or reduced expression of ERAP1 reduces the risk of ankylosing spondylitis. Functional studies support the concept that the effects of ERAP1 on HLA-B27 and SpA may be a consequence of how peptides affect the biology of this allotype rather than their role as antigenic determinants.