Quick Start Guide

Get up and running with the Web Filtering Database API in minutes. Classify any domain or URL against 59 content categories.

Start Building →

Getting Started

The Web Filtering Database REST API lets you classify any domain or URL into one or more of 59 content categories. It is used for parental controls, enterprise web filtering, ISP content policies, DNS filtering, and security content filtering.

Base URL: https://webfilteringdatabase.com/api/moderate.php

All requests accept JSON bodies (POST) or query string parameters (GET). All responses are JSON.

Authentication

All API requests require an API key. Pass it as the api_key field in your request body or as a query string parameter.

API Key Authentication

Include your API key in every request. You can obtain an API key by registering at webfilteringdatabase.com/login.

curl -X POST "https://webfilteringdatabase.com/api/moderate.php" \
     -H "Content-Type: application/json" \
     -d '{"api_key": "YOUR_API_KEY", "query": "example.com"}'
Keep your API key secure! Never expose it in client-side code or commit it to version control.

Domain & URL Lookup

Classify a single domain or URL and receive its content categories, category flags, and classification details.

POST /api/moderate.php

Single Domain Classification

Submit any domain name or full URL for classification.

Request Body

Parameter Type Required Description
api_key string Required Your API key for authentication
query string Required The domain name or URL to classify (e.g. example.com or https://example.com/page)
content_type string Optional Set to url for full-path URL classification (default: domain-level lookup)

Example Request

curl -X POST "https://webfilteringdatabase.com/api/moderate.php" \
     -H "Content-Type: application/json" \
     -d '{
       "api_key": "YOUR_API_KEY",
       "query": "facebook.com"
     }'

Example Response

Domains can match multiple web filtering categories. The response always includes a web_filtering_category string with categories joined by a pipe (|) — matching the format used in the offline database — alongside a web_filtering_categories array for convenience.

{
    "domain": "google.com",
    "web_filtering_category": "AI / LLM Tools|Advertising/Marketing|Business|CDN / Hosting / Infrastructure|Cloud Storage / File Hosting|Developer Tools / Code Hosting|Email and Messaging|Podcasts|Search Engines & Platforms|Streaming Media|Web-based Applications|Webinars/E-learning",
    "web_filtering_categories": [
        "AI / LLM Tools",
        "Advertising/Marketing",
        "Business",
        "CDN / Hosting / Infrastructure",
        "Cloud Storage / File Hosting",
        "Developer Tools / Code Hosting",
        "Email and Messaging",
        "Podcasts",
        "Search Engines & Platforms",
        "Streaming Media",
        "Web-based Applications",
        "Webinars/E-learning"
    ],
    "primary_category": "Search Engines & Platforms",
    "risk_level": "low",
    "content risk_flags": [],
    "confidence": 0.98,
    "processing_time_ms": 12,
    "status": 200
}

URL-Level Classification

For deeper classification based on the full URL path (homepage vs. specific pages):

curl -X POST "https://webfilteringdatabase.com/api/moderate.php" \
     -H "Content-Type: application/json" \
     -d '{
       "api_key": "YOUR_API_KEY",
       "query": "https://reddit.com/r/gambling",
       "content_type": "url"
     }'

Bulk Domain Lookup

Classify multiple domains in a single API call. Ideal for batch processing, firewall rule generation, and database enrichment.

POST /api/moderate.php

Batch Classification

Parameter Type Required Description
api_key string Required Your API key
content string Required Newline-separated list of domains to classify
api_type string Required Set to bulk for batch requests

Example Request

curl -X POST "https://webfilteringdatabase.com/api/moderate.php" \
     -H "Content-Type: application/json" \
     -d '{
       "api_key": "YOUR_API_KEY",
       "api_type": "bulk",
       "content": "google.com\nfacebook.com\nbbc.co.uk\npornhub.com\nunsafe content-site.xyz"
     }'

Example Response

Each result includes both web_filtering_category (pipe-separated string — matching the offline database format) and web_filtering_categories (parsed array).

{
    "results": [
        {
            "domain": "google.com",
            "web_filtering_category": "AI / LLM Tools|Advertising/Marketing|Business|Search Engines & Platforms|Streaming Media",
            "web_filtering_categories": ["AI / LLM Tools","Advertising/Marketing","Business","Search Engines & Platforms","Streaming Media"],
            "risk_level": "low"
        },
        {
            "domain": "facebook.com",
            "web_filtering_category": "Advertising/Marketing|Social Networking|Streaming Media",
            "web_filtering_categories": ["Advertising/Marketing","Social Networking","Streaming Media"],
            "risk_level": "low"
        },
        {
            "domain": "bbc.co.uk",
            "web_filtering_category": "News/Media|Streaming Media",
            "web_filtering_categories": ["News/Media","Streaming Media"],
            "risk_level": "low"
        },
        {
            "domain": "unsafe content-site.xyz",
            "web_filtering_category": "Restricted / Suspicious",
            "web_filtering_categories": ["Restricted / Suspicious"],
            "risk_level": "critical"
        }
    ],
    "total": 4,
    "processing_time_ms": 48,
    "status": 200
}

59 Content Categories

Every domain is classified into one or more of the following 59 categories used for web filtering policies. The list is identical across the API response, the offline database and the taxonomy documentation.

web-based risks

Restricted / Suspicious
VPN / Proxy / Anonymizers
Remote Access Tools
URL Shorteners
Hate/Discrimination
Violence
Weapons
Illegal Drugs

Adult & Sensitive Content

Adult
Lingerie/Swimsuits/Intimate Apparel
Gambling
Alcohol
Tobacco
Dating

Productivity & Time

Social Networking
Gaming
Streaming Media
Podcasts
File Sharing/P2P
Cloud Storage / File Hosting

Business & Finance

Business
Financial Services
Online Banking
Cryptocurrency
Job Search/Careers
Advertising/Marketing
Shopping
Marketplaces / Classifieds / Auctions
Real Estate

Communication & Community

Email and Messaging
Forums / Message Boards
Community Sites
Blogs/Personal Sites
News/Media
Political

Lifestyle & Interests

Health & Medicine
Education/Reference
Webinars/E-learning
Science
Arts & Entertainment
Travel
Restaurants & Dining
Food & Drink
Sports & Recreation
Pets & Animals
Automotive & Transportation
Home & Garden
Religion & Spirituality

Technology & Infrastructure

Computers & Technology
AI / LLM Tools
Developer Tools / Code Hosting
Web-based Applications
Freeware/Software
Search Engines & Platforms
CDN / Hosting / Infrastructure
Parked / For-Sale Domains

Government & General

Government & Legal
Military
Other
Full taxonomy with descriptions: categories-web-filtering.php. Offline database packages: web-filtering-database.php.

Response Format

All API responses are JSON. The fields returned depend on the request type.

Single Domain Response Fields

Field Type Description
domainstringThe queried domain name
web_filtering_categorystringAll matching categories joined by | — identical to the format used in the offline database CSV
web_filtering_categoriesarrayThe same list as a parsed JSON array
primary_categorystringThe highest-confidence category
risk_levelstringlow, medium, high, or critical
content risk_flagsarrayActive content risk indicators (empty if none)
confidencefloatClassification confidence 0.0–1.0
processing_time_msintegerServer-side processing time in ms
statusintegerHTTP-style status code (200 = success)

Code Examples

Python

import requests

API_URL = "https://webfilteringdatabase.com/api/moderate.php"
API_KEY = "YOUR_API_KEY"

def classify_domain(domain):
    response = requests.post(API_URL, json={
        "api_key": API_KEY,
        "query": domain
    })
    return response.json()

result = classify_domain("example.com")
print(f"Primary category: {result['primary_category']}")
print(f"category level: {result['risk_level']}")
# Categories come pipe-separated, matching the offline database CSV format
cats = result['web_filtering_category'].split('|')
print(f"All web filtering categories: {cats}")

JavaScript (Node.js / Browser)

const API_URL = 'https://webfilteringdatabase.com/api/moderate.php';
const API_KEY = 'YOUR_API_KEY';

async function classifyDomain(domain) {
    const response = await fetch(API_URL, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ api_key: API_KEY, query: domain })
    });
    return response.json();
}

classifyDomain('bbc.co.uk').then(result => {
    console.log('Primary category:', result.primary_category);
    console.log('Risk:', result.risk_level);
    // Categories arrive pipe-separated, matching the offline database CSV format
    const cats = result.web_filtering_category.split('|');
    console.log('All web filtering categories:', cats);
});

PHP

<?php
$apiUrl = 'https://webfilteringdatabase.com/api/moderate.php';
$apiKey = 'YOUR_API_KEY';

function classifyDomain($domain, $apiUrl, $apiKey) {
    $ch = curl_init($apiUrl);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
        'api_key' => $apiKey,
        'query'   => $domain
    ]));
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);
    return json_decode($result, true);
}

$result = classifyDomain('example.com', $apiUrl, $apiKey);
echo "Category: " . $result['primary_category'] . "\n";
echo "Risk: "     . $result['risk_level']        . "\n";
?>

DNS Filtering Integration Example (Python)

Block domains at the DNS resolver layer based on category:

import requests

API_URL = "https://webfilteringdatabase.com/api/moderate.php"
API_KEY  = "YOUR_API_KEY"

BLOCKED_CATEGORIES = {"unsafe content", "restricted content", "Adult Content", "Gambling", "Botnets"}

def should_block(domain):
    result = requests.post(API_URL, json={"api_key": API_KEY, "query": domain}).json()
    categories = set(result.get("categories", []))
    risk       = result.get("risk_level", "low")
    if risk in ("high", "critical"):
        return True, f"risk={risk}"
    blocked = categories & BLOCKED_CATEGORIES
    if blocked:
        return True, f"category={', '.join(blocked)}"
    return False, None

# Example DNS resolver hook
domain = "suspicious-unsafe content-site.xyz"
block, reason = should_block(domain)
if block:
    print(f"BLOCKED {domain}: {reason}")
else:
    print(f"ALLOWED {domain}")

Rate Limits & Plans

Rate limits depend on your subscription plan. See pricing.php for full plan details.

Plan Requests / Month Bulk Limit Response Time
Free1,00010 domains/call<100ms
Starter50,000100 domains/call<50ms
Professional500,0001,000 domains/call<50ms
EnterpriseUnlimitedCustomSLA guaranteed
When you exceed your plan limit, the API returns HTTP 429. Upgrade your plan or contact [email protected] for enterprise options.

Error Handling

The API uses standard HTTP response codes and returns detailed error information.

Status Code Meaning Description
200OKRequest successful
400Bad RequestMissing or invalid parameters (e.g. no query field)
401UnauthorizedInvalid or missing API key
429Rate LimitedMonthly request quota exceeded
500Server ErrorInternal server error — contact support

Example Error Response

{
    "error": "Invalid API key",
    "status": 401
}