Summary. Our aim is to determine the precise space of functions for which the trapezoidal rule converges with a prescribed rate as the number of nodes tends to infinity. Excluding or controlling odd functions in some way it is possible to establish a correspondence between the speed of convergence and regularity properties of the function to be integrated. In this way we characterize Sobolev spaces, certain spaces of infinitely differentiable functions, of functions holomorphic in a strip, of entire functions of order greater than 1 and of entire functions of exponential type by the speed of convergence.