---
title: "Get a chat with messages and users"
---

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

# Get a chat with messages and users

Path: Nicer API › Chat

`GET /chat/{chatId}`

URL: `https://api.nicer.travel/chat/{chatId}`

Returns the chat view, a page of messages with per-participant seen flags, and the user records of participants, past authors and synthetic system senders, and marks the chat read for the caller. The caller must have access to the channel.

## Authentication

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

## Path parameters

- `chatId` (`chat.get.path.chatId`; string, required)

## Query parameters

- `limit` (`chat.get.query.limit`; string, optional) — How many messages a page holds, the latest ones: 20 when absent, zero or not a number.
- `nextToken` (`chat.get.query.nextToken`; string, optional) — The nextToken of the previous page, to read older messages.

## 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.chat.get({
  "chatId": "string"
});
```

### Nicer CLI

```bash
nicer chat get --chat-id 'string'
```

### cURL

```bash
curl --request GET \
  --url 'https://api.nicer.travel/chat/<chatId>' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/chat/<chatId>';
const options = {method: 'GET', 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/chat/<chatId>"

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

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "chat": {
    "chatId": "string",
    "chatTitle": "string",
    "companyName": "string",
    "createdAt": "string",
    "kind": "trip",
    "lastMessageTimestamp": "string",
    "participantUserIds": [
      "string"
    ],
    "suggestionsEnabled": true,
    "travelersTripId": "string",
    "type": "Chat",
    "updatedAt": "string"
  },
  "conversations": [
    {
      "attachmentUrls": [
        "string"
      ],
      "authorId": "string",
      "chatId": "string",
      "createdBy": "string",
      "lastModifiedBy": "string",
      "message": "string",
      "messageHtml": "string",
      "needsAiResponse": true,
      "conversationId": "string",
      "createdAt": "string",
      "updatedAt": "string",
      "type": "ChatConversation",
      "seen": {
        "property1": true,
        "property2": true
      }
    }
  ],
  "nextToken": "string",
  "travelersTrip": {
    "assignedAdvisorUserId": "string",
    "associatedChatId": "string",
    "associatedTripItineraryId": "string",
    "associatedUserIds": [
      "string"
    ],
    "createdAt": "string",
    "hasActivity": true,
    "primaryTravelerUserId": "string",
    "travelersTripId": "string",
    "tripTitle": "string",
    "type": "TravelersTrip"
  },
  "users": [
    {
      "avatar": "string",
      "deleted": true,
      "familyName": "string",
      "fullName": "string",
      "givenName": "string",
      "type": "User",
      "userId": "string",
      "createdAt": "string",
      "role": "advisor",
      "tenantId": "string",
      "updatedAt": "string"
    }
  ]
}
```

- `chat` (`chat.get.response.200.chat`; object, required)
  - `chatId` (`chat.get.response.200.chat.chatId`; string, required)
  - `chatTitle` (`chat.get.response.200.chat.chatTitle`; any of, required)
    - any of the following: `string`, `null`
  - `companyName` (`chat.get.response.200.chat.companyName`; string, required)
  - `kind` (`chat.get.response.200.chat.kind`; string, required)
    - one of `"trip"`, `"direct"`
  - `lastMessageTimestamp` (`chat.get.response.200.chat.lastMessageTimestamp`; any of, required)
    - any of the following: `string`, `null`
  - `participantUserIds` (`chat.get.response.200.chat.participantUserIds`; array of string, required)
  - `suggestionsEnabled` (`chat.get.response.200.chat.suggestionsEnabled`; boolean, required)
  - `travelersTripId` (`chat.get.response.200.chat.travelersTripId`; any of, required) — The trip this chat belongs to, when it is a trip chat.
    - any of the following: `string`, `null`
  - `type` (`chat.get.response.200.chat.type`; string, required)
  - `createdAt` (`chat.get.response.200.chat.createdAt`; string, optional)
  - `updatedAt` (`chat.get.response.200.chat.updatedAt`; string, optional) — The time of the last message; absent before the first one.
- `conversations` (`chat.get.response.200.conversations`; array of object, required) — One page of messages, oldest first.
  - `attachmentUrls` (`chat.get.response.200.conversations.attachmentUrls`; array of string, required)
  - `authorId` (`chat.get.response.200.conversations.authorId`; string, required)
  - `chatId` (`chat.get.response.200.conversations.chatId`; string, required)
  - `createdBy` (`chat.get.response.200.conversations.createdBy`; string, required)
  - `lastModifiedBy` (`chat.get.response.200.conversations.lastModifiedBy`; string, required)
  - `message` (`chat.get.response.200.conversations.message`; string, required)
  - `conversationId` (`chat.get.response.200.conversations.conversationId`; string, required)
  - `createdAt` (`chat.get.response.200.conversations.createdAt`; string, required)
  - `updatedAt` (`chat.get.response.200.conversations.updatedAt`; string, required)
  - `type` (`chat.get.response.200.conversations.type`; string, required)
  - `seen` (`chat.get.response.200.conversations.seen`; map of boolean, required) — Per participant userId, whether they have read up to this message.
  - `messageHtml` (`chat.get.response.200.conversations.messageHtml`; string, optional) — The text as HTML.
  - `needsAiResponse` (`chat.get.response.200.conversations.needsAiResponse`; boolean, optional)
- `nextToken` (`chat.get.response.200.nextToken`; any of, required) — Send it back as nextToken to read the older messages; null on the last page.
  - any of the following: `string`, `null`
- `travelersTrip` (`chat.get.response.200.travelersTrip`; any of, required) — The chat's trip, null for a direct chat or when the trip cannot be read.
  - any of the following:
    - `object`
      - `associatedUserIds` (`chat.get.response.200.travelersTrip.1.associatedUserIds`; array of string, required)
      - `createdAt` (`chat.get.response.200.travelersTrip.1.createdAt`; string, required)
      - `primaryTravelerUserId` (`chat.get.response.200.travelersTrip.1.primaryTravelerUserId`; string, required)
      - `travelersTripId` (`chat.get.response.200.travelersTrip.1.travelersTripId`; string, required)
      - `tripTitle` (`chat.get.response.200.travelersTrip.1.tripTitle`; string, required)
      - `type` (`chat.get.response.200.travelersTrip.1.type`; string, required)
      - `assignedAdvisorUserId` (`chat.get.response.200.travelersTrip.1.assignedAdvisorUserId`; any of, optional)
        - any of the following: `string`, `null`
      - `associatedChatId` (`chat.get.response.200.travelersTrip.1.associatedChatId`; any of, optional)
        - any of the following: `string`, `null`
      - `associatedTripItineraryId` (`chat.get.response.200.travelersTrip.1.associatedTripItineraryId`; any of, optional)
        - any of the following: `string`, `null`
      - `hasActivity` (`chat.get.response.200.travelersTrip.1.hasActivity`; boolean, optional)
    - `null`
- `users` (`chat.get.response.200.users`; array of object, required) — The participants, the past authors of these messages, and the system senders, which carry `role`, `tenantId` and timestamps.
  - `familyName` (`chat.get.response.200.users.familyName`; string, required)
  - `fullName` (`chat.get.response.200.users.fullName`; any of, required)
    - any of the following: `string`, `null`
  - `givenName` (`chat.get.response.200.users.givenName`; string, required)
  - `type` (`chat.get.response.200.users.type`; string, required)
  - `userId` (`chat.get.response.200.users.userId`; string, required)
  - `avatar` (`chat.get.response.200.users.avatar`; string, optional)
  - `deleted` (`chat.get.response.200.users.deleted`; boolean, optional)
  - `createdAt` (`chat.get.response.200.users.createdAt`; string, optional)
  - `role` (`chat.get.response.200.users.role`; string, optional)
    - one of `"advisor"`, `"traveler"`, `"admin"`, `"superadmin"`
  - `tenantId` (`chat.get.response.200.users.tenantId`; string, optional)
  - `updatedAt` (`chat.get.response.200.users.updatedAt`; string, optional)

### 400

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

#### Example

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

- `errorCode` (`chat.get.response.400.errorCode`; string, required)
- `errorMessage` (`chat.get.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`chat.get.response.401.errorCode`; string, required)
- `errorMessage` (`chat.get.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`chat.get.response.403.errorCode`; string, required)
- `errorMessage` (`chat.get.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Chat/chat.get/index.md
