Update to api.py