The article studies inverse problems of determining unknown coefficients in various semi-linear and quasi-linear wave equations given the knowledge of an associated source-to-solution map. We introduce a method to solve inverse problems for nonlinear equations using interaction of three waves that makes it possible to study the inverse problem in all globally hyperbolic spacetimes of the dimension
$n+1\geqslant 3$
and with partial data. We consider the case when the set
$\Omega _{\mathrm{in}}$
, where the sources are supported, and the set
$\Omega _{\mathrm{out}}$
, where the observations are made, are separated. As model problems we study both a quasi-linear equation and a semi-linear wave equation and show in each case that it is possible to uniquely recover the background metric up to the natural obstructions for uniqueness that is governed by finite speed of propagation for the wave equation and a gauge corresponding to change of coordinates. The proof consists of two independent components. In the geometric part of the article we introduce a novel geometrical object, the three-to-one scattering relation. We show that this relation determines uniquely the topological, differential and conformal structures of the Lorentzian manifold in a causal diamond set that is the intersection of the future of the point
$p_{in}\in \Omega _{\mathrm{in}}$
and the past of the point
$p_{out}\in \Omega _{\mathrm{out}}$
. In the analytic part of the article we study multiple-fold linearisation of the nonlinear wave equation using Gaussian beams. We show that the source-to-solution map, corresponding to sources in
$\Omega _{\mathrm{in}}$
and observations in
$\Omega _{\mathrm{out}}$
, determines the three-to-one scattering relation. The methods developed in the article do not require any assumptions on the conjugate or cut points.