Add Users to a Team
Adds one or more users to a specified team, assigning each a role and optional team manager status.
Endpoint
PUT
v5/accountuser/{user_id}/teams
Requires authentication
Path Parameters
This identifies which user will be added to a team.
user_id
string
required
The ID of the user to add to a team.
Body
The request body is an array of user-team request objects, one object per team.
team_id
string
required
The team ID of the team to add the user to.
role_id
string
required
The role ID to assign to the user.
is_team_manager
boolean
Whether the user should be set as a team manager. Defaults to
false.Response
The response includes an overall status plus per-team result objects in the data array.
result_ok
boolean
Whether the overall request succeeded.
code
integer
Status code.
200 = success, 400 = error.message
string
A message describing the result.
data
array
An array of per-team result objects.
child attributes
team_id
string
The ID of the team the user was added to.
result_ok
boolean
Whether the operation succeeded for this team.
code
integer
Status code for this team.
200 = success, 400 = error.message
string
A message with details about this team's result.
Examples
Request (cURL)
curl -X PUT "https://api.alchemer.com/v5/accountuser/1/teams?api_token=YOUR_API_TOKEN&api_token_secret=YOUR_API_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
"teams": [
{
"team_id": "12345",
"is_team_manager": true,
"role_id": "4"
}
]
}'
Success Response
{
"result_ok": true,
"code": 200,
"message": "Added user to 1 teams.",
"data": [
{
"team_id": "12345",
"result_ok": true,
"code": 200,
"message": "Added user to team."
}
]
}
Error Response
{
"result_ok": false,
"code": 400,
"message": "Failed to add all users to team. See data for details.",
"data": [
{
"team_id": "12345",
"result_ok": false,
"code": 400,
"message": "Failed to add user to team. User id 1 not found."
}
]
}