Model/Statistic.php
public function isApiKeyValid()
    {
        try {
            $apiKey = $this->scopeConfig->getValue(Config::XML_FASTLY_API_KEY);
            $serviceId = $this->scopeConfig->getValue(Config::XML_FASTLY_SERVICE_ID);
            $isApiKeyValid = $this->api->checkServiceDetails(true, $serviceId, $apiKey);
        } catch (\Exception $e) {
            return false;
        }
        return (bool)$isApiKeyValid;
    }
public function isApiKeyValid()
    {
        try {
            $apiKey = $this->scopeConfig->getValue(Config::XML_FASTLY_API_KEY);
            $serviceId = $this->scopeConfig->getValue(Config::XML_FASTLY_SERVICE_ID);
            $isApiKeyValid = $this->api->checkServiceDetails(true, $serviceId, $apiKey);
        } catch (\Exception $e) {
            return false;
        }
        return (bool)$isApiKeyValid;
    }
Checks if API token is valid

@return bool $isApiKeyValid