  For a compact Riemannian manifold with boundary, endowed with a magnetic
potential $\alpha$, we consider the problem of restoring the metric $g$ and the
magnetic potential $\alpha$ from the values of the Ma\~n\'e action potential
between boundary points and the associated linearized problem. We study simple
magnetic systems. In this case, knowledge of the Ma\~n\'e action potential is
equivalent to knowledge of the scattering relation on the boundary which maps a
starting point and a direction of a magnetic geodesic into its end point and
direction. This problem can only be solved up to an isometry and a gauge
transformation of $\alpha$.
  For the linearized problem, we show injectivity, up to the natural
obstruction, under explicit bounds on the curvature and on $\alpha$. We also
show injectivity and stability for $g$ and $\alpha$ in a generic class
$\mathcal{G}$ including real analytic ones.
  For the nonlinear problem, we show rigidity for real analytic simple $g$,
$\alpha$. Also, rigidity holds for metrics in a given conformal class, and
locally, near any $(g,\alpha)\in \mathcal{G}$.
