---
search:
  tags:
    - users
    - PUT
seo:
  description: >-
    The role on the service is the higher of the… Reference for the PUT
    /api/v1/users/{id}/service-grants/{service_id} endpoint in the TimescaleDB
    Enterprise API.
  noindex: true
sidebar:
  label: Set a user's service role
  badge: PUT
title: Set a user's service role
type: openapi-operation
---
The role on the service is the higher of the default role of the user and the grant. The change applies to the open sessions of the user at once.

`PUT /api/v1/users/{id}/service-grants/{service_id}`

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

- `role` (string) — viewer or operator

Request body example:

```json
{
  "role": "string"
}
```

**Responses**

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

Response example, 200:

```json
{
  "created_at": "2019-08-24T14:15:22Z",
  "created_by": "string",
  "role": "viewer",
  "service_id": "string",
  "service_name": "string"
}
```
