> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://zuora.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server.

# Bulk update groups

PATCH https://rest.test.zuora.com/scim/v2/Groups/bulk
Content-Type: application/json

Updates an existing group resource, allowing individual (or groups of) users to be added or removed from the group with a single operation.

Setting the operation attribute of a member object to delete will remove members from a group; add is the default operation for PATCH.


Reference: https://zuora.ferndocs.com/developers/api-reference/zuora-api/oneid/scim/patch-bulk-patch-groups

## Authentication

- `Authorization` header (bearer token, required) — Use `Bearer {{token}}` in the `Authorization` header for authentication.

## Servers

- `https://rest.test.zuora.com` (US Developer & Central Sandbox (incl. Test Drive), default)
- `https://rest.sandbox.na.zuora.com` (US API Sandbox Cloud 1)
- `https://rest.apisandbox.zuora.com` (US API Sandbox Cloud 2)
- `https://rest.na.zuora.com` (US Production Cloud 1)
- `https://rest.zuora.com` (US Production Cloud 2)
- `https://rest.test.eu.zuora.com` (EU Developer & Central Sandbox)
- `https://rest.sandbox.eu.zuora.com` (EU API Sandbox)
- `https://rest.eu.zuora.com` (EU Production)
- `https://rest.test.ap.zuora.com` (APAC Developer & Central Sandbox)
- `https://rest.ap.zuora.com` (APAC Production)

## Request

### Body (application/json)

This endpoint expects an object.

- `schemas` (list of string, required) — List of schema identifiers that define the format of the request.
- `operations` (list of ScimV2GroupsBulkPatchRequestBodyContentApplicationJsonSchemaOperationsItems, required) — List of operations to be performed on the resource.

## Response

### 200

OK

- `schemas` (list of string, optional) — List of schema identifiers that define the structure of the response.
- `id` (string, optional, nullable)
- `externalId` (string, optional, nullable)
- `meta` (ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaMeta, optional, nullable) — Metadata about the group.
- `totalResults` (integer, optional) — Total number of groups returned in the response.
- `resources` (list of ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItems, optional) — List of groups included in the response.
- `startIndex` (integer, optional)
- `itemsPerPage` (integer, optional)

## Errors

### 401 Unauthorized Error

Unauthorized

- `success` (boolean, optional) — Indicates whether the request was successful (false in this case).
- `reasons` (list of ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaReasonsItems, optional) — List of reasons for the unauthorized error.

### 403 Forbidden Error

Forbidden

- `timestamp` (string, optional) — Timestamp when the error occurred.
- `status` (integer, optional) — HTTP status code indicating the request is forbidden.
- `error` (string, optional) — Type of error indicating that access is forbidden.
- `message` (string, optional) — Description of why the request is forbidden.
- `path` (string, optional) — Endpoint path where the forbidden error occurred.

## Types

### ScimV2GroupsBulkPatchRequestBodyContentApplicationJsonSchemaOperationsItems

- `op` (enum, required) — Operation to be performed. Can be 'add' to add a new item or 'remove' to delete an item.
  - Allowed values: `add`, `remove`
- `path` (string, required) — Path to the item or property to be modified.
- `value` (list of ScimV2GroupsBulkPatchRequestBodyContentApplicationJsonSchemaOperationsItemsValueItems, required) — List of values associated with the operation.

### ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaMeta

Metadata about the group.

- `resourceType` (string, optional) — Type of resource, which is 'Group' for this object.
- `location` (string, optional)

### ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItems

- `schemas` (list of string, optional) — List of schema identifiers that describe the format of the group.
- `id` (string, optional) — Unique identifier for the group.
- `displayName` (string, optional) — Name of the group.
- `members` (list of ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItemsMembersItems, optional) — List of members associated with the group.
- `urn:zuora:scim:schemas:1.0:GroupExtension` (ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItemsUrnZuoraScimSchemas10GroupExtension, optional) — Custom attributes for the group defined by the extension schema.
- `meta` (ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItemsMeta, optional) — Metadata about the group.

### ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaReasonsItems

- `message` (string, optional) — Error message explaining why the request is unauthorized.
- `code` (string, optional) — Error code representing the unauthorized access issue.

### ScimV2GroupsBulkPatchRequestBodyContentApplicationJsonSchemaOperationsItemsValueItems

- `value` (string, optional) — The value to be added or removed.

### ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItemsMembersItems

- `value` (string, optional) — Identifier for a member of the group.
- `display` (string, optional)

### ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItemsUrnZuoraScimSchemas10GroupExtension

Custom attributes for the group defined by the extension schema.

- `schemas` (list of string, optional) — List of schema identifiers specific to the extension.
- `description` (string, optional) — Additional description for the group.
- `organizationId` (string, optional) — Identifier for the organization associated with the group.
- `active` (boolean, optional) — Indicates if the group is active.

### ScimV2GroupsBulkPatchResponsesContentApplicationJsonSchemaResourcesItemsMeta

Metadata about the group.

- `resourceType` (string, optional) — Type of resource, which is 'Group' for this object.
- `location` (string, optional)

## Examples

**Request**

```json
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "operations": [
    {
      "op": "add",
      "path": "members",
      "value": [
        {
          "value": "e1b624ac-e00f-422b-b4da-20070901b22f"
        },
        {
          "value": "ea27634b-38ab-4592-86e4-2d4a140ae120"
        }
      ]
    }
  ]
}
```

**Response**

```json
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:ListResponse"
  ],
  "id": null,
  "externalId": null,
  "meta": null,
  "totalResults": 1,
  "resources": [
    {
      "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:Group",
        "urn:zuora:scim:schemas:1.0:GroupExtension"
      ],
      "id": "0fb99576-2154-4d96-a6cb-384dd430f45f",
      "displayName": "Amy Test",
      "members": [
        {
          "value": "e1b624ac-e00f-422b-b4da-20070901b22f",
          "display": "amy+test102"
        },
        {
          "value": "ea27634b-38ab-4592-86e4-2d4a140ae120",
          "display": "test01@zuora.com"
        }
      ],
      "urn:zuora:scim:schemas:1.0:GroupExtension": {
        "schemas": [
          "urn:zuora:scim:schemas:1.0:GroupExtension"
        ],
        "description": "Amy testing group",
        "organizationId": "5619df2e-fa8c-47fa-9c1e-16ab5af4936e",
        "active": true
      },
      "meta": {
        "resourceType": "Group",
        "location": "http://localhost:9900/scim/v2/Groups/bulk/0fb99576-2154-4d96-a6cb-384dd430f45f"
      }
    }
  ],
  "startIndex": 1,
  "itemsPerPage": 1
}
```

**SDK Code**

```python SCIM_patchBulkPatchGroups_example
import requests

url = "https://rest.test.zuora.com/scim/v2/Groups/bulk"

payload = {
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
    "operations": [
        {
            "op": "add",
            "path": "members",
            "value": [{ "value": "e1b624ac-e00f-422b-b4da-20070901b22f" }, { "value": "ea27634b-38ab-4592-86e4-2d4a140ae120" }]
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript SCIM_patchBulkPatchGroups_example
const url = 'https://rest.test.zuora.com/scim/v2/Groups/bulk';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"operations":[{"op":"add","path":"members","value":[{"value":"e1b624ac-e00f-422b-b4da-20070901b22f"},{"value":"ea27634b-38ab-4592-86e4-2d4a140ae120"}]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go SCIM_patchBulkPatchGroups_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rest.test.zuora.com/scim/v2/Groups/bulk"

	payload := strings.NewReader("{\n  \"schemas\": [\n    \"urn:ietf:params:scim:api:messages:2.0:PatchOp\"\n  ],\n  \"operations\": [\n    {\n      \"op\": \"add\",\n      \"path\": \"members\",\n      \"value\": [\n        {\n          \"value\": \"e1b624ac-e00f-422b-b4da-20070901b22f\"\n        },\n        {\n          \"value\": \"ea27634b-38ab-4592-86e4-2d4a140ae120\"\n        }\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby SCIM_patchBulkPatchGroups_example
require 'uri'
require 'net/http'

url = URI("https://rest.test.zuora.com/scim/v2/Groups/bulk")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"schemas\": [\n    \"urn:ietf:params:scim:api:messages:2.0:PatchOp\"\n  ],\n  \"operations\": [\n    {\n      \"op\": \"add\",\n      \"path\": \"members\",\n      \"value\": [\n        {\n          \"value\": \"e1b624ac-e00f-422b-b4da-20070901b22f\"\n        },\n        {\n          \"value\": \"ea27634b-38ab-4592-86e4-2d4a140ae120\"\n        }\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java SCIM_patchBulkPatchGroups_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://rest.test.zuora.com/scim/v2/Groups/bulk")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"schemas\": [\n    \"urn:ietf:params:scim:api:messages:2.0:PatchOp\"\n  ],\n  \"operations\": [\n    {\n      \"op\": \"add\",\n      \"path\": \"members\",\n      \"value\": [\n        {\n          \"value\": \"e1b624ac-e00f-422b-b4da-20070901b22f\"\n        },\n        {\n          \"value\": \"ea27634b-38ab-4592-86e4-2d4a140ae120\"\n        }\n      ]\n    }\n  ]\n}")
  .asString();
```

```php SCIM_patchBulkPatchGroups_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://rest.test.zuora.com/scim/v2/Groups/bulk', [
  'body' => '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "operations": [
    {
      "op": "add",
      "path": "members",
      "value": [
        {
          "value": "e1b624ac-e00f-422b-b4da-20070901b22f"
        },
        {
          "value": "ea27634b-38ab-4592-86e4-2d4a140ae120"
        }
      ]
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp SCIM_patchBulkPatchGroups_example
using RestSharp;

var client = new RestClient("https://rest.test.zuora.com/scim/v2/Groups/bulk");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"schemas\": [\n    \"urn:ietf:params:scim:api:messages:2.0:PatchOp\"\n  ],\n  \"operations\": [\n    {\n      \"op\": \"add\",\n      \"path\": \"members\",\n      \"value\": [\n        {\n          \"value\": \"e1b624ac-e00f-422b-b4da-20070901b22f\"\n        },\n        {\n          \"value\": \"ea27634b-38ab-4592-86e4-2d4a140ae120\"\n        }\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift SCIM_patchBulkPatchGroups_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "operations": [
    [
      "op": "add",
      "path": "members",
      "value": [["value": "e1b624ac-e00f-422b-b4da-20070901b22f"], ["value": "ea27634b-38ab-4592-86e4-2d4a140ae120"]]
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.test.zuora.com/scim/v2/Groups/bulk")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```