Adding an IP address or subnet to a user's whitelist allows authorized administrators to define which public IPs are permitted to access the Vultr platform on that user’s behalf. This action is restricted to root users or those granted the manage_users permission, maintaining strict access control. Only public IP addresses are allowed, with valid subnet ranges of /8
to /32
for IPv4 and /20
to /128
for IPv6. The operation is idempotent—repeated additions of the same IP or subnet do not result in errors, making it safe for use in automated access management scripts.
Follow this guide to add IP addresses for a user's whitelist using the Vultr API.
Send a GET
request to the Get Users endpoint to view all users and note the user id for the target user.
$ curl "https://api.vultr.com/v2/users" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a POST
request to the Add IP to User Whitelist endpoint to add IP addresses in the user's whitelist.
$ curl "https://api.vultr.com/v2/users/{user-id}/ip-whitelist" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"subnet" : "8.8.8.0",
"subnet_size" : 24
}'
Send a GET
request to the List User IP Whitelist endpoint to list confirm the addition of IP addresses.
$ curl "https://api.vultr.com/v2/users/{user-id}/ip-whitelist" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
No comments yet.