0

Update project

by
Published Oct 17, 2025

Update the details of a project. To update the details of a particular _environment_ in the project, instead use the [Update environment](https://api-docs.render.com/reference/update-environment) endpoint.

Script render Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Render = {
3
	apiKey: string
4
}
5
/**
6
 * Update project
7
 * Update the details of a project.
8

9
To update the details of a particular _environment_ in the project, instead use the [Update environment](https://api-docs.render.com/reference/update-environment) endpoint.
10

11
 */
12
export async function main(auth: Render, projectId: string, body: { name?: string }) {
13
	const url = new URL(`https://api.render.com/v1/projects/${projectId}`)
14

15
	const response = await fetch(url, {
16
		method: 'PATCH',
17
		headers: {
18
			'Content-Type': 'application/json',
19
			Authorization: 'Bearer ' + auth.apiKey
20
		},
21
		body: JSON.stringify(body)
22
	})
23
	if (!response.ok) {
24
		const text = await response.text()
25
		throw new Error(`${response.status} ${text}`)
26
	}
27
	return await response.json()
28
}
29