Update an environment
curl --request PATCH \
--url {schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"title": "<string>",
"attributes": {},
"parent": "<string>",
"clone_parent_on_create": true,
"http_access": {
"is_enabled": true,
"addresses": [
{
"address": "<string>"
}
],
"basic_auth": {}
},
"enable_smtp": true,
"restrict_robots": true
}
'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}"
payload = {
"name": "<string>",
"title": "<string>",
"attributes": {},
"parent": "<string>",
"clone_parent_on_create": True,
"http_access": {
"is_enabled": True,
"addresses": [{ "address": "<string>" }],
"basic_auth": {}
},
"enable_smtp": True,
"restrict_robots": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
title: '<string>',
attributes: {},
parent: '<string>',
clone_parent_on_create: true,
http_access: {is_enabled: true, addresses: [{address: '<string>'}], basic_auth: {}},
enable_smtp: true,
restrict_robots: true
})
};
fetch('{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}', 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 => "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'title' => '<string>',
'attributes' => [
],
'parent' => '<string>',
'clone_parent_on_create' => true,
'http_access' => [
'is_enabled' => true,
'addresses' => [
[
'address' => '<string>'
]
],
'basic_auth' => [
]
],
'enable_smtp' => true,
'restrict_robots' => true
]),
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 := "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"attributes\": {},\n \"parent\": \"<string>\",\n \"clone_parent_on_create\": true,\n \"http_access\": {\n \"is_enabled\": true,\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ],\n \"basic_auth\": {}\n },\n \"enable_smtp\": true,\n \"restrict_robots\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"attributes\": {},\n \"parent\": \"<string>\",\n \"clone_parent_on_create\": true,\n \"http_access\": {\n \"is_enabled\": true,\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ],\n \"basic_auth\": {}\n },\n \"enable_smtp\": true,\n \"restrict_robots\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"attributes\": {},\n \"parent\": \"<string>\",\n \"clone_parent_on_create\": true,\n \"http_access\": {\n \"is_enabled\": true,\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ],\n \"basic_auth\": {}\n },\n \"enable_smtp\": true,\n \"restrict_robots\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"code": 123
}Environment
Update an environment
Update the details of a single existing environment.
PATCH
/
projects
/
{projectId}
/
environments
/
{environmentId}
Update an environment
curl --request PATCH \
--url {schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"title": "<string>",
"attributes": {},
"parent": "<string>",
"clone_parent_on_create": true,
"http_access": {
"is_enabled": true,
"addresses": [
{
"address": "<string>"
}
],
"basic_auth": {}
},
"enable_smtp": true,
"restrict_robots": true
}
'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}"
payload = {
"name": "<string>",
"title": "<string>",
"attributes": {},
"parent": "<string>",
"clone_parent_on_create": True,
"http_access": {
"is_enabled": True,
"addresses": [{ "address": "<string>" }],
"basic_auth": {}
},
"enable_smtp": True,
"restrict_robots": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
title: '<string>',
attributes: {},
parent: '<string>',
clone_parent_on_create: true,
http_access: {is_enabled: true, addresses: [{address: '<string>'}], basic_auth: {}},
enable_smtp: true,
restrict_robots: true
})
};
fetch('{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}', 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 => "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'title' => '<string>',
'attributes' => [
],
'parent' => '<string>',
'clone_parent_on_create' => true,
'http_access' => [
'is_enabled' => true,
'addresses' => [
[
'address' => '<string>'
]
],
'basic_auth' => [
]
],
'enable_smtp' => true,
'restrict_robots' => true
]),
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 := "{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"attributes\": {},\n \"parent\": \"<string>\",\n \"clone_parent_on_create\": true,\n \"http_access\": {\n \"is_enabled\": true,\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ],\n \"basic_auth\": {}\n },\n \"enable_smtp\": true,\n \"restrict_robots\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"attributes\": {},\n \"parent\": \"<string>\",\n \"clone_parent_on_create\": true,\n \"http_access\": {\n \"is_enabled\": true,\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ],\n \"basic_auth\": {}\n },\n \"enable_smtp\": true,\n \"restrict_robots\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/environments/{environmentId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"title\": \"<string>\",\n \"attributes\": {},\n \"parent\": \"<string>\",\n \"clone_parent_on_create\": true,\n \"http_access\": {\n \"is_enabled\": true,\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ],\n \"basic_auth\": {}\n },\n \"enable_smtp\": true,\n \"restrict_robots\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"code": 123
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The name of the environment
The title of the environment
Arbitrary attributes attached to this resource
Show child attributes
Show child attributes
The type of environment (production, staging or development), if not provided, a default will be calculated
Available options:
development, production, staging The name of the parent environment
Clone data when creating that environment
The HTTP access permissions for this environment
Show child attributes
Show child attributes
Whether to configure SMTP for this environment
Whether to restrict robots for this environment
Last modified on June 16, 2026
Was this page helpful?
⌘I