updating how the api var is assigned