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.
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"}'
Domain & URL Lookup
Classify a single domain or URL and receive its content categories, category flags, and classification details.
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.
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
Adult & Sensitive Content
Productivity & Time
Business & Finance
Communication & Community
Lifestyle & Interests
Technology & Infrastructure
Government & General
Response Format
All API responses are JSON. The fields returned depend on the request type.
Single Domain Response Fields
| Field | Type | Description |
|---|---|---|
domain | string | The queried domain name |
web_filtering_category | string | All matching categories joined by | — identical to the format used in the offline database CSV |
web_filtering_categories | array | The same list as a parsed JSON array |
primary_category | string | The highest-confidence category |
risk_level | string | low, medium, high, or critical |
content risk_flags | array | Active content risk indicators (empty if none) |
confidence | float | Classification confidence 0.0–1.0 |
processing_time_ms | integer | Server-side processing time in ms |
status | integer | HTTP-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 |
|---|---|---|---|
| Free | 1,000 | 10 domains/call | <100ms |
| Starter | 50,000 | 100 domains/call | <50ms |
| Professional | 500,000 | 1,000 domains/call | <50ms |
| Enterprise | Unlimited | Custom | SLA guaranteed |
Error Handling
The API uses standard HTTP response codes and returns detailed error information.
| Status Code | Meaning | Description |
|---|---|---|
200 | OK | Request successful |
400 | Bad Request | Missing or invalid parameters (e.g. no query field) |
401 | Unauthorized | Invalid or missing API key |
429 | Rate Limited | Monthly request quota exceeded |
500 | Server Error | Internal server error — contact support |
Example Error Response
{
"error": "Invalid API key",
"status": 401
}