Add missing encoding info to api.py