Transitional pulsars provide us with a unique laboratory to study the physics of accretion onto a magnetic neutron star. PSR J1023+0038 (J1023) is the best studied of this class. We investigate the X-ray spectral properties of J1023 in the framework of a working radio pulsar during the active state. We modelled the X-ray spectra in three modes (low, high, and flare) as well as in quiescence, to constrain the emission mechanism and source parameters. The emission model, formed by an assumed pulsar emission (thermal and magnetospheric) plus a shock component, can account for the data only adding a hot dense absorber covering ~30% of the emitting source in high mode. The covering fraction is similar in flaring mode, thus excluding total enshrouding, and decreases in the low mode despite large uncertainties. This provides support to the recently advanced idea of a mini-pulsar wind nebula (PWN), where X-ray and optical pulsations arise via synchrotron shock emission in a very close (~100 km, comparable to a light cylinder), PWN-like region that is associated with this hot absorber. In low mode, this region may expand, pulsations become undetectable, and the covering fraction decreases.