> For the complete documentation index, see [llms.txt](https://docs.ggwp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ggwp.com/identity-and-access-management-iam/api-docs-scim/users-apis/patch-user.md).

# Patch User

## Patch User

### Overview

The `PATCH /Users/{id}` endpoint is used to perform partial updates on a user.

This implementation supports **limited PATCH functionality** and is primarily used to update the user's role.

Identity providers such as Okta or Microsoft Azure Active Directory may use this endpoint during user lifecycle updates.

***

### Supported Operations

Only the following operation is supported:

* Update user role

All other PATCH operations are **not supported**.

***

### Endpoint

```bash
PATCH /Users/{id}
```

***

### Full URL

```bash
https://api.ggwp.com/scim/v2/Users/{id}
```

***

### Authentication

```http
Authorization: Bearer <access_token>
```

***

## Request Body

### Supported Schema

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
}
```

***

### Example Request (Update Role)

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "Operations": [
    {
      "op": "replace",
      "path": "roles",
      "value": [
        {
          "value": "moderator"
        }
      ]
    }
  ]
}
```

***

## Supported Values

### role

* **Type:** `string`
* **Allowed Values:**
  * `admin`
  * `moderator`

***

## Response

### Success (200 OK)

```json
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "id": "c118d158-c11b-495b-ab88-f57c8ac473c0",
  "userName": "Temp_user_prod",
  "externalId": "ABC1900BE",
  "active": true,
  "name": {
    "givenName": "Temp",
    "familyName": "User"
  },
  "displayName": "Temp User",
  "emails": [
    {
      "value": "temp_user_us@example.com",
      "primary": true
    }
  ],
  "roles": [
    {
      "value": "admin"
    }
  ],
  "meta": {
    "resourceType": "User",
    "location": "https://api.ggwp.com/scim/v2/Users/c118d158-c11b-495b-ab88-f57c8ac473c0",
    "created": "2026-04-01T11:15:22Z",
    "lastModified": "2026-04-01T11:15:22Z"
  }
}
```

***

## Error Responses

### 400 Bad Request (Unsupported Operation)

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "status": "400",
  "detail": "Only roles update supported"
}
```

***

### 400 Bad Request (Invalid Role)

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "status": "400",
  "detail": "Invalid role value"
}
```

***

### 404 Not Found

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

***

## Validation Rules

* Only `Replace` operation is supported
* Only `path = "roles"` is supported
* `value` must be either:
  * `admin`
  * `moderator`
* Any other PATCH request will be rejected
