Update api.rst

complete documentation of the API