---
title: "Change a member's settings or role in an agency"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.nicer.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Change a member's settings or role in an agency

Path: Nicer API › identity

`PUT /identity/admin/user/{id}`

URL: `https://api.nicer.travel/identity/admin/user/{id}`

Changes a person's membership in the agency the request acts for (x-nicer-company): the settings noLeads, bookingAccessEnabled, hasAdvisorPortalAccess and isTestUser, and the role, between advisor and admin. It never changes the person's account, their contact details or their memberships in other agencies. Only the agency's admins and Nicer staff may call it, and staff must name the agency. The legacy company-level superadmin membership is Nicer staff's: only staff change its settings, and its role stays. The agency always keeps at least one admin; an admin may change themself under the same rule. A change of role publishes identity.company-member-role-changed.v1, a change of a setting identity.company-member-settings-changed.v1, and turning an advisor's portal access off app.CompanyMember.removed; the person's next token reflects the membership as it now stands. A request that changes nothing writes nothing. Answers the membership as it now stands. Errors: 400 ERROR_MALFORMED_BODY (not JSON), 400 ERROR_BODY_VALIDATION (an unknown field, a value of the wrong type, or nothing to change), 404 ERROR_ITEM_NOT_FOUND (the person is not an active member of this agency's staff), 403 ERROR_DO_NOT_HAVE_PERMISSION (the caller is neither an admin of the agency nor Nicer staff, or an agency admin changing the legacy superadmin membership), 409 ERROR_IDENTITY_INVALID_ROLE (a role change on the legacy superadmin membership), 409 ERROR_LAST_ADMIN (the agency would be left without an admin), 409 ERROR_CONDITIONAL_CHECK_FAILED (the membership kept changing while this change was made: read it again).

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Path parameters

- `id` (`identity.admin.user.update.path.id`; string, required)

## Header parameters

- `x-nicer-company` (`identity.admin.user.update.header.x-nicer-company`; string, required) — Company context. Authentication and tenant membership are validated by the API.

## Request body

_Required._

- `bookingAccessEnabled` (`identity.admin.user.update.bookingAccessEnabled`; boolean, optional) — Whether the portal shows the member the agency's flight booking link.
- `hasAdvisorPortalAccess` (`identity.admin.user.update.hasAdvisorPortalAccess`; boolean, optional) — Whether an advisor may use the agency's portal. Turned off, the advisor's next token no longer carries the agency, and the CRM leaves the travelers they served for an admin to reassign. An admin keeps the agency either way.
- `isTestUser` (`identity.admin.user.update.isTestUser`; boolean, optional) — Whether this membership is a test account.
- `noLeads` (`identity.admin.user.update.noLeads`; boolean, optional) — Whether the member is left out when the agency assigns new leads automatically.
- `role` (`identity.admin.user.update.role`; string, optional) — The member's role in the agency. A role moves between advisor and admin only.
  - one of `"advisor"`, `"admin"`

## Example request

```json
{
  "bookingAccessEnabled": true,
  "hasAdvisorPortalAccess": true,
  "isTestUser": true,
  "noLeads": true,
  "role": "advisor"
}
```

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
  headers: { "x-nicer-company": process.env.NICER_COMPANY },
});

await nicer.identity.admin.user.update({
  "id": "string"
});
```

### Nicer CLI

```bash
nicer identity admin user update --id 'string' --company "$NICER_COMPANY" --input - <<'JSON'
{}
JSON
```

### cURL

```bash
curl --request PUT \
  --url 'https://api.nicer.travel/identity/admin/user/<id>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-nicer-company: string' \
  --data '
{
  "bookingAccessEnabled": true,
  "hasAdvisorPortalAccess": true,
  "isTestUser": true,
  "noLeads": true,
  "role": "advisor"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/identity/admin/user/<id>';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'x-nicer-company': 'string',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    bookingAccessEnabled: true,
    hasAdvisorPortalAccess: true,
    isTestUser: true,
    noLeads: true,
    role: 'advisor'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/identity/admin/user/<id>"

payload = {
    "bookingAccessEnabled": True,
    "hasAdvisorPortalAccess": True,
    "isTestUser": True,
    "noLeads": True,
    "role": "advisor"
}
headers = {
    "Content-Type": "application/json",
    "x-nicer-company": "string",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "bookingAccessEnabled": true,
  "companyName": "string",
  "hasAdvisorPortalAccess": true,
  "isTestUser": true,
  "noLeads": true,
  "role": "advisor",
  "status": "active",
  "updatedAt": "2019-08-24T14:15:22Z",
  "userId": "string"
}
```

- `companyName` (`identity.admin.user.update.response.200.companyName`; string, required) — The agency the membership belongs to: the one the request acts for.
  - minLength: `1`
- `role` (`identity.admin.user.update.response.200.role`; string, required) — The member's role in the agency. superadmin is the legacy company-level membership of Nicer staff, which counts as an admin of the agency.
  - one of `"advisor"`, `"admin"`, `"superadmin"`
- `status` (`identity.admin.user.update.response.200.status`; string, required) — The membership's status: only an active membership changes.
- `updatedAt` (`identity.admin.user.update.response.200.updatedAt`; string, required) — When the membership last changed.
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `userId` (`identity.admin.user.update.response.200.userId`; string, required) — The member.
  - minLength: `1`
- `bookingAccessEnabled` (`identity.admin.user.update.response.200.bookingAccessEnabled`; boolean, optional) — As stored; absent when never set.
- `hasAdvisorPortalAccess` (`identity.admin.user.update.response.200.hasAdvisorPortalAccess`; boolean, optional) — As stored; absent when never set, which lets an advisor in.
- `isTestUser` (`identity.admin.user.update.response.200.isTestUser`; boolean, optional) — As stored; absent when never set.
- `noLeads` (`identity.admin.user.update.response.200.noLeads`; boolean, optional) — As stored; absent when never set.

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.admin.user.update.response.400.errorCode`; string, required)
- `errorMessage` (`identity.admin.user.update.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.admin.user.update.response.401.errorCode`; string, required)
- `errorMessage` (`identity.admin.user.update.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.admin.user.update.response.403.errorCode`; string, required)
- `errorMessage` (`identity.admin.user.update.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/identity/identity.admin.user.update/index.md
