This guide shows how to add a single IP and bulk-import many IPs from a CSV to your CleanBrowsing Network list using the API. It also covers how to list current IPs and remove IPs (single & bulk).
π‘οΈ CleanBrowsing: Internet Safety Made Simple
Filter harmful websites, block adult content, and protect your entire network. All with fast, privacy-respecting DNS.
Start Filtering Here βPrerequisites
- Plan: API access is available on Pro 500+ plans.
- API Key: Found in your dashboard.
- Base Endpoint:
https://my.cleanbrowsing.org/api
- Auth & Params: Send your API key and action as query parameters (examples below).
Profiles: If you use profiles, include
profile_name=
. If omitted, actions apply to thedefault
profile.
Supported Actions (Network)
Add an IP
Action: network/add
Required: ip_address=(valid_ipv4)
Optional: profile_name=(valid_profile_name) | defaults to "default"
Success: {"status":"success"}
Error: {"status":"failed","reason":"<why>"}
Delete an IP
Action: network/delete
Required: ip_address=(valid_ipv4)
Optional: profile_name=(valid_profile_name) | defaults to "default"
Success: {"status":"success"}
Error: {"status":"failed","reason":"<why>"}
List IPs
Action: network/list
Optional: profile_name=(valid_profile_name)
Success: {"status":"success","networks":{"default":["1.2.3.4","1.2.3.3"],"profileexample":["2.1.1.1","2.2.2.2"]}}
Error: {"status":"failed","reason":"<why>"}
Single-IP Examples (cURL)
Add one IP
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/add&ip_address=203.0.113.14"
Add one IP to a specific profile
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/add&ip_address=203.0.113.14&profile_name=Teachers"
Remove one IP
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/delete&ip_address=203.0.113.14"
List current IPs (all profiles)
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/list"
List current IPs (single profile)
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/list&profile_name=Teachers"
Running the Scripts
Youβll run these commands locally:
- macOS/Linux: Open the Terminal app and paste the
curl
or bash scripts below. Save your CSV (e.g.,ips.csv
) in the same directory. - Windows: Use PowerShell (or Command Prompt for single
curl
calls). For bulk uploads, save the PowerShell script to a file (e.g.,bulk-upload.ps1
) in the same directory as your CSV and run it.
On Windows PowerShell, you may need to allow script execution temporarily:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass .\bulk-upload.ps1
CSV Format for Bulk Upload
Create a CSV with a header row. These two formats are supported by the examples below:
Option A β Just IPs
ip_address
198.51.100.10
198.51.100.11
198.51.100.12
Option B β IPs + Profile (per row)
ip_address,profile_name
198.51.100.10,Teachers
198.51.100.11,Default
198.51.100.12,Library
If
profile_name
is omitted, the API will use thedefault
profile.
Bulk Add from CSV (macOS/Linux Bash)
Save one of the CSV formats above as ips.csv
, then run:
Add (Option A β single profile)
API_KEY="YOUR_API_KEY"
PROFILE="default" # change if needed
while IFS=, read -r ip_address; do
# skip header and blank lines
[[ "$ip_address" == "ip_address" || -z "$ip_address" ]] && continue
url="https://my.cleanbrowsing.org/api?apikey=${API_KEY}&action=network/add&ip_address=${ip_address}&profile_name=${PROFILE}"
echo "Adding $ip_address to profile=$PROFILE"
curl -s "$url"
echo # newline for readability
sleep 0.2 # gentle pacing
done < ips.csv
Add (Option B β mixed profiles per row)
API_KEY="YOUR_API_KEY"
# shellcheck disable=SC2162
while IFS=, read ip_address profile_name; do
# skip header and blank lines
if [[ "$ip_address" == "ip_address" ]]; then continue; fi
[[ -z "$ip_address" ]] && continue
# default profile if not provided
profile_name=${profile_name:-default}
url="https://my.cleanbrowsing.org/api?apikey=${API_KEY}&action=network/add&ip_address=${ip_address}&profile_name=${profile_name}"
echo "Adding $ip_address to profile=$profile_name"
curl -s "$url"
echo
sleep 0.2
done < ips.csv
Remove (bulk delete from CSV)
Use the same CSV and swap the action:
API_KEY="YOUR_API_KEY"
PROFILE="default"
while IFS=, read -r ip_address; do
[[ "$ip_address" == "ip_address" || -z "$ip_address" ]] && continue
url="https://my.cleanbrowsing.org/api?apikey=${API_KEY}&action=network/delete&ip_address=${ip_address}&profile_name=${PROFILE}"
echo "Removing $ip_address from profile=$PROFILE"
curl -s "$url"
echo
sleep 0.2
done < ips.csv
Bulk Add from CSV (Windows PowerShell)
Save one of the CSV formats as ips.csv
and run in PowerShell:
Add (Option A β single profile)
$ApiKey = "YOUR_API_KEY"
$Profile = "default" # change if needed
$Rows = Import-Csv -Path .\ips.csv
foreach ($row in $Rows) {
$ip = $row.ip_address
if ([string]::IsNullOrWhiteSpace($ip)) { continue }
$url = "https://my.cleanbrowsing.org/api?apikey=$ApiKey&action=network/add&ip_address=$ip&profile_name=$Profile"
Write-Host "Adding $ip to profile=$Profile"
Invoke-WebRequest -Uri $url -UseBasicParsing | Select-Object -ExpandProperty Content
Start-Sleep -Milliseconds 200
}
Add (Option B β mixed profiles per row)
$ApiKey = "YOUR_API_KEY"
$Rows = Import-Csv -Path .\ips.csv
foreach ($row in $Rows) {
$ip = $row.ip_address
$profile = if ([string]::IsNullOrWhiteSpace($row.profile_name)) { "default" } else { $row.profile_name }
if ([string]::IsNullOrWhiteSpace($ip)) { continue }
$url = "https://my.cleanbrowsing.org/api?apikey=$ApiKey&action=network/add&ip_address=$ip&profile_name=$profile"
Write-Host "Adding $ip to profile=$profile"
Invoke-WebRequest -Uri $url -UseBasicParsing | Select-Object -ExpandProperty Content
Start-Sleep -Milliseconds 200
}
Remove (bulk delete)
$ApiKey = "YOUR_API_KEY"
$Profile = "default"
$Rows = Import-Csv -Path .\ips.csv
foreach ($row in $Rows) {
$ip = $row.ip_address
if ([string]::IsNullOrWhiteSpace($ip)) { continue }
$url = "https://my.cleanbrowsing.org/api?apikey=$ApiKey&action=network/delete&ip_address=$ip&profile_name=$Profile"
Write-Host "Removing $ip from profile=$Profile"
Invoke-WebRequest -Uri $url -UseBasicParsing | Select-Object -ExpandProperty Content
Start-Sleep -Milliseconds 200
}
Verify Your Changes
- List all IPs (all profiles):
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/list"
- List IPs for one profile:
curl "https://my.cleanbrowsing.org/api?apikey=YOUR_API_KEY&action=network/list&profile_nam
π¦ Push DNS Logs to a Secure SIEM with Trunc
Trunc helps you forward CleanBrowsing DNS logsβand other system logsβto a secure, cloud-hosted SIEM. Get real-time visibility, threat detection, and compliance reporting without the overhead.
Explore Trunc β