0

Invite User To Workspace

by
Published Oct 17, 2025

Invite someone to join your Workspace as a member. To invite someone as a guest, use the [Invite Guest](ref:inviteguesttoworkspace) endpoint.\ \ ***Note:** This endpoint is only available to Workspaces on our [Enterprise Plan](https://clickup.com/pricing).*

Script clickup Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Invite User To Workspace
7
 * Invite someone to join your Workspace as a member. To invite someone as a guest, use the [Invite Guest](ref:inviteguesttoworkspace) endpoint.\
8
 \
9
***Note:** This endpoint is only available to Workspaces on our [Enterprise Plan](https://clickup.com/pricing).*
10
 */
11
export async function main(
12
  auth: Clickup,
13
  team_id: string,
14
  body: { email: string; admin: false | true; custom_role_id?: number },
15
) {
16
  const url = new URL(`https://api.clickup.com/api/v2/team/${team_id}/user`);
17

18
  const response = await fetch(url, {
19
    method: "POST",
20
    headers: {
21
      "Content-Type": "application/json",
22
      Authorization: auth.token,
23
    },
24
    body: JSON.stringify(body),
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