POST
/
users
/
{userId}
/
groups
curl --request POST \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890/groups' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv' \
--header 'Content-Type: application/json' \
--data '{
"groups": [1, 2, 3]
}'
{
    "groups": [
{
    "id": 1,
    "parentId": null,
    "name": "Sales Team",
    "usersCount": 15,
    "coursesCount": 5,
    "image": null,
    "attributes": {}
},
{
    "id": 2,
    "parentId": 1,
    "name": "Regional Sales",
    "usersCount": 8,
    "coursesCount": 3,
    "image": null,
    "attributes": {}
}
    ]
}
Add a user to one or more groups.

Request Headers

X-API-KEY
string
required
API Key. Go to your Konstantly site > Settings > API and copy the value from there.

URL Parameters

userId
string
required
User API ID

Request Body

groups
array
required
Array of group IDs to add the user to

Response

groups
array
required
Array of groups the user was added to

Error Responses

400
object
Validation error response
404
object
Not Found error response
curl --request POST \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890/groups' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv' \
--header 'Content-Type: application/json' \
--data '{
"groups": [1, 2, 3]
}'
{
    "groups": [
{
    "id": 1,
    "parentId": null,
    "name": "Sales Team",
    "usersCount": 15,
    "coursesCount": 5,
    "image": null,
    "attributes": {}
},
{
    "id": 2,
    "parentId": 1,
    "name": "Regional Sales",
    "usersCount": 8,
    "coursesCount": 3,
    "image": null,
    "attributes": {}
}
    ]
}