0

Select look and feel settings

by
Published Oct 17, 2025

Sets the look and feel settings to the default (global) settings, the custom settings, or the current theme's settings for a space. The custom and theme settings can only be selected if there is already a theme set for a space. 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
     * Select look and feel settings
    9
     * Sets the look and feel settings to the default (global) settings, the
    10
    custom settings, or the current theme's settings for a space.
    11
    The custom and theme settings can only be selected if there is already
    12
    a theme set for a space. Note, the default space settings are inherited
    13
    from the 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(
    19
    	auth: Confluence,
    20
    	body: { spaceKey: string; lookAndFeelType: 'global' | 'custom' | 'theme' }
    21
    ) {
    22
    	const url = new URL(`https://${auth.domain}/wiki/rest/api/settings/lookandfeel`)
    23
    
    
    24
    	const response = await fetch(url, {
    25
    		method: 'PUT',
    26
    		headers: {
    27
    			'Content-Type': 'application/json',
    28
    			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
    29
    		},
    30
    		body: JSON.stringify(body)
    31
    	})
    32
    	if (!response.ok) {
    33
    		const text = await response.text()
    34
    		throw new Error(`${response.status} ${text}`)
    35
    	}
    36
    	return await response.json()
    37
    }
    38