Groups
Use the SCIM API requests to create groups, manage users within it, and perform other operations on groups.
Create Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/GroupsThe Create Group request lets you create a group in your IdP client and add users to it.
In the "Request Body" section, you need to pass the ID of the user in Contentstack as the value. Refer to the Get All Users request to get the user ID. Also, provide a name to the group in the displayName key.
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
"displayName": "<{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
"id": "blt*********",
"meta": {
"resourceType": "Group",
"created": "2020-11-24T05:48:14.060Z",
"lastModified": "2011-05-13T04:42:34Z",
"location": "http://auth-api.contentstack.com/scim/v2/organizations/blt**********/groups/blt**********"
},
"displayName": "Get All Groups
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/GroupsThe Get All Groups request fetches details of all groups that exist in the IdP client account.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 1,
"startIndex": 2,
"itemsPerPage": 100,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "blt2**********",
"meta": {
"resourceType": "Group",
"created": "2020-11-24T05:48:14.060Z",
"location": "http://localhost:8000/scim/v2/organizations/blta********/groups/blt2********"
},
"displayName": "MyGroup",
"active": true,
"members": [
{
"value": "Get Single Group By ID
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Get Single Group by ID request fetches details of a single group that exists in the IdP client account.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 100,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "blt**********",
"meta": {
"resourceType": "Group",
"created": "2020-11-24T05:48:14.060Z",
"location": "http://auth-api.contentstack.com/scim/v2/organizations/blta6********/groups/blt22**********"
},
"displayName": "Get Single Group By Display Name
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups?filter=displayName Eq "<<group_name>>"The Get Single Group By Display Name returns comprehensive details of a specific group that exists in the IdP client account, which is mapped in your Contentstack organization.
You need to pass the displayname as a query parameter.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 100,
"Resources": [
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "601**************",
"displayName": "<Add Users to Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Add Users to Group request adds the user(s) to a group.
The specified user will then have the permissions (at the stack level and at the organization level) that are specific to that group.
In the "Request Body", you need to pass the ID of the user in the value key.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "add",
"path": "members",
"value": [
{
"value": "{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "60************",
"displayName": "mygroup",
"members": [
{
"value": "blt*********",
"display": "Rename Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Rename Group request lets you change the name of a group.
In the "Request Body", you need to pass a new name for the group in the value key.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "replace",
"path": "displayName",
"value": "<{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "602***************",
"displayName": "<Remove All Users from Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Remove All Users from Group request removes all the existing users from a group.
This also revokes admin access for users with admin roles, unless those users have been assigned the admin role by some other group. The same logic applies to stack roles as well.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "remove",
"path": "members"
}
]
}{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "602***************",
"displayName": "<Remove User from Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Remove User from Group request removes a user from a group.
In the "Request Body", you need to pass the ID of the user you want to remove from the group. Refer to the Get All Users request to get the ID.
This also revokes admin access for the user with an admin role, unless that user has been assigned an admin role by some other group as well. The same logic applies to stack roles as well.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "remove",
"path": "members[value eq \"<{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "602**************",
"displayName": "<Replace Users in Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Replace Users in Group request replaces the existing set of users with a new set of users.
In the "Request Body", pass the user ID in the value key. Refer to the Get All Users request to get the user IDs.
This request removes all the existing users from a group and replaces them with the specified user(s).
This also revokes admin access for users with admin role, unless that user has been assigned an admin role by some other group as well. The same logic applies to stack roles as well.
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "replace",
"path": "members",
"value": [
{
"value": "<{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Group"
],
"id": "602d05a041339f00113353b7",
"displayName": "<Delete Group
https://auth-api.contentstack.com/scim/v2.0/organizations/{organization_uid}/Groups/{group_id}The Delete Group request deletes an existing group from the SCIM. This will remove all the users from that group.
NoteThis API request will not remove users from the organization or from the Contentstack account.