Cobalt ferrite ultrathin films with inverse spinel structure are among the best candidates for spin-filtering at room temperature. We have fabricated high-quality epitaxial ultrathin CoFe2O4 layers on Ag(001) following a three-step method: an ultrathin metallic CoFe2 alloy was first grown in coherent epitaxy on the substrate, and then treated twice with O2, first at RT and then during annealing. The epitaxial orientation, the surface, interface and film structure were resolved combining LEED, STM, Auger and in situ GIXRD. A slight tetragonal distortion was observed, that should drive the easy magnetization axis in plane due to the large magneto-elastic coupling of such a material. The so-called inversion parameter, i.e. the Co fraction occupying octahedral sites in the ferrite spinel structure, is a key element for its spin-dependent electronic gap. It was obtained through in-situ x-ray resonant diffraction measurements collected at both the Co and Fe K edges. The data analysis was performed using the FDMNES code and showed that Co ions are predominantly located at octahedral sites with an inversion parameter of 0.88 +- 0.05. Ex-situ XPS gave an estimation in accordance with the values obtained through diffraction analysis.