0

Get retention period

by
Published Oct 17, 2025

Returns the retention period for records in the audit log. The retention period is how long an audit record is kept for, from creation date until it is deleted. **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: 'Confluence Administrator' global permission.

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
     * Get retention period
    9
     * Returns the retention period for records in the audit log. The retention
    10
    period is how long an audit record is kept for, from creation date until
    11
    it is deleted.
    12
    
    
    13
    **[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
    14
    'Confluence Administrator' global permission.
    15
     */
    16
    export async function main(auth: Confluence) {
    17
    	const url = new URL(`https://${auth.domain}/wiki/rest/api/audit/retention`)
    18
    
    
    19
    	const response = await fetch(url, {
    20
    		method: 'GET',
    21
    		headers: {
    22
    			Authorization: 'Basic ' + btoa(`${auth.email}:${auth.apiToken}`)
    23
    		},
    24
    		body: undefined
    25
    	})
    26
    	if (!response.ok) {
    27
    		const text = await response.text()
    28
    		throw new Error(`${response.status} ${text}`)
    29
    	}
    30
    	return await response.json()
    31
    }
    32