# PUT /api/v1/businesses/users/{user_id}

> Update user role

- **Tag:** businesses
- **Operation ID:** `update_user_role_in_business_api_v1_businesses_users__user_id__put`

## Description

Change a user's access level in this business.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `user_id` (path, string, required)

## Request body

Schema: `BusinessUserRoleUpdateRequest`

- `role` (Role · required) → `Role` — Role: owner, admin, member, or viewer

## Responses

### 200 — Successful Response

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X PUT 'https://api.ondayzero.com/api/v1/businesses/users/{user_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "role": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/businesses/users/{user_id}', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "role": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "role": "string"
}

response = httpx.put("https://api.ondayzero.com/api/v1/businesses/users/{user_id}", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/businesses/update-user-role-in-business
- OpenAPI slice: https://www.ondayzero.com/docs/reference/businesses/update-user-role-in-business/openapi.json
- Other endpoints in **businesses**: https://www.ondayzero.com/docs/reference/businesses
