# Update group mapping

> Source: https://truto.one/docs/api-reference/admin/group-mappings/update/

`PATCH /group-mapping/{id}`

Resource: **Group Mappings**

## Path parameters

- **`id`** _(string, required)_
  The ID of the group mapping you want to update.

## Request body

- **`scim_group_id`** _(string)_
  The ID of the SCIM group this mapping applies to.
- **`role`** _(string)_
  The role granted to members of the mapped SCIM group.
  Allowed: `admin`, `member`
- **`environment_ids`** _(array<string>)_
  Environment IDs that members of the mapped group are granted access to.

## Response body

- **`id`** _(string)_
  The ID of the group mapping.
- **`team_id`** _(string)_
  The ID of the team that owns this group mapping.
- **`scim_group_id`** _(string)_
  The ID of the SCIM group this mapping applies to.
- **`role`** _(string)_
  The role granted to members of the mapped SCIM group. Null leaves the role unchanged.
  Allowed: `admin`, `member`
- **`environment_ids`** _(array<string>)_
  Environment IDs that members of the mapped group are granted access to.
- **`created_at`** _(string)_
  The date and time when the group mapping was created.
- **`updated_at`** _(string)_
  The date and time when the group mapping was last updated.

## Code examples

### curl

```bash
curl -X PATCH 'https://api.truto.one/group-mapping/{id}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "scim_group_id": "9c2b104d-74a6-47f2-b93e-c6b611e82391",
  "role": "member",
  "environment_ids": []
}'
```

### JavaScript

```javascript
const body = {
  "scim_group_id": "9c2b104d-74a6-47f2-b93e-c6b611e82391",
  "role": "member",
  "environment_ids": []
};

const response = await fetch('https://api.truto.one/group-mapping/{id}', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/group-mapping/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "scim_group_id": "9c2b104d-74a6-47f2-b93e-c6b611e82391",
    "role": "member",
    "environment_ids": []
}

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