0

Update space settings

by
Published Oct 17, 2025

Updates the settings for a space. Currently only the `routeOverrideEnabled` setting can be updated. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.

Script confluence Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Confluence = {
3
	email: string
4
	apiToken: string
5
	domain: string
6
}
7
/**
8
 * Update space settings
9
 * Updates the settings for a space. Currently only the
10
`routeOverrideEnabled` setting can be updated.
11

12
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
13
'Admin' permission for the space.
14
 */
15
export async function main(
16
	auth: Confluence,
17
	spaceKey: string,
18
	body: { routeOverrideEnabled?: false | true }
19
) {
20
	const url = new URL(`https://${auth.domain}/wiki/rest/api/space/${spaceKey}/settings`)
21

22
	const response = await fetch(url, {
23
		method: 'PUT',
24
		headers: {
25
			'Content-Type': 'application/json',
26
			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
27
		},
28
		body: JSON.stringify(body)
29
	})
30
	if (!response.ok) {
31
		const text = await response.text()
32
		throw new Error(`${response.status} ${text}`)
33
	}
34
	return await response.json()
35
}
36