0

Gets available content states for content.

by
Published Oct 17, 2025

Gets content states that are available for the content to be set as. Will return all enabled Space Content States. Will only return most the 3 most recently published custom content states to match UI editor list. To get all custom content states, use the /content-states endpoint. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to edit the content.

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
 * Gets available content states for content.
9
 * Gets content states that are available for the content to be set as.
10
Will return all enabled Space Content States.
11
Will only return most the 3 most recently published custom content states to match UI editor list.
12
To get all custom content states, use the /content-states endpoint.
13

14
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
15
Permission to edit the content.
16
 */
17
export async function main(auth: Confluence, id: string) {
18
	const url = new URL(`https://${auth.domain}/wiki/rest/api/content/${id}/state/available`)
19

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