Quantitative measurements of X-rays require absolutely calibrated detectors. In the laboratory of the Physikalisch-Technische Bundesanstalt (PTB) at the electron storage ring BESSY II in Berlin, X-ray detectors can be calibrated with low uncertainties. Two complementary approaches are realized for energy-dispersive detectors. One approach uses the storage ring as primary source standard and the detector response to the calculable spectral photon flux is measured in the undispersed synchrotron radiation. This requires the operation of the storage ring with only a few stored electrons. The other approach is the comparison to a primary detector standard, mainly a cryogenic electrical substitution radiometer. Here, monochromatized radiation of very high spectral purity has to be used which is available at different beamlines in the laboratory in the photon energy range from the UV up to about 120 keV. This method can also be applied for the calibration of non-energy-dispersive detectors. With monochromatized radiation, the response function of energy-dispersive detectors is recorded and compared to Monte Carlo simulations. A photon-energy-dependent parameterization of the response function allows deconvoluting the experimental spectra. The responsivity of Si photodiodes and the detection efficiency of Si(Li), HPGe and CdTe detectors are determined with low uncertainties in a broad spectral range.