We study the motion of an elastic capsule through a microchannel characterized by a localized constriction. We consider a capsule with a stress-free spherical shape and impose its steady state configuration in an infinitely long straight channel as the initial condition for our calculations. We report how the capsule deformation, velocity, retention time, and maximum stress of the membrane are affected by the capillary number, Ca, and the constriction shape. We estimate the deformation by measuring the variation of the three-dimensional surface area and a series of alternative quantities easier to extract from experiments. These are the Taylor parameter, the perimeter and the area of the capsule in the spanwise plane. We find that the perimeter is the quantity that reproduces the behavior of the three-dimensional surface area the best. This is maximum at the centre of the constriction and shows a second peak after it, whose location depends on the Ca number. We observe that, in general, area-deformation correlated quantities grow linearly with Ca, while velocity-correlated quantities saturate for large Ca but display a steeper increase for small Ca. The velocity of the capsule divided by the velocity of the flow displays, surprisingly, two different qualitative behaviors for small and large capillary numbers. Finally, we report that longer constrictions and spanwise wall bounded (versus spanwise periodic) domains cause larger deformations and velocities. If the deformation and velocity in the spanwise wall bounded domains are rescaled by the initial equilibrium deformation and velocity, their behavior is undistinguishable from that in a periodic domain. In contrast, a remarkably different behavior is reported in sinusoidally shaped and smoothed rectangular constrictions indicating that the capsule dynamics is particularly sensitive to abrupt changes in the cross section. In a smoothed rectangular constriction larger deformations and velocities occur over a larger distance.