Network Subnets API Code Samples
Selection of code samples that demonstrate the use of the Network Subnets API. Copy and edit these code samples to suit your needs.
When using the code samples, remember to replace:
- {vanity_name} with your tenant name
- {api_key} with your API key
- {security_token} with a valid security token
These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "Network Subnets" in API Reference.
Retrieve a list of API network subnets
Use this sample request to retrieve all the IP addresses that can call Visier APIs.
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
The response returns the IP addresses that are allowed to call Visier APIs.

{
"networkSubnetsForApi": ["1.2.0.0/16"]
}
Update API network subnets
Use this sample request to replace the existing list of allowed IP addresses with a new list of allowed IP addresses.
curl -X PUT --url 'https://{vanity_name}.api.visier/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
-d '{
"networkSubnetsForApi": ["1.2.3.0/24"],
"confirmLockout": true
}'
The response returns the IP addresses that are allowed to call Visier APIs.

{
"networkSubnetsForApi": ["1.2.3.0/24"]
}
Add API network subnets
Use this sample request to add the specified IP addresses to the list of allowed IP addresses.
curl -X POST --url 'https://{vanity_name}.api.visier/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
"networkSubnetsForApi": ["1.2.3.0/24"],
"confirmLockout": true
}'
The response returns the IP addresses that are allowed to call Visier APIs.

{
"networkSubnetsForApi": ["1.2.0.0/16", "1.2.3.0/24"]
}
Delete API network subnets
Use this sample request to remove the specified IP addresses from the list of allowed IP addresses. Users cannot call Visier APIs from the removed IP addresses.
curl -X DELETE --url 'https://{vanity_name}.api.visier/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
"networkSubnetsForApi": ["1.2.3.0/24"],
"confirmLockout": true
}'
The response returns the IP addresses that are allowed to call Visier APIs.

{
"networkSubnetsForApi": ["1.2.0.0/16"]
}