Invite a user
POST
https://api.vercel.com/v2/teams/{teamId}/membersInvite a user to join the team specified in the URL. The authenticated user needs to be an
OWNER in order to successfully invoke this endpoint. The user to be invited must be specified by email.Request
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", slug: "my-team-url-slug", requestBody: [ { email: "john@example.com", role: "DEVELOPER", projects: [ { projectId: "prj_ndlgr43fadlPyCtREAqxxdyFK", role: "ADMIN", }, { projectId: "prj_ndlgr43fadlPyCtREAqxxdyFK", role: "ADMIN", }, ], }, ], });
console.log(result);}
run();Response
{ "email": "john@user.co", "role": "MEMBER", "teamPermissions": [], "teamRoles": [], "uid": "kr1PsOIzqEL5Xg6M4VZcZosf", "username": "john-doe"}AuthorizationbearerToken
Default authentication mechanism
200Success
400One of the provided values in the request body is invalid.
One of the provided values in the request query is invalid.
401The request is not authorized.
403You do not have permission to access this resource.
The authenticated user must be a team owner to perform the action
404Error
410Error
503Error