0

Edit a secret belonging to the project

by
Published Oct 17, 2025

- You can't edit a BUILT_IN secret - For an override, you can't edit the key - For an alias, you can't edit the value - An override can only have a scope lower to the secret it is overriding (hierarchy is BUILT_IN > PROJECT > ENVIRONMENT > APPLICATION)

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Edit a secret belonging to the project
4
 * - You can't edit a BUILT_IN secret
5
- For an override, you can't edit the key
6
- For an alias, you can't edit the value
7
- An override can only have a scope lower to the secret it is overriding (hierarchy is BUILT_IN > PROJECT > ENVIRONMENT > APPLICATION)
8

9
 */
10
export async function main(auth: RT.Qovery, projectId: string, secretId: string, body: Body) {
11
	const url = new URL(`https://api.qovery.com/project/${projectId}/secret/${secretId}`)
12

13
	const response = await fetch(url, {
14
		method: 'PUT',
15
		headers: {
16
			'Content-Type': 'application/json',
17
			Authorization: 'Token ' + auth.apiKey
18
		},
19
		body: JSON.stringify(body)
20
	})
21
	if (!response.ok) {
22
		const text = await response.text()
23
		throw new Error(`${response.status} ${text}`)
24
	}
25
	return await response.json()
26
}
27

28
/* eslint-disable */
29
/**
30
 * This file was automatically generated by json-schema-to-typescript.
31
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
32
 * and run json-schema-to-typescript to regenerate this file.
33
 */
34

35
export interface Body {
36
	value?: string
37
	key: string
38
	/**
39
	 * optional variable description (255 characters maximum)
40
	 */
41
	description?: string
42
	enable_interpolation_in_file?: boolean
43
	[k: string]: unknown
44
}
45