# Patch group membership

`PATCH https://api.agilitycredit.net/scim/v2/{tenantId}/Groups/{groupId}`

Docs page: https://apidocs.agilitycredit.com/sso/scim-api/patch-group · Tag: Groups

Supports `add`, `remove`, and `replace` operations targeting `members`. Okta-style
targeted remove (`"path": "members[value eq \"<user-id>\"]"`) works as well as the
unpathed `remove` of the entire `members` collection. `displayName` changes are
ignored. No-op when the role mapping source is not `idp_groups`.

Authentication: `Authorization: Bearer <api key>`.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `groupId` | path | yes | The role name (`admin`, `user`, `sales`, `sales_with_credit`, `api`, `accounting`). |

## Request body (`application/scim+json`), required

Schema: `PatchRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `schemas` | array of string | yes |  |
| `Operations` | array of object | yes |  |
| `Operations[].op` | string: `add`, `replace`, `remove` | yes |  |
| `Operations[].path` | string |  | SCIM path. Optional for `replace`/`add` when `value` is an object — the server normalises Okta-style no-path ops into pathed ops. |
| `Operations[].value` | any |  | Scalar, object, or array — shape depends on `path`. For role updates this also accepts `{ value: "<role>" }` (Okta `SingleAppRoleAssignment`). |

Example:

```json
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "add",
      "path": "members",
      "value": [
        {
          "value": "6f0e9c6a-1b5a-4f0a-8e3b-1a2c3d4e5f60"
        }
      ]
    },
    {
      "op": "remove",
      "path": "members[value eq \"a1b2c3d4-...\"]"
    }
  ]
}
```

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Group updated. | Group |
| 400 | Payload validation failed. | Error |
| 404 | Resource not found. | Error |
| 503 | SCIM provisioning is disabled on the tenant. | Error |

### Error bodies

400:

```json
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:Error"
  ],
  "status": "400",
  "scimType": "invalidValue",
  "detail": "userName or emails[0].value is required"
}
```

404:

```json
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:Error"
  ],
  "status": "404",
  "detail": "User not found"
}
```

503:

```json
{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:Error"
  ],
  "status": "503",
  "detail": "SCIM provisioning is disabled for this tenant"
}
```
