ScamVerify™
Getting Started

SDKs and Libraries

Use the ScamVerify™ API from Python, Node.js, Go, PHP, Ruby, and other languages using standard HTTP clients.

ScamVerify™ does not yet have official SDKs. The API uses standard REST conventions, so you can integrate with any language that supports HTTP requests. Below are complete working examples for the most popular languages.

Official SDKs for Python (PyPI) and Node.js (npm) are coming soon. Join the waitlist at scamverify.ai/contact to be notified when they launch.

Python

Using the requests library:

import os
import requests

SCAMVERIFY_API_KEY = os.environ["SCAMVERIFY_API_KEY"]
BASE_URL = "https://scamverify.ai/api/v1"


def lookup_phone(phone_number: str) -> dict:
    """Look up a phone number and return the risk assessment."""
    response = requests.post(
        f"{BASE_URL}/phone/lookup",
        headers={
            "Authorization": f"Bearer {SCAMVERIFY_API_KEY}",
            "Content-Type": "application/json",
        },
        json={"phone_number": phone_number},
    )
    response.raise_for_status()
    return response.json()


# Example usage
result = lookup_phone("+12025551234")
print(f"Risk Score: {result['risk_score']}/100")
print(f"Verdict: {result['verdict']}")
print(f"Explanation: {result['explanation']}")

if result.get("signals", {}).get("ftc_complaints", 0) > 0:
    print(f"FTC Complaints: {result['signals']['ftc_complaints']}")

Install the dependency:

pip install requests

Node.js

Using the built-in fetch API (Node.js 18+):

const SCAMVERIFY_API_KEY = process.env.SCAMVERIFY_API_KEY;
const BASE_URL = "https://scamverify.ai/api/v1";

async function lookupPhone(phoneNumber) {
  const response = await fetch(`${BASE_URL}/phone/lookup`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${SCAMVERIFY_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ phone_number: phoneNumber }),
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(`API error ${response.status}: ${error.message}`);
  }

  return response.json();
}

// Example usage
const result = await lookupPhone("+12025551234");
console.log(`Risk Score: ${result.risk_score}/100`);
console.log(`Verdict: ${result.verdict}`);
console.log(`Explanation: ${result.explanation}`);

Go

Using the standard net/http package:

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

const baseURL = "https://scamverify.ai/api/v1"

type PhoneLookupRequest struct {
	PhoneNumber string `json:"phone_number"`
}

type PhoneLookupResponse struct {
	RiskScore   int               `json:"risk_score"`
	Verdict     string            `json:"verdict"`
	Explanation string            `json:"explanation"`
	Signals     map[string]any    `json:"signals"`
	Cached      bool              `json:"cached"`
}

func lookupPhone(phoneNumber string) (*PhoneLookupResponse, error) {
	apiKey := os.Getenv("SCAMVERIFY_API_KEY")

	reqBody, err := json.Marshal(PhoneLookupRequest{PhoneNumber: phoneNumber})
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", baseURL+"/phone/lookup", bytes.NewBuffer(reqBody))
	if err != nil {
		return nil, err
	}

	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("API error %d: %s", resp.StatusCode, string(body))
	}

	var result PhoneLookupResponse
	if err := json.Unmarshal(body, &result); err != nil {
		return nil, err
	}

	return &result, nil
}

func main() {
	result, err := lookupPhone("+12025551234")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error: %v\n", err)
		os.Exit(1)
	}

	fmt.Printf("Risk Score: %d/100\n", result.RiskScore)
	fmt.Printf("Verdict: %s\n", result.Verdict)
	fmt.Printf("Explanation: %s\n", result.Explanation)
}

PHP

Using the built-in cURL extension:

<?php

$apiKey = getenv('SCAMVERIFY_API_KEY');
$baseUrl = 'https://scamverify.ai/api/v1';

function lookupPhone(string $phoneNumber): array {
    global $apiKey, $baseUrl;

    $ch = curl_init($baseUrl . '/phone/lookup');

    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $apiKey,
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => json_encode([
            'phone_number' => $phoneNumber,
        ]),
    ]);

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($httpCode !== 200) {
        throw new Exception("API error {$httpCode}: {$response}");
    }

    return json_decode($response, true);
}

// Example usage
$result = lookupPhone('+12025551234');
echo "Risk Score: {$result['risk_score']}/100\n";
echo "Verdict: {$result['verdict']}\n";
echo "Explanation: {$result['explanation']}\n";

Ruby

Using the standard net/http library:

require 'net/http'
require 'json'
require 'uri'

API_KEY = ENV['SCAMVERIFY_API_KEY']
BASE_URL = 'https://scamverify.ai/api/v1'

def lookup_phone(phone_number)
  uri = URI("#{BASE_URL}/phone/lookup")

  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(uri)
  request['Authorization'] = "Bearer #{API_KEY}"
  request['Content-Type'] = 'application/json'
  request.body = { phone_number: phone_number }.to_json

  response = http.request(request)

  unless response.code == '200'
    raise "API error #{response.code}: #{response.body}"
  end

  JSON.parse(response.body)
end

# Example usage
result = lookup_phone('+12025551234')
puts "Risk Score: #{result['risk_score']}/100"
puts "Verdict: #{result['verdict']}"
puts "Explanation: #{result['explanation']}"

Community Libraries

No community libraries exist yet. If you build a wrapper for the ScamVerify™ API, reach out through our contact form and we will list it here.

On this page