A general mapping between the energy of pertinent magnetic solutions and the diagonal terms of the spin Hamiltonian in a local representation provides the first general framework to extract accurate values for the many body terms of extended spin Hamiltonians from periodic first-principle calculations. Estimates of these terms for La2CuO4, the paradigm of high-Tc superconductor parent compounds, and for the SrCu2O3 ladder compound are reported. For La2CuO4, present results support experimental evidence by Toader et al. [Phys. Rev. Lett. 94, 197202 (2005)10.1103/PhysRevLett.94.197202]. For SrCu2O3 even larger four-body spin amplitudes are found together with Jl/Jr = 1 and non-negligible ferromagnetic interladder exchange.