BackgroundThe crosstalk between cancer and the tumour immune microenvironment (TIME) has attracted significant interest in the latest years because of its impact on cancer evolution and response to treatment. Despite this, cancer-specific tumour-TIME interactions and their mechanistic insights are still poorly understood.MethodsHere, we compute the significant interactions occurring between cancer-specific genetic drivers and five anti- and pro-tumour TIME features in 32 cancer types using Lasso regularised ordinal regression. Focusing on head and neck squamous cancer (HNSC), we rebuild the functional networks linking specific TIME driver alterations to the TIME state they associate with.ResultsThe 477 TIME drivers that we identify are multifunctional genes whose alterations are selected early in cancer evolution and recur across and within cancer types. Tumour suppressors and oncogenes have an opposite effect on the TIME and the overall anti-tumour TIME driver burden is predictive of response to immunotherapy. TIME driver alterations predict the immune profiles of HNSC molecular subtypes, and perturbations in keratinization, apoptosis and interferon signalling underpin specific driver-TIME interactions.ConclusionsOverall, our study delivers a comprehensive resource of TIME drivers, gives mechanistic insights into their immune-regulatory role, and provides an additional framework for patient prioritisation to immunotherapy. The full list of TIME drivers and associated properties are available athttp://www.network-cancer-genes.org.Supplementary InformationThe online version contains supplementary material available at 10.1186/s13073-023-01197-0.