The "Add team member" endpoint (described below) is deprecated.
We recommend using the Add team membership endpoint instead. It allows you to invite new organization members to your teams.
To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization.
PUT /teams/:team_id/members/:username
Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
Status: 204 No Content
Status: 422 Unprocessable Entity
{
"message": "Cannot add an organization as a member.",
"errors": [
{
"code": "org",
"field": "user",
"resource": "TeamMember"
}
]
}
Status: 422 Unprocessable Entity
{
"message": "User isn't a member of this organization. Please invite them first.",
"errors": [
{
"code": "unaffiliated",
"field": "user",
"resource": "TeamMember"
}
]
}