Update a project variable
curl --request PATCH \
--url {schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"attributes": {},
"value": "<string>",
"is_json": true,
"is_sensitive": true,
"visible_build": true,
"visible_runtime": true,
"application_scope": [
"<string>"
]
}
'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}"
payload = {
"name": "<string>",
"attributes": {},
"value": "<string>",
"is_json": True,
"is_sensitive": True,
"visible_build": True,
"visible_runtime": True,
"application_scope": ["<string>"]
}
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>',
attributes: {},
value: '<string>',
is_json: true,
is_sensitive: true,
visible_build: true,
visible_runtime: true,
application_scope: ['<string>']
})
};
fetch('{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}', 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}/variables/{projectVariableId}",
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>',
'attributes' => [
],
'value' => '<string>',
'is_json' => true,
'is_sensitive' => true,
'visible_build' => true,
'visible_runtime' => true,
'application_scope' => [
'<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 := "{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"attributes\": {},\n \"value\": \"<string>\",\n \"is_json\": true,\n \"is_sensitive\": true,\n \"visible_build\": true,\n \"visible_runtime\": true,\n \"application_scope\": [\n \"<string>\"\n ]\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}/variables/{projectVariableId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"attributes\": {},\n \"value\": \"<string>\",\n \"is_json\": true,\n \"is_sensitive\": true,\n \"visible_build\": true,\n \"visible_runtime\": true,\n \"application_scope\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}")
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 \"attributes\": {},\n \"value\": \"<string>\",\n \"is_json\": true,\n \"is_sensitive\": true,\n \"visible_build\": true,\n \"visible_runtime\": true,\n \"application_scope\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"code": 123
}Project Variables
Update a project variable
Update a single user-defined project variable.
The value can be either a string or a JSON
object (default: string), as specified by the is_json boolean flag.
See the Variables
section in our documentation for more information.
PATCH
/
projects
/
{projectId}
/
variables
/
{projectVariableId}
Update a project variable
curl --request PATCH \
--url {schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"attributes": {},
"value": "<string>",
"is_json": true,
"is_sensitive": true,
"visible_build": true,
"visible_runtime": true,
"application_scope": [
"<string>"
]
}
'import requests
url = "{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}"
payload = {
"name": "<string>",
"attributes": {},
"value": "<string>",
"is_json": True,
"is_sensitive": True,
"visible_build": True,
"visible_runtime": True,
"application_scope": ["<string>"]
}
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>',
attributes: {},
value: '<string>',
is_json: true,
is_sensitive: true,
visible_build: true,
visible_runtime: true,
application_scope: ['<string>']
})
};
fetch('{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}', 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}/variables/{projectVariableId}",
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>',
'attributes' => [
],
'value' => '<string>',
'is_json' => true,
'is_sensitive' => true,
'visible_build' => true,
'visible_runtime' => true,
'application_scope' => [
'<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 := "{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"attributes\": {},\n \"value\": \"<string>\",\n \"is_json\": true,\n \"is_sensitive\": true,\n \"visible_build\": true,\n \"visible_runtime\": true,\n \"application_scope\": [\n \"<string>\"\n ]\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}/variables/{projectVariableId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"attributes\": {},\n \"value\": \"<string>\",\n \"is_json\": true,\n \"is_sensitive\": true,\n \"visible_build\": true,\n \"visible_runtime\": true,\n \"application_scope\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{schemes}://api.upsun.com/projects/{projectId}/variables/{projectVariableId}")
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 \"attributes\": {},\n \"value\": \"<string>\",\n \"is_json\": true,\n \"is_sensitive\": true,\n \"visible_build\": true,\n \"visible_runtime\": true,\n \"application_scope\": [\n \"<string>\"\n ]\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
Name of the variable
Arbitrary attributes attached to this resource
Show child attributes
Show child attributes
Value of the variable
The variable is a JSON string
The variable is sensitive
The variable is visible during build
The variable is visible at runtime
Applications that have access to this variable
Last modified on June 16, 2026
Was this page helpful?
⌘I