  Models of active galactic nuclei (AGN) suggest that their circumnuclear media
are complex with clumps and filaments, while recent observations hint towards
polar extended structures of gas and dust, as opposed to the classical torus
paradigm. The X-ray band forms an interesting window to study these
circumnuclear media in great detail. In this work, we extended the radiative
transfer code SKIRT with the X-ray processes that govern the broadband X-ray
spectra of obscured AGN, to study the structure of AGN circumnuclear media in
full 3D, based on their reflected X-ray emission. We extended the SKIRT code
with Compton scattering on free electrons, photo-absorption and fluorescence by
cold atomic gas, scattering on bound electrons, and extinction by dust. This
includes a novel treatment of extreme-forward scattering by dust, and a
detailed description of anomalous Rayleigh scattering. To verify our X-ray
implementation, we performed the first dedicated benchmark of X-ray torus
models, comparing five X-ray radiative transfer codes. Finally, we illustrated
the 3D nature of the code by producing synthetic X-ray images and spectra of
clumpy torus models. SKIRT forms a powerful new tool to model AGN circumnuclear
media in full 3D from X-ray to millimetre wavelengths, and is now publicly
available. In the X-ray regime, we find an excellent agreement with the
simulation results of the MYTorus and RefleX codes, which validates our X-ray
implementation. We find some discrepancies with other codes, which motivates
the need for a robust framework that can handle non-linear 3D radiative
transfer effects. The new X-ray functionalities of the SKIRT code allow for
uncomplicated access to a broad suite of 3D X-ray models for AGN that can
easily be tested and modified. This will be particularly useful with the advent
of X-ray microcalorimeter observations.
