Fixing typeerror on api creation