Photocatalytic nitrogen fixation has been considered as one of the most potential alternatives for the synthesis of ammonia; however, how to make full use of solar energy and how to cleave the strong NN bond remain great challenges. Herein, the attapulgite (ATP) mineral was modified with iron followed by the immobilization of doped CeF 3 nanoparticles to form a CeF 3 :Yb 3+ , Er 3+ /Fe-ATP heterostructure, which was utilized as a photocatalyst for nitrogen fixation. Results showed that doping of the activator Yb 3+ and the sensitizer Er 3+ generated fluorine vacancies (F v ) in the CeF 3 matrix, which formed dual active sites with Fe ions in ATP, benefiting the adsorption and activation of N 2 molecules. In addition, Fe-reconstructed ATP had a narrow band gap responsive in the visible region, while CeF 3 -doped Yb 3+ and Er 3+ facilitated transforming near-infrared light (NIR) into ultraviolet (UV) and visible light, both of which contributed to extending the harvest range in the full spectrum. The influence of the Er 3+ doping ratio and loading amount of fluoride on the generation of ammonia was explored. Notably, the separation of photogenerated charge carriers and the redox potentials was enhanced due to the rational indirect Z-scheme heterostructure mediated by F v . Under solar light irradiation, the NH 4 + production rate achieved the highest value of 253.6 μmol•h −1 •g −1 when the Er doping amount was optimized to be 3 mol % and the loading of CeF 3 :Yb 3+ , Er 3+ was 20 wt %, and it even reached 40.3 μmol•h −1 •g −1 under NIR irradiation. The current study may offer a sustainable strategy to use full solar energy and natural minerals for efficient ammonia synthesis.