The technical realisation and the commissioning experiments of a high-speed X-ray detector based on a quadrant avalanche silicon photodiode and high-speed digitizers are described. The development is driven by the need for X-ray detectors dedicated to time-resolved diffraction and imaging experiments, ideally requiring pulse-resolved data processing at the synchrotron bunch repetition rate. By a novel multi-photon detection scheme, the exact number of X-ray photons within each X-ray pulse can be recorded. Commissioning experiments at beamlines P08 and P10 of the storage ring PETRA III, at DESY, Hamburg, Germany, have been used to validate the pulse-wise multi-photon counting scheme at bunch frequencies ≥31 MHz, enabling pulse-by-pulse readout during the PETRA III 240-bunch mode with single-photon detection capability. An X-ray flux of ≥3.7 × 109 photons s−1can be detected while still resolving individual photons at low count rates.