Replace Service Secrets
curl --request PUT \
--url https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"secrets": [
{
"key": "API_KEY",
"value": "s3cr3t",
"description": "payment gateway key",
"use_preview": false,
"is_sensitive": true,
"expose_to_chart": false,
"chart_default_val": null,
"dep_export": false
}
]
}
'import requests
url = "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets"
payload = { "secrets": [
{
"key": "API_KEY",
"value": "s3cr3t",
"description": "payment gateway key",
"use_preview": False,
"is_sensitive": True,
"expose_to_chart": False,
"chart_default_val": None,
"dep_export": False
}
] }
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({
secrets: [
{
key: 'API_KEY',
value: 's3cr3t',
description: 'payment gateway key',
use_preview: false,
is_sensitive: true,
expose_to_chart: false,
chart_default_val: null,
dep_export: false
}
]
})
};
fetch('https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets"
payload := strings.NewReader("{\n \"secrets\": [\n {\n \"key\": \"API_KEY\",\n \"value\": \"s3cr3t\",\n \"description\": \"payment gateway key\",\n \"use_preview\": false,\n \"is_sensitive\": true,\n \"expose_to_chart\": false,\n \"chart_default_val\": null,\n \"dep_export\": false\n }\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))
}{
"message": "<string>",
"data": {
"secrets": [
{
"key": "<string>",
"value": "<string>",
"description": "<string>",
"use_preview": true,
"is_sensitive": true,
"expose_to_chart": true,
"chart_default_val": "<string>",
"dep_export": true,
"updated_at": "2023-11-07T05:31:56Z"
}
]
}
}Secrets
Replace Service Secrets
Replace the service’s entire secret set. This is a full write and not a merge - any key you omit is removed.
Keys must be non empty after trimming and unique within the array.
PUT
/
v1
/
environments
/
{envId}
/
services
/
{serviceId}
/
secrets
Replace Service Secrets
curl --request PUT \
--url https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"secrets": [
{
"key": "API_KEY",
"value": "s3cr3t",
"description": "payment gateway key",
"use_preview": false,
"is_sensitive": true,
"expose_to_chart": false,
"chart_default_val": null,
"dep_export": false
}
]
}
'import requests
url = "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets"
payload = { "secrets": [
{
"key": "API_KEY",
"value": "s3cr3t",
"description": "payment gateway key",
"use_preview": False,
"is_sensitive": True,
"expose_to_chart": False,
"chart_default_val": None,
"dep_export": False
}
] }
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({
secrets: [
{
key: 'API_KEY',
value: 's3cr3t',
description: 'payment gateway key',
use_preview: false,
is_sensitive: true,
expose_to_chart: false,
chart_default_val: null,
dep_export: false
}
]
})
};
fetch('https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdk.localops.co/v1/environments/{envId}/services/{serviceId}/secrets"
payload := strings.NewReader("{\n \"secrets\": [\n {\n \"key\": \"API_KEY\",\n \"value\": \"s3cr3t\",\n \"description\": \"payment gateway key\",\n \"use_preview\": false,\n \"is_sensitive\": true,\n \"expose_to_chart\": false,\n \"chart_default_val\": null,\n \"dep_export\": false\n }\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))
}{
"message": "<string>",
"data": {
"secrets": [
{
"key": "<string>",
"value": "<string>",
"description": "<string>",
"use_preview": true,
"is_sensitive": true,
"expose_to_chart": true,
"chart_default_val": "<string>",
"dep_export": true,
"updated_at": "2023-11-07T05:31:56Z"
}
]
}
}Authorizations
Your account API token, sent as Authorization: Bearer <api_token>. Owners and admins can read the token from the LocalOps console.
Path Parameters
The unique identifier of the environment
The unique identifier of the service
Body
application/json
Show child attributes
Show child attributes
Was this page helpful?
⌘I