Photocatalytic degradation of formaldehyde is an ideal way to solve indoor air pollution. The development of Z-scheme heterojunction photocatalysts is economic and effective way in eliminating formaldehyde pollution. Herein, a ternary heterojunction photocatalyst K-C3N4/Ag/Ag3PMo12O40 (abbreviated as K-C3N4/Ag/APM) was synthesized by self-assembly of PMo12O403- with Ag+ and K-C3N4 followed by in-situ photoreduction. The Ag/Ag3PMo12O40 (APM) hetero-nanoparticles obtained by photoreduction are uniformly loaded on K-C3N4 nanosheets. The structure, morphology, optical and photoelectrochemical properties etc. of K-C3N4/Ag/APM were characterized and explored. The photocatalytic activity of K-C3N4/Ag/APM was assessed on the degradation of HCHO. K-C3N4/Ag/APM showed remarkably improved photocatalytic activity than the g-C3N4, K-C3N4 and K-C3N4/Ag in the degradation of HCHO under visible light irradiation. The K-C3N4/Ag/APM heterojunction can degrade 60% gaseous HCHO (0.16 mg L-1) in 60 min (λ > 400 nm). The optimum experimental parameters were temperature 20 ℃, RH 70%, catalyst amount 20 mg and initial HCHO concentration 0.16 mg L-1. The enhanced photocatalytic efficiency of K-C3N4/Ag/APM is attributed to the synergistic effect of improved light harvesting, excellent interface contact and accelerated transmission and separation of photogenerated carriers in the Z-scheme structure with Ag as efficient electron transfer mediators. Free radical trapping and electron spin resonance (ESR) experiments confirmed the Z-scheme charge transfer mechanism, and proved that •O2– and h+ were the main active species in HCHO oxidation reaction. The intermediate species in the HCHO photocatalytic degradation process were tested by in situ DRIFTS technology. The construction of g-C3N4 based Z-scheme photocatalyst may provide an insight for the design of new and efficient photocatalysts for environmental applications.