# Patch SCIM user

> Source: https://truto.one/docs/api-reference/admin/scim/patch-user/

`PATCH /scim/v2/Users/{id}`

Resource: **SCIM**

`add` and `replace` operations on `active`, `userName`, `externalId` and `name.formatted`, or with no `path` and those keys in `value`. `active` set to `false` removes the user from the team.

## Path parameters

- **`id`** _(string, required)_

## Request body

- **`schemas`** _(array<string>)_
- **`Operations`** _(array<object>)_
  - **`op`** _(string)_
    `add`, `replace` or `remove` (case-insensitive).
  - **`path`** _(string)_
  - **`value`** _(unknown)_

## Response body

- **`schemas`** _(array<string>)_
- **`id`** _(string)_
  The Truto user ID.
- **`externalId`** _(string)_
  The identity provider's ID for the user.
- **`userName`** _(string)_
  The user's email address, lowercased.
- **`name`** _(object)_
  - **`formatted`** _(string)_
    The user's name, or their email address when no name is set.
- **`active`** _(boolean)_
  Whether the user is an active member of the team.
- **`meta`** _(object)_
  - **`resourceType`** _(string)_
    Allowed: `User`, `Group`
  - **`created`** _(string)_
  - **`lastModified`** _(string)_
  - **`location`** _(string)_

## Code examples

### curl

```bash
curl -X PATCH 'https://api.truto.one/scim/v2/Users/{id}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": []
}'
```

### JavaScript

```javascript
const body = {
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": []
};

const response = await fetch('https://api.truto.one/scim/v2/Users/{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/scim/v2/Users/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": []
}

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