---
title: "Create 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.

# Create a community channel

Path: Nicer API › Community

`POST /community/channels`

URL: `https://api.nicer.travel/community/channels`

Creates a channel in the agency's community and answers it with its memberCount. The creator is always a member; initialMemberIds adds people by userId, and autoJoin on a public channel adds everyone active in the agency. private makes it invite-only; writePolicy creator-only lets only the creator and the writers added later with PUT /community/channels/{channelId} post. Publishes app.CommunityChannel.created. Only the agency's admins may call it. Errors: 400 ERROR_UNAUTHORIZED for a caller who is not an admin, or for an initialMemberIds entry who is not an active member of the 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`

## Request body

_Required._

- `name` (`community.channels.create.name`; string, required)
  - maxLength: `80` · minLength: `1`
- `autoJoin` (`community.channels.create.autoJoin`; boolean, optional)
- `description` (`community.channels.create.description`; string, optional)
  - maxLength: `500`
- `initialMemberIds` (`community.channels.create.initialMemberIds`; array of string, optional)
- `private` (`community.channels.create.private`; boolean, optional)
- `writePolicy` (`community.channels.create.writePolicy`; string, optional)
  - one of `"all-members"`, `"creator-only"`

## Example request

```json
{
  "autoJoin": true,
  "description": "string",
  "initialMemberIds": [
    "string"
  ],
  "name": "string",
  "private": true,
  "writePolicy": "all-members"
}
```

## 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.create({
  "name": "string"
});
```

### Nicer CLI

```bash
nicer community channels create --input - <<'JSON'
{
  "name": "string"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/community/channels \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "autoJoin": true,
  "description": "string",
  "initialMemberIds": [
    "string"
  ],
  "name": "string",
  "private": true,
  "writePolicy": "all-members"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/community/channels';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    autoJoin: true,
    description: 'string',
    initialMemberIds: ['string'],
    name: 'string',
    private: true,
    writePolicy: 'all-members'
  })
};

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"

payload = {
    "autoJoin": True,
    "description": "string",
    "initialMemberIds": ["string"],
    "name": "string",
    "private": True,
    "writePolicy": "all-members"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "channelId": "string",
  "companyName": "string",
  "name": "string",
  "description": "string",
  "private": true,
  "writePolicy": "all-members",
  "createdBy": "string",
  "createdAt": "string",
  "memberCount": -9007199254740991
}
```

- `channelId` (`community.channels.create.response.200.channelId`; string, required) — The channel's id.
- `companyName` (`community.channels.create.response.200.companyName`; string, required) — The agency the channel belongs to.
- `name` (`community.channels.create.response.200.name`; string, required) — The channel's name.
- `description` (`community.channels.create.response.200.description`; any of, required) — What the channel is for; null when it says nothing.
  - any of the following: `string`, `null`
- `private` (`community.channels.create.response.200.private`; boolean, required) — Whether the channel is invite-only. A public channel is open to everyone in the agency.
- `writePolicy` (`community.channels.create.response.200.writePolicy`; string, required) — Who may post: all-members, or creator-only for its creator and the writers granted posting.
  - one of `"all-members"`, `"creator-only"`
- `createdBy` (`community.channels.create.response.200.createdBy`; string, required) — The userId of the person who created the channel.
- `createdAt` (`community.channels.create.response.200.createdAt`; string, required) — When the channel was created, as ISO 8601 text.
- `memberCount` (`community.channels.create.response.200.memberCount`; integer, optional) — How many people are in the channel. Only getting and creating a channel answer it.
  - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 400

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

#### Example

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

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

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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


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