0

Reset space theme

by
Published Oct 17, 2025

Resets the space theme. This means that the space will inherit the global look and feel 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 space theme
    9
     * Resets the space theme. This means that the space will inherit the
    10
    global look and feel settings
    11
    
    
    12
    **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
    13
    'Admin' permission for the space.
    14
     */
    15
    export async function main(auth: Confluence, spaceKey: string) {
    16
    	const url = new URL(`https://${auth.domain}/wiki/rest/api/space/${spaceKey}/theme`)
    17
    
    
    18
    	const response = await fetch(url, {
    19
    		method: 'DELETE',
    20
    		headers: {
    21
    			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
    22
    		},
    23
    		body: undefined
    24
    	})
    25
    	if (!response.ok) {
    26
    		const text = await response.text()
    27
    		throw new Error(`${response.status} ${text}`)
    28
    	}
    29
    	return await response.text()
    30
    }
    31