0

Retrieve User

by
Published today

Get a person or bot by user ID.

Script notion Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 3 hours ago
1
//native
2

3
/**
4
 * Retrieve User
5
 * Get a person or bot by user ID. Needs the user information capability; emails need the capability that includes them.
6
 */
7
export async function main(auth: RT.Notion, user_id: string) {
8
  const response = await fetch(`https://api.notion.com/v1/users/${user_id}`, {
9
    headers: {
10
      Authorization: `Bearer ${auth.token}`,
11
      Accept: "application/json",
12
      "Notion-Version": "2026-03-11",
13
    },
14
  })
15

16
  if (!response.ok) {
17
    throw new Error(`${response.status} ${await response.text()}`)
18
  }
19

20
  return await response.json()
21
}
22