0

Get the pages within a category

by
Published Oct 17, 2025

Get a pages that exist within a category in 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
 * Get the pages within a category
4
 * Get a pages that exist within a category in 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(
16
		`https://api.readme.com/v2/branches/${branch}/categories/${section}/${title}/pages`
17
	)
18

19
	const response = await fetch(url, {
20
		method: 'GET',
21
		headers: {
22
			Authorization: 'Bearer ' + auth.apiKey
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