Enforce main thread for api calls.