Pass api callbacks a ref to the api.