better way to init the api object