Add Users to the Team Using the API
You can invite new members to the team using this endpoint. It's the same as if the admin goes to the Team Settings page and uses this modal to invite users:
POST https://api.getguru.com/api/v1/members/invite
This call must be done as a team admin.
The request payload must include an email address. It can be a comma-separated list of email addresses. Here's how you'd invite a single user:
{
"emails": "user@example.com",
"groupId": null
}
And here's how you'd invite three users:
{
"emails": "one@example.com,two@example.com,three@example.com",
"groupId": null
}
The groupId
is optional. If used, it's a single group ID (e.g. 05a2b7f3-544e-482c-a438-753b2a22319e
) and all users who are invited are added to that group. If you want to assign the new users to multiple groups, you'll have to use the API for adding users to groups.
The response indicates the status for each email that was provided. It's possible that some users will be added and others not -- most often this happens because a user is already a member of the team.
{
"statuses" : [ {
"errored" : true,
"email" : "user1@example.com",
"error" : "This user is already a part of the team"
}, {
"email" : "user2@example.com"
} ]
}
That example shows a response if you tried to invite two users and one was already on the team. The second object in the list, the one that only has "email" : "user2@example.com"
means that user2 was successfully added to the team.