---
search:
  tags:
    - users
    - PATCH
seo:
  description: >-
    A role change and a disable end the sessions of the user. An admin…
    Reference for the PATCH /api/v1/users/{id} endpoint in the TimescaleDB
    Enterprise API.
  noindex: true
sidebar:
  label: Change a user
  badge: PATCH
title: Change a user
type: openapi-operation
---
A role change and a disable end the sessions of the user. An admin cannot disable the own account or lower the own role. The identity provider sets the role and the display name of an OIDC user: a change of them gets 409.

`PATCH /api/v1/users/{id}`

**Request body** (`application/json`, required)

- `disabled` (boolean)
- `display_name` (string)
- `role` (string) — none, viewer, operator or admin

Request body example:

```json
{
  "disabled": true,
  "display_name": "string",
  "role": "string"
}
```

**Responses**

- `200` — OK
- `default` — Error

Response example, 200:

```json
{
  "created_at": "2019-08-24T14:15:22Z",
  "disabled": true,
  "display_name": "string",
  "id": "string",
  "last_login_at": "2019-08-24T14:15:22Z",
  "must_change_password": true,
  "role": "none",
  "service_grants": [
    {
      "role": "viewer",
      "service_id": "string"
    }
  ],
  "source": "local",
  "two_factor": true,
  "updated_at": "2019-08-24T14:15:22Z",
  "username": "string"
}
```
