public function isSpam($type = 'email', $value)
    {
        $fullApiUrl = $this->buildUrl($type, $value);
        $response = $this->sendRequest($fullApiUrl);

        if (! $response) {
            throw new \Exception('API Check Unsuccessful on url: '.$fullApiUrl);
        }

        $result = json_decode($response);

        // check format
        if (! isset($result->success) ||
            ! isset($result->{$type}->appears) ||
            ! isset($result->{$type}->frequency)
        ) {
            logger($response);
            if (is_array($response)) {
                $response = implode(', ', $response);
            }
            throw new \Exception('Response has wrong format: '.$response);
        }

        // check success
        if ($result->success == 1 && $result->{$type}->appears == 1) {
            // check frequency
            return $result->{$type}->frequency >= $this->frequency;
        }

        return false;
    }