0

Get user properties

by
Published Oct 17, 2025

Returns the properties for a user as list of property keys. For more information about user properties, see [Confluence entity properties](https://developer.atlassian.com/cloud/confluence/confluence-entity-properties/). `Note`, these properties stored against a user are on a Confluence site level and not space/content level. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: Permission to access the Confluence site ('Can use' global permission).

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 user properties
9
 * Returns the properties for a user as list of property keys. For more information
10
about user properties, see [Confluence entity properties](https://developer.atlassian.com/cloud/confluence/confluence-entity-properties/).
11
`Note`, these properties stored against a user are on a Confluence site level and not space/content level.
12

13
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
14
Permission to access the Confluence site ('Can use' global permission).
15
 */
16
export async function main(
17
	auth: Confluence,
18
	userId: string,
19
	start: string | undefined,
20
	limit: string | undefined
21
) {
22
	const url = new URL(`https://${auth.domain}/wiki/rest/api/user/${userId}/property`)
23
	for (const [k, v] of [
24
		['start', start],
25
		['limit', limit]
26
	]) {
27
		if (v !== undefined && v !== '' && k !== undefined) {
28
			url.searchParams.append(k, v)
29
		}
30
	}
31
	const response = await fetch(url, {
32
		method: 'GET',
33
		headers: {
34
			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
35
		},
36
		body: undefined
37
	})
38
	if (!response.ok) {
39
		const text = await response.text()
40
		throw new Error(`${response.status} ${text}`)
41
	}
42
	return await response.json()
43
}
44