Replace web with api for flask integration