Headache is one of the most prevalent and disabling health conditions globally. We prospectively explored the urban exposome in relation to weekly occurrence of headache episodes using data from the Dutch population-based Occupational and Environmental Health Cohort Study (AMIGO). Participants (N = 7,339) completed baseline and follow-up questionnaires in 2011 and 2015, reporting headache frequency. Information on the urban exposome covered 80 exposures across 10 domains, such as air pollution, electromagnetic fields, and lifestyle and socio-demographic characteristics. We first identified all relevant exposures using the Boruta algorithm and then, for each exposure separately, we estimated the average treatment effect (ATE) and related standard error (SE) by training causal forests adjusted for age, depression diagnosis, painkiller use, general health indicator, sleep disturbance index and weekly occurrence of headache episodes at baseline. Occurrence of weekly headache was 12.5 % at baseline and 11.1 % at follow-up. Boruta selected five air pollutants (NO2, NOX, PM10, silicon in PM10, iron in PM2.5) and one urban temperature measure (heat island effect) as factors contributing to the occurrence of weekly headache episodes at follow-up. The estimated causal effect of each exposure on weekly headache indicated positive associations. NO2 showed the largest effect (ATE = 0.007 per interquartile range (IQR) increase; SE = 0.004), followed by PM10 (ATE = 0.006 per IQR increase; SE = 0.004), heat island effect (ATE = 0.006 per one-degree Celsius increase; SE = 0.007), NOx (ATE = 0.004 per IQR increase; SE = 0.004), iron in PM2.5 (ATE = 0.003 per IQR increase; SE = 0.004), and silicon in PM10 (ATE = 0.003 per IQR increase; SE = 0.004). Our results suggested that exposure to air pollution and heat island effects contributed to the reporting of weekly headache episodes in the study population.