BackgroundEvidence indicates that physical activity reduces stress and promote a myriad of health-enhancing effects through anti-inflammatory mechanisms. However, it is unknown whether these mechanisms interfere in the association between psychosocial job stress and headache disorders. ObjectiveTo test whether physical activity and its interplay with the systemic inflammation biomarkers high-sensitivity C-reactive protein (hs-CRP) and acute phase glycoproteins (GlycA) would mediate the associations between job stress and headache disorders. MethodsWe cross-sectionally evaluated the baseline data from the Brazilian Longitudinal Study of Adult Health (ELSA-Brasil) regarding job stress (higher demand and lower control and support subscales), migraine and tension-type headache (ICHD-2 criteria), self-reported leisure-time physical activity, and plasma hs-CRP and GlycA levels. Conditional process analyses with a sequential mediation approach were employed to compute path coefficients and 95 % confidence intervals (CI) around the indirect effects of physical activity and biomarkers on the job stress-headache relationship. Separate models were adjusted for sex, age, and depression and anxiety. Further adjustments added BMI smoking status, and socioeconomic factors. ResultsIn total, 7,644 people were included in the study. The 1-year prevalence of migraine and tension-type headache were 13.1 % and 49.4 %, respectively. In models adjusted for sex, age, anxiety, and depression, the association between job stress (lower job control) and migraine was mediated by physical activity [effect = −0.039 (95 %CI: −0.074, −0.010)] but not hs-CRP or GlycA. TTH was associated with higher job control and lower job demand, which was mediated by the inverse associations between physical activity and GlycA [Job Control: effect = 0.0005 (95 %CI: 0.0001, 0.0010); Job Demand: effect = 0.0003 (95 %CI: 0.0001, 0.0007]. Only the mediating effect of physical activity in the job stress-migraine link remained after further adjustments including socioeconomic factors, BMI, smoking, and the exclusion of major chronic diseases. ConclusionIn the ELSA-Brasil study, physical activity reversed the link between job stress and migraine independently of systemic inflammation, while the LTPA-mediated downregulation of GlycA was associated with lower job stress-related TTH.