0

Get space suggested content states

by
Published Oct 17, 2025

Get content states that are suggested in the space. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'View' 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
 * Get space suggested content states
9
 * Get content states that are suggested in the space.
10

11
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
12
'View' permission for the space.
13
 */
14
export async function main(auth: Confluence, spaceKey: string) {
15
	const url = new URL(`https://${auth.domain}/wiki/rest/api/space/${spaceKey}/state`)
16

17
	const response = await fetch(url, {
18
		method: 'GET',
19
		headers: {
20
			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
21
		},
22
		body: undefined
23
	})
24
	if (!response.ok) {
25
		const text = await response.text()
26
		throw new Error(`${response.status} ${text}`)
27
	}
28
	return await response.json()
29
}
30