Update IP zone
curl --request PUT \
--url https://api.opal.dev/v1/ip-zones/{ip_zone_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"ip_addresses": [
"<string>"
]
}
'import requests
url = "https://api.opal.dev/v1/ip-zones/{ip_zone_id}"
payload = {
"name": "<string>",
"description": "<string>",
"ip_addresses": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', ip_addresses: ['<string>']})
};
fetch('https://api.opal.dev/v1/ip-zones/{ip_zone_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opal.dev/v1/ip-zones/{ip_zone_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'ip_addresses' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.opal.dev/v1/ip-zones/{ip_zone_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.opal.dev/v1/ip-zones/{ip_zone_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/ip-zones/{ip_zone_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"ip_zone_id": "4baf8423-db0a-4037-a4cf-f79c60cb67a5",
"name": "Office network",
"description": "Egress IPs for the main office",
"ip_addresses": [
"192.168.1.1",
"10.0.0.0/24"
],
"created_by_user_id": "d4a7d928-783e-4599-8ec6-088d635a5bcc",
"created_at": "2022-01-23T04:56:07.000Z",
"updated_at": "2022-02-23T01:34:07.000Z"
}Update IP zone
Updates an IP zone. Omitted fields are left unchanged; ip_addresses, when given, replaces the zone’s whole list. While the API IP allowlist is enabled, removing the IP this request comes from rejects that token’s later requests with 403, and only the Opal web app can restore access. Admin only.
PUT
/
ip-zones
/
{ip_zone_id}
Update IP zone
curl --request PUT \
--url https://api.opal.dev/v1/ip-zones/{ip_zone_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"ip_addresses": [
"<string>"
]
}
'import requests
url = "https://api.opal.dev/v1/ip-zones/{ip_zone_id}"
payload = {
"name": "<string>",
"description": "<string>",
"ip_addresses": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', ip_addresses: ['<string>']})
};
fetch('https://api.opal.dev/v1/ip-zones/{ip_zone_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opal.dev/v1/ip-zones/{ip_zone_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'ip_addresses' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.opal.dev/v1/ip-zones/{ip_zone_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.opal.dev/v1/ip-zones/{ip_zone_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/ip-zones/{ip_zone_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"ip_zone_id": "4baf8423-db0a-4037-a4cf-f79c60cb67a5",
"name": "Office network",
"description": "Egress IPs for the main office",
"ip_addresses": [
"192.168.1.1",
"10.0.0.0/24"
],
"created_by_user_id": "d4a7d928-783e-4599-8ec6-088d635a5bcc",
"created_at": "2022-01-23T04:56:07.000Z",
"updated_at": "2022-02-23T01:34:07.000Z"
}Authorizations
Body
application/json
Response
200 - application/json
The updated IP zone.
A named list of IP addresses or CIDR ranges allowed to use API tokens while the API IP allowlist is enabled.
Was this page helpful?