0

Delete user property

by
Published Oct 17, 2025

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

14
**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
15
Permission to access the Confluence site ('Can use' global permission).
16
 */
17
export async function main(auth: Confluence, userId: string, key: string) {
18
	const url = new URL(`https://${auth.domain}/wiki/rest/api/user/${userId}/property/${key}`)
19

20
	const response = await fetch(url, {
21
		method: 'DELETE',
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.text()
32
}
33