0

Trigger maintenance run

by
Published Oct 17, 2025

Trigger the scheduled maintenance run with the provided ID. Triggering maintenance is asynchronous. To check whether maintenance has started, use the [Retrieve maintenance run](https://api-docs.render.com/reference/retrieve-maintenance) endpoint. As maintenance progresses, the run's `state` will change from `scheduled` to other values, such as `in_progress` and `succeeded`.

Script render Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Render = {
3
	apiKey: string
4
}
5
/**
6
 * Trigger maintenance run
7
 * Trigger the scheduled maintenance run with the provided ID.
8

9
Triggering maintenance is asynchronous. To check whether maintenance has started, use the [Retrieve maintenance run](https://api-docs.render.com/reference/retrieve-maintenance) endpoint.
10

11
As maintenance progresses, the run's `state` will change from `scheduled` to other values, such as `in_progress` and `succeeded`.
12

13
 */
14
export async function main(auth: Render, maintenanceRunParam: string) {
15
	const url = new URL(`https://api.render.com/v1/maintenance/${maintenanceRunParam}/trigger`)
16

17
	const response = await fetch(url, {
18
		method: 'POST',
19
		headers: {
20
			Authorization: 'Bearer ' + auth.apiKey
21
		},
22
		body: undefined
23
	})
24
	if (!response.ok) {
25
		const text = await response.text()
26
		throw new Error(`${response.status} ${text}`)
27
	}
28
	return await response.text()
29
}
30