The CleanBrowsing REST API lets you automate filter management, update network IP addresses, manage domain whitelists and blocklists, and retrieve activity logs. This reference covers authentication, endpoints, and working examples.
Learn About Pricing
The CleanBrowsing API provides a REST interface for managing your DNS filtering account programmatically. You can use it to automate IP updates for dynamic networks, manage domain whitelists and blocklists, control category filters, create and delete profiles, and pull activity logs.
All API requests are made over HTTPS to the base URL:
https://my.cleanbrowsing.org/api/v1/
The API accepts parameters via query strings and returns JSON responses. A successful response includes:
{"status": "success"}
Failed requests return an error message describing the issue:
{"status": "error", "message": "Invalid API key"}
Every API request must include your API key. The key identifies your account and authorizes the requested action.
Include the apikey parameter in every request:
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=profiles/list"
Security note: Keep your API key secret. Do not expose it in client-side code, public repositories, or shared scripts. If your key is compromised, regenerate it immediately from the dashboard.
If your network uses a dynamic IP address, you need to keep CleanBrowsing updated with your current public IP so that filtering rules apply correctly. The API provides endpoints to manage your registered network IP addresses.
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=network/list"
Example response:
{
"status": "success",
"networks": [
{
"ip": "203.0.113.50",
"label": "Home Network",
"profile": "default"
}
]
}
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=network/add&ip=203.0.113.100&label=Office"
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=network/delete&ip=203.0.113.50"
You can automate IP updates with a cron job. This script detects your current public IP and updates CleanBrowsing:
#!/bin/bash
# Save as /usr/local/bin/cb-update-ip.sh
API_KEY="YOUR_API_KEY"
CURRENT_IP=$(curl -s https://api.ipify.org)
curl -s "https://my.cleanbrowsing.org/api/v1/?apikey=${API_KEY}&action=network/add&ip=${CURRENT_IP}&label=AutoUpdate"
Add it to crontab to run every 15 minutes:
*/15 * * * * /usr/local/bin/cb-update-ip.sh > /dev/null 2>&1
CleanBrowsing categorizes content into predefined categories (adult content, malware, gambling, social media, etc.). The API lets you block or allow specific categories and manage filtering profiles.
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=categories/list"
Returns a list of all categories and their current block status.
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=category/block&category=gambling"
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=category/allow&category=gambling"
| Category | Description |
|---|---|
| adult | Pornography and adult content |
| malware | Malware, phishing, and ransomware domains |
| gambling | Online gambling and betting sites |
| gaming | Online gaming platforms |
| social | Social networking sites |
| torrents | Torrent trackers and P2P sites |
| vpn | VPN and proxy services |
| drugs | Drug-related content |
| weapons | Weapons-related content |
| streaming | Streaming media platforms |
Profiles let you apply different filtering rules to different networks or devices.
# List all profiles
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=profiles/list"
# Create a new profile
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=profile/add&name=Kids"
# Delete a profile
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=profile/delete&name=Kids"
Enable default-block mode to block all domains except those on your whitelist:
# Enable whitelist-only mode
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=default-block/enable"
# Disable whitelist-only mode
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=default-block/disable"
View the domains currently on your whitelist (allowed) and blocklist (blocked).
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=whitelist/list"
Example response:
{
"status": "success",
"domains": [
"example.com",
"educational-site.org",
"company-tool.io"
]
}
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=blocklist/list"
The API also lets you pull DNS query logs for auditing and monitoring:
# List available log dates
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=logs/list"
# Get statistics for a specific date
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=logs/getstats&date=2026-02-21"
# Download full log dump for a date
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=logs/getdump&date=2026-02-21"
# Delete logs for a specific date
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=logs/delete&date=2026-02-21"
Custom domain lists give you fine-grained control over what is allowed or blocked on your network, beyond the predefined category filters.
Allow a specific domain that might otherwise be blocked by a category filter:
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=whitelist/add&domain=example.com"
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=whitelist/delete&domain=example.com"
Block a specific domain that is not covered by an existing category:
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=blocklist/add&domain=unwanted-site.com"
curl "https://my.cleanbrowsing.org/api/v1/?apikey=YOUR_API_KEY&action=blocklist/delete&domain=unwanted-site.com"
Use this bash script to add multiple domains to your blocklist from a text file:
#!/bin/bash
# Save as /usr/local/bin/cb-bulk-block.sh
# Usage: ./cb-bulk-block.sh domains.txt
API_KEY="YOUR_API_KEY"
DOMAIN_FILE="$1"
while IFS= read -r domain; do
[ -z "$domain" ] && continue
echo "Blocking: $domain"
curl -s "https://my.cleanbrowsing.org/api/v1/?apikey=${API_KEY}&action=blocklist/add&domain=${domain}"
echo ""
done < "$DOMAIN_FILE"
Create a text file with one domain per line:
unwanted-site1.com
unwanted-site2.net
unwanted-site3.org
Then run:
chmod +x /usr/local/bin/cb-bulk-block.sh
./cb-bulk-block.sh domains.txt
status field in the response before proceeding.