# Replace group membership

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

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

Treats the `members` array as the new full membership set. Users not listed lose
the role; users newly listed gain it. Only SCIM-provisioned users are touched.
No-op when the role mapping source is not `idp_groups` (returns `200`).

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: `Group`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `schemas` | array of string | yes |  |
| `id` | string |  | The role name (e.g. `admin`). Server-managed. |
| `displayName` | string | yes | The IdP group name as configured in the tenant's role mapping. Cannot be changed via SCIM. |
| `members` | array of object |  |  |
| `members[].value` | string | yes | The user's `id`. |
| `members[].display` | string |  | The user's email. |
| `meta` | object |  |  |
| `meta.resourceType` | string: `User`, `Group`, `Schema`, `ServiceProviderConfig` |  |  |
| `meta.created` | string (date-time) |  |  |
| `meta.lastModified` | string (date-time) |  |  |
| `meta.location` | string |  |  |

## Responses

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

### Error bodies

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"
}
```
