Create or replace a secret
PUT
/api/v3/organizations/{api_organisation}/applications/{api_application}/environments/{api_environment}/secrets/{api_secret}
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/test-org/applications/test-app/environments/test-env/secrets/DB_PASSWORD';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"value":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://dashboard.quantcdn.io/api/v3/organizations/test-org/applications/test-app/environments/test-env/secrets/DB_PASSWORD \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "value": "example" }'Sets the secret value. The value is write-only: the response returns the key only. The change takes effect on the next redeploy of the environment. A name that already exists as an environment variable is refused with 409.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”api_organisation
required
string
The organisation ID
Example
test-orgapi_application
required
string
The application ID
Example
test-appapi_environment
required
string
The environment ID
Example
test-envapi_secret
required
string
The secret key
Example
DB_PASSWORDRequest Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
value
required
string format: password
Examplegenerated
{ "value": "example"}Responses
Section titled “Responses”The secret is set. It takes effect on the next redeploy.
Media typeapplication/json
object
key
required
The secret name
string
warnings
Notices from Quant Cloud about the change. Present only when there is at least one.
Array<string>
Example
{ "key": "DB_PASSWORD"}The name already exists as an environment variable
Media typeapplication/json
object
message
required
string
Example
{ "message": "Cannot create/update secret 'DB_PASSWORD' as it already exists as an environment variable."}The key or the value is not valid
