The Birkhoff conjecture says that the boundary of a strictly convex integrable billiard table is necessarily an ellipse. In this article, we consider a stronger notion of integrability, namely integrability close to the boundary, and prove a local version of this conjecture: a small perturbation of an ellipse of small eccentricity which preserves integrability near the boundary, is itself an ellipse. This extends the result in Avila et al. (Ann Math 184:527–558, ADK16), where integrability was assumed on a larger set. In particular, it shows that (local) integrability near the boundary implies global integrability. One of the crucial ideas in the proof consists in analyzing Taylor expansion of the corresponding action-angle coordinates with respect to the eccentricity parameter, deriving and studying higher order conditions for the preservation of integrable rational caustics.