---
title: "Open a realtime community session"
---

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

# Open a realtime community session

Path: Nicer API › Community

`POST /community/auth`

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

Opens a session with the realtime service behind the community for the caller: it names them, the agency the request acts for and the channels they are in, always with the agency-wide group, and answers the service's own reply, which holds a session token the portal's realtime client uses as it is. The session carries that agency's channels only. Any member of the agency may call it. Errors: 400 ERROR_COMPANY_REQUIRED and 403 ERROR_DO_NOT_HAVE_PERMISSION as on every community route.

## Authentication

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

## 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.auth();
```

### Nicer CLI

```bash
nicer community auth
```

### cURL

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

### TypeScript

```typescript
const url = 'https://api.nicer.travel/community/auth';
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/auth"

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

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "body": "string",
  "status": -9007199254740991
}
```

- `body` (`community.auth.response.200.body`; string, required) — The realtime service's answer as text, holding the caller's session token: the portal hands it to its realtime client unchanged.
- `status` (`community.auth.response.200.status`; integer, required) — The HTTP status the realtime service answered with.
  - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 400

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

#### Example

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

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

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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


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