POST
/
v1
/
teams
/
{teamId}
/
members
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.teams.inviteUserToTeam({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    requestBody: {
      uid: "kr1PsOIzqEL5Xg6M4VZcZosf",
      email: "john@example.com",
      projects: [
        {
          projectId: "prj_ndlgr43fadlPyCtREAqxxdyFK",
          role: "ADMIN",
        },
        {
          projectId: "prj_ndlgr43fadlPyCtREAqxxdyFK",
          role: "ADMIN",
        },
      ],
    },
  });

  // Handle the result
  console.log(result);
}

run();
{
  "uid": "kr1PsOIzqEL5Xg6M4VZcZosf",
  "username": "john-doe",
  "email": "john@user.co",
  "role": "MEMBER",
  "teamRoles": [
    "MEMBER"
  ],
  "teamPermissions": [
    "CreateProject"
  ]
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

teamId
string
required

The unique team identifier

Example:

"team_1a2b3c4d5e6f7g8h9i0j1k2l"

Body

application/json
uid
string

The id of the user to invite

Example:

"kr1PsOIzqEL5Xg6M4VZcZosf"

email
string

The email address of the user to invite

Example:

"john@example.com"

role
enum<string>
default:MEMBER

The role of the user to invite

Available options:
OWNER,
MEMBER,
DEVELOPER,
SECURITY,
BILLING,
VIEWER,
CONTRIBUTOR
Example:
[
  "OWNER",
  "MEMBER",
  "DEVELOPER",
  "SECURITY",
  "BILLING",
  "VIEWER",
  "CONTRIBUTOR"
]
projects
object[]

Response

200
application/json

The member was successfully added to the team

uid
string
required

The ID of the invited user

Example:

"kr1PsOIzqEL5Xg6M4VZcZosf"

username
string
required

The username of the invited user

Example:

"john-doe"

role
enum<string>
required

The role used for the invitation

Available options:
OWNER,
MEMBER,
DEVELOPER,
SECURITY,
BILLING,
VIEWER,
CONTRIBUTOR
Example:

"MEMBER"

email
string

The email of the invited user. Not included if the user was invited via their UID.

Example:

"john@user.co"

teamRoles
enum<string>[]

The team roles of the user

The team roles of the user

Available options:
OWNER,
MEMBER,
DEVELOPER,
SECURITY,
BILLING,
VIEWER,
CONTRIBUTOR
Example:
["MEMBER"]
teamPermissions
enum<string>[]

The team permissions of the user

The team permissions of the user

Available options:
CreateProject,
FullProductionDeployment,
UsageViewer,
EnvVariableManager,
EnvironmentManager
Example:
["CreateProject"]