We perform the calibration of the X-ray luminosity-mass scaling relation on a sample of 344 CODEX clusters with z < 0.66 using the dynamics of their member galaxies. Spectroscopic follow-up measurements have been obtained from the SPIDERS survey, leading to a sample of 6658 red member galaxies. We use the Jeans equation to calculate halo masses, assuming an NFW mass profile and analysing a broad range of anisotropy profiles. With a scaling relation of the form LX∝AXMBX200cE(z)2(1+z)γX , we find best-fitting parameters AX=0.62+0.05−0.06(±0.06)×1044ergs−1 , BX=2.35+0.21−0.18(±0.09) , γX=−2.77+1.06−1.05(±0.79) , where we include systematic uncertainties in parentheses and for a pivot mass and redshift of 3×1014M⊙ and 0.16, respectively. We compare our constraints with previous results, and we combine our sample with the SPT SZE-selected cluster subsample observed with XMM-Newton extending the validity of our results to a wider range of redshifts and cluster masses.