secret
Update a secret
Updates the value of an existing secret in one or more environments. Pass only the environments you want to change. Triggers any configured syncs for the affected environments.
PUT
/
v1
/
workspace
/
{ws}
/
project
/
{prj}
/
secret
/
{secretId}
cURL
curl -X PUT 'http://localhost:8080/v1/workspace/ws_example/project/prj_example/secret/sec_example' \
-H 'Authorization: Bearer ek_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{ // request body fields, see schema }'const response = await fetch('http://localhost:8080/v1/workspace/ws_example/project/prj_example/secret/sec_example', {
method: 'PUT',
headers: {
Authorization: 'Bearer ek_live_xxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
// request body fields, see schema
}),
});
const data = await response.json();import requests
response = requests.put(
'http://localhost:8080/v1/workspace/ws_example/project/prj_example/secret/sec_example',
headers={
'Authorization': 'Bearer ek_live_xxxxx',
'Content-Type': 'application/json',
},
json={
# request body fields, see schema
},
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}",
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>',
'values' => [
[
'environmentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'value' => '<string>',
'isPersonal' => true
]
],
'note' => '<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 := "http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"values\": [\n {\n \"environmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\",\n \"isPersonal\": true\n }\n ],\n \"note\": \"<string>\"\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("http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"values\": [\n {\n \"environmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\",\n \"isPersonal\": true\n }\n ],\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"values\": [\n {\n \"environmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\",\n \"isPersonal\": true\n }\n ],\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Authorizations
API key authentication. Pass Authorization: Bearer ek_live_xxxxx on every request.
Body
application/json
Response
200 - application/json
Default Response
Previous
Delete a secretDeletes a secret and all of its environment values. The operation is logged in the audit trail. Cannot be undone. Recreate the secret to restore it.
Next
⌘I
cURL
curl -X PUT 'http://localhost:8080/v1/workspace/ws_example/project/prj_example/secret/sec_example' \
-H 'Authorization: Bearer ek_live_xxxxx' \
-H 'Content-Type: application/json' \
-d '{ // request body fields, see schema }'const response = await fetch('http://localhost:8080/v1/workspace/ws_example/project/prj_example/secret/sec_example', {
method: 'PUT',
headers: {
Authorization: 'Bearer ek_live_xxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
// request body fields, see schema
}),
});
const data = await response.json();import requests
response = requests.put(
'http://localhost:8080/v1/workspace/ws_example/project/prj_example/secret/sec_example',
headers={
'Authorization': 'Bearer ek_live_xxxxx',
'Content-Type': 'application/json',
},
json={
# request body fields, see schema
},
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}",
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>',
'values' => [
[
'environmentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'value' => '<string>',
'isPersonal' => true
]
],
'note' => '<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 := "http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"values\": [\n {\n \"environmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\",\n \"isPersonal\": true\n }\n ],\n \"note\": \"<string>\"\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("http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"values\": [\n {\n \"environmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\",\n \"isPersonal\": true\n }\n ],\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/v1/workspace/{ws}/project/{prj}/secret/{secretId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"values\": [\n {\n \"environmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\",\n \"isPersonal\": true\n }\n ],\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}