Examples: Manage Group Members with SCIM

You can use SCIM to manage a group by adding or removing members.

Required Editions

Available in: Salesforce Classic and Lightning Experience
Available in: All Editions

Here are examples for managing group members with SCIM.

Add a User to a Group

To add a user to a group, send a PATCH request to the Groups endpoint. Remember to query the Groups endpoint to see a list of available roles.

Request:

PATCH https://mycompany.my.salesforce.com/services/scim/v2/Groups/<group_id>

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "add",
      "path": "members",
      "value": {
        "members": [
          {
            "value": "<user_id>"
          }
        ]
      }
    }
  ]
}

Response:

HTTP/1.1 200 OK
…

{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:Group"
  ],
  "id": "00G4W000006IKBnUAO",
  "displayName": "mycompany-West",
  "type": "Regular",
  "members": [
    {
      "value": "0054W00000CVREkQAP",
      "type": "User",
      "$ref": "https://mycompany.my.salesforce.com/services/scim/v2/Users/0054W00..."
    }
  ],
  "meta": {
    "created": "2020-10-25T09:27:40Z",
    "lastModified": "2020-10-25T09:27:40Z",
    "location": "https://mycompany.my.salesforce.com/services/scim/v2/Groups/00G4W000006IKBnUAO",
    "resourceType": "Group",
    "version": "2aa9ea6605cb4c31403cdfd1b020cde5dd255300"
  }
}

Remove a User from a Group

To remove a user from a group, send a PATCH request to the Groups endpoint.

Request:

PATCH https://mycompany.my.salesforce.com/services/scim/v2/Groups/<group_id>

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "remove",
      "path": "members",
      "value": {
        "members": [
          {
            "value": "<user_id>"
          }
        ]
      }
    }
  ]
}

Response:

HTTP/1.1 200 OK
…

{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:Group"
  ],
  "id": "00G4W000006IKBnUAO",
  "displayName": "mycompany-West",
  "type": "Regular",
  "members": [],
  "meta": {
    "created": "2020-10-25T09:27:40Z",
    "lastModified": "2020-10-25T09:27:40Z",
    "location": "https://mycompany.my.salesforce.com/services/scim/v2/Groups/00G4W000006IKBnUAO",
    "resourceType": "Group",
    "version": "2aa9ea6605cb4c31403cdfd1b020cde5dd255300"
  }
}