add callback to detect when the api is ready