Get API key
← Code samples
URL

URL Scanning

Check a URL against threat databases before storing, publishing, or clicking it. Returns an immediate safe/bad verdict.

Check a URL against Verifence's internal threat database and Google Web Risk before storing, publishing, or clicking it. Returns an immediate safe/bad verdict. Each URL costs 5 credits.

Endpoint

HTTP
POST https://app.verifence.io/api/scan/url
API-KEY: your_api_key
Content-Type: application/json

Request & response

FieldTypeDescription
urlstringRequest — the URL to scan (required)
okbooleanResponse — true if the URL is safe, false if a threat was detected

If the scan itself fails, the endpoint returns 422 with { "ok": false, "error": "..." }.

cURL

cURL
curl -X POST https://app.verifence.io/api/scan/url \
  -H "API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'
JSON — safe / threat
{ "ok": true }    // safe

{ "ok": false }   // threat detected

PHP

PHP
function scanUrl(string $url): bool
{
    $ch = curl_init('https://app.verifence.io/api/scan/url');
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST           => true,
        CURLOPT_HTTPHEADER     => [
            'API-KEY: ' . getenv('VERIFENCE_API_KEY'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS     => json_encode(['url' => $url]),
        CURLOPT_TIMEOUT        => 5,
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    $result = json_decode($response, true);
    return (bool) ($result['ok'] ?? false);
}

// Usage — validate a URL before saving it
if (!scanUrl($url)) {
    throw new \RuntimeException('The URL you submitted contains a known threat and cannot be saved.');
}

Node.js

Node.js
async function scanUrl(url) {
  const res = await fetch('https://app.verifence.io/api/scan/url', {
    method: 'POST',
    headers: {
      'API-KEY': process.env.VERIFENCE_API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ url }),
    signal: AbortSignal.timeout(5000),
  });

  if (!res.ok) {
    throw new Error(`Verifence API error: ${res.status}`);
  }

  const result = await res.json();
  return result.ok === true;
}

// Usage — validate a user-submitted link before publishing
app.post('/listings', async (req, res) => {
  const isSafe = await scanUrl(req.body.link);
  if (!isSafe) {
    return res.status(422).json({
      error: 'The URL you submitted has been flagged as a threat and cannot be published.',
    });
  }
  const listing = await createListing(req.body);
  res.status(201).json({ listing });
});

Python

Python
import os
import requests

def scan_url(url: str) -> bool:
    response = requests.post(
        "https://app.verifence.io/api/scan/url",
        json={"url": url},
        headers={"API-KEY": os.environ["VERIFENCE_API_KEY"]},
        timeout=5,
    )
    response.raise_for_status()
    return response.json().get("ok") is True


# Usage — validate a URL before saving it to the database
if not scan_url(url):
    raise ValueError("The URL contains a known threat and cannot be saved.")

Scanning in bulk

The single-URL endpoint is designed for real-time validation during form submission or content ingestion. For bulk triage — checking hundreds of URLs at once — use the web interface: go to Scan URL in your dashboard, paste URLs (one per line) or upload a CSV/Excel file, and download the results. Bulk scans process up to 500 URLs per batch, and each URL costs 5 credits.

Ready to build it?

Create a free account and grab an API key in minutes.

Get started free