---
title: "Leave a community channel"
---

> 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.

# Leave a community channel

Path: Nicer API › Community

`POST /community/channels/{channelId}/leave`

URL: `https://api.nicer.travel/community/channels/{channelId}/leave`

Removes the caller from a channel of the agency's community and answers left true, also when they were not in it. Any member of the agency may call it. Errors: 400 ERROR_UNAUTHORIZED for a channel of another agency; 400 ERROR_COMPANY_REQUIRED and 403 ERROR_DO_NOT_HAVE_PERMISSION as on every community route.

## Authentication

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

## Path parameters

- `channelId` (`community.channels.leave.path.channelId`; string, required)

## Code samples

### JavaScript SDK

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

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

await nicer.community.channels.leave({
  "channelId": "string"
});
```

### Nicer CLI

```bash
nicer community channels leave --channel-id 'string'
```

### cURL

```bash
curl --request POST \
  --url 'https://api.nicer.travel/community/channels/<channelId>/leave' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/community/channels/<channelId>/leave';
const options = {method: 'POST', headers: {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/community/channels/<channelId>/leave"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "channelId": "string",
  "left": true
}
```

- `channelId` (`community.channels.leave.response.200.channelId`; string, required) — The channel the caller is no longer in.
- `left` (`community.channels.leave.response.200.left`; boolean, required)

### 400

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

#### Example

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

- `errorCode` (`community.channels.leave.response.400.errorCode`; string, required)
- `errorMessage` (`community.channels.leave.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`community.channels.leave.response.401.errorCode`; string, required)
- `errorMessage` (`community.channels.leave.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`community.channels.leave.response.403.errorCode`; string, required)
- `errorMessage` (`community.channels.leave.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Community/community.channels.leave/index.md
