//native
/**
* List Users
* List the workspace's people and bots. Paginate with `next_cursor` as `start_cursor`. Guests are not included.
*/
export async function main(
auth: RT.Notion,
start_cursor: string | undefined,
page_size: number | undefined
) {
const url = new URL("https://api.notion.com/v1/users")
if (start_cursor !== undefined && start_cursor !== "") {
url.searchParams.append("start_cursor", start_cursor)
}
if (page_size !== undefined) {
url.searchParams.append("page_size", String(page_size))
}
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
"Notion-Version": "2026-03-11",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 days ago