---
title: "Remove a member from 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.

# Remove a member from an agency

Path: Nicer API › identity

`DELETE /identity/company/{companyName}/member/{userId}`

URL: `https://api.nicer.travel/identity/company/{companyName}/member/{userId}`

Removes a person from an agency's staff. The membership is kept with status removed, so the person's next token, when it is issued or refreshed, no longer carries the agency, and app.CompanyMember.removed is published, which tells the CRM to leave the travelers they served for an admin to reassign. The person's account, and their memberships in other agencies, are untouched. Only an admin of the agency, or Nicer staff, may call it; staff must name the agency, and companyName in the path must be the agency the request acts for (x-nicer-company). The legacy company-level superadmin membership is Nicer staff's, and only staff remove it. An admin may remove themself unless they are the agency's last admin. Errors: 404 ERROR_ITEM_NOT_FOUND (the person is not an active member of this agency's staff, or the path names another agency), 403 ERROR_DO_NOT_HAVE_PERMISSION (the caller is neither an admin of the agency nor Nicer staff, or an agency admin removing 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 it was removed: read it again).

## Authentication

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

## Path parameters

- `companyName` (`identity.company.member.delete.path.companyName`; string, required)
- `userId` (`identity.company.member.delete.path.userId`; string, required)

## Header parameters

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

## 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.company.member.delete({
  "companyName": "string",
  "userId": "string"
});
```

### Nicer CLI

```bash
nicer identity company member delete --company-name 'string' --user-id 'string' --company "$NICER_COMPANY"
```

### cURL

```bash
curl --request DELETE \
  --url 'https://api.nicer.travel/identity/company/<companyName>/member/<userId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'x-nicer-company: string'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/identity/company/<companyName>/member/<userId>';
const options = {
  method: 'DELETE',
  headers: {'x-nicer-company': 'string', Authorization: 'Bearer <token>'}
};

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/company/<companyName>/member/<userId>"

headers = {
    "x-nicer-company": "string",
    "Authorization": "Bearer <token>"
}

response = requests.delete(url, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "companyName": "string",
  "removedAt": "2019-08-24T14:15:22Z",
  "removedBy": "string",
  "status": "removed",
  "userId": "string"
}
```

- `companyName` (`identity.company.member.delete.response.200.companyName`; string, required) — The agency the person no longer belongs to.
  - minLength: `1`
- `removedAt` (`identity.company.member.delete.response.200.removedAt`; string, required) — When the membership was removed.
  - 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))$`
- `removedBy` (`identity.company.member.delete.response.200.removedBy`; string, required) — The user id of the admin or staff member who removed it.
  - minLength: `1`
- `status` (`identity.company.member.delete.response.200.status`; string, required) — The membership's status, which is kept rather than deleted.
- `userId` (`identity.company.member.delete.response.200.userId`; string, required) — The person who was removed.
  - minLength: `1`

### 400

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

#### Example

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

- `errorCode` (`identity.company.member.delete.response.400.errorCode`; string, required)
- `errorMessage` (`identity.company.member.delete.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`identity.company.member.delete.response.401.errorCode`; string, required)
- `errorMessage` (`identity.company.member.delete.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`identity.company.member.delete.response.403.errorCode`; string, required)
- `errorMessage` (`identity.company.member.delete.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/identity/identity.company.member.delete/index.md
