0

Delete a category

by
Published Oct 17, 2025

Delete a category from your ReadMe project. >📘 > This route is only available to projects that are using [ReadMe Refactored](https://docs.readme.com/main/docs/welcome-to-readme-refactored).

Script readme Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Delete a category
4
 * Delete a category from your ReadMe project.
5

6
>📘
7
> This route is only available to projects that are using [ReadMe Refactored](https://docs.readme.com/main/docs/welcome-to-readme-refactored).
8
 */
9
export async function main(
10
	auth: RT.Readme,
11
	section: 'guides' | 'reference' = 'guides',
12
	title: string,
13
	branch: string
14
) {
15
	const url = new URL(`https://api.readme.com/v2/branches/${branch}/categories/${section}/${title}`)
16

17
	const response = await fetch(url, {
18
		method: 'DELETE',
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