0

Reset look and feel settings

by
Published Oct 17, 2025

Resets the custom look and feel settings for the site or a single space. This changes the values of the custom settings to be the same as the default settings. It does not change which settings (default or custom) are selected. Note, the default space settings are inherited from the current global settings. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Admin' permission for the space.

Script confluence
  • Submitted by hugo697 Bun
    Created 284 days ago
    1
    //native
    2
    type Confluence = {
    3
    	email: string
    4
    	apiToken: string
    5
    	domain: string
    6
    }
    7
    /**
    8
     * Reset look and feel settings
    9
     * Resets the custom look and feel settings for the site or a single space.
    10
    This changes the values of the custom settings to be the same as the
    11
    default settings. It does not change which settings (default or custom)
    12
    are selected. Note, the default space settings are inherited from the
    13
    current global settings.
    14
    
    
    15
    **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
    16
    'Admin' permission for the space.
    17
     */
    18
    export async function main(auth: Confluence, spaceKey: string | undefined) {
    19
    	const url = new URL(`https://${auth.domain}/wiki/rest/api/settings/lookandfeel/custom`)
    20
    	for (const [k, v] of [['spaceKey', spaceKey]]) {
    21
    		if (v !== undefined && v !== '' && k !== undefined) {
    22
    			url.searchParams.append(k, v)
    23
    		}
    24
    	}
    25
    	const response = await fetch(url, {
    26
    		method: 'DELETE',
    27
    		headers: {
    28
    			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
    29
    		},
    30
    		body: undefined
    31
    	})
    32
    	if (!response.ok) {
    33
    		const text = await response.text()
    34
    		throw new Error(`${response.status} ${text}`)
    35
    	}
    36
    	return await response.text()
    37
    }
    38