Improve api.py documentation