- [HTTP request](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#body.HTTP_TEMPLATE)
- [Query parameters](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#body.QUERY_PARAMETERS)
- [Request body](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#body.request_body)
- [Response body](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#body.response_body)
  - [JSON representation](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#body.LiveChatMessageListResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#body.aspect)
- [Try it!](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/list.md.txt#try-it)

Lists live chat messages for a specific chat.

To reduce polling and avoid exceeding your quota, use [liveChatMessages.streamList](https://developers.google.com/youtube/data/reference/rest/v3/liveChatMessages/streamList.md.txt) to receive new messages pushed from the server as they become available.

On your first request, the API returns recent chat history ordered from oldest to newest. Use `nextPageToken` from the response as the `pageToken` parameter in your next request to retrieve subsequent messages after waiting at least `pollingIntervalMillis` milliseconds.

Public live chats can be read with an API key or OAuth 2.0 authorization. Private, members-only, or paygated live chats, and viewing active poll tallies as the channel owner or a voter, require OAuth 2.0 authorization. For method-specific error responses, see [liveChatMessages.list errors](https://developers.google.com/youtube/data/reference/rest/v3/errors.md.txt#liveChatMessages_youtube.liveChatMessages.list). For code examples, see [liveChatMessages.list code snippets](https://developers.google.com/youtube/data/code_samples/code_snippets.md.txt?method=liveChatMessages.list).

### HTTP request

`GET https://youtube.googleapis.com/youtube/v3/liveChat/messages`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Query parameters

| Parameters ||
|---|---|
| `liveChatId` | `string` Required. The ID of the live chat for which messages should be returned. The live chat ID associated with a broadcast is returned in the [liveBroadcast](https://developers.google.com/youtube/data/reference/rest/v3/liveBroadcasts#LiveBroadcast) resource's `snippet.liveChatId` property or the [video](https://developers.google.com/youtube/data/reference/rest/v3/videos.md.txt#Video.FIELDS.live_streaming_details) resource's `liveStreamingDetails.activeLiveChatId` property. |
| `hl` | `string` Specifies the localization language in which system messages, Super Sticker and gift text, and currency display strings are returned. For example, English (`en-US`, the default) formats currency as `$1.50`, whereas French (`fr`) formats it as `1,50 $`. The value must be a language code returned by [i18nLanguages.list](https://developers.google.com/youtube/data/reference/rest/v3/i18nLanguages/list.md.txt). |
| `profileImageSize` | `integer (uint32 format)` Specifies the square dimensions, in pixels, of user profile images returned in `authorDetails.profileImageUrl`. Acceptable values are `16` to `720`, inclusive. The default value is `88` (88px by 88px); out-of-range values on `liveChatMessages.streamList` fall back to `88`. |
| `maxResults` | `integer (uint32 format)` Specifies the maximum number of items returned in the result set. Acceptable values are `200` to `2000`, inclusive (enforced on `liveChatMessages.list`), and the default value is `500`. On `liveChatMessages.streamList`, this caps each streamed response batch. An initial request made without a `pageToken` returns only the most recent messages (up to 75 messages plus ticker and gift events, which can be fewer than `maxResults`) and doesn't retrieve older messages. |
| `pageToken` | `string` Identifies a specific page in the result set to retrieve. Pass the `nextPageToken` property from a previous response to fetch subsequent messages, or to reopen `liveChatMessages.streamList` in a loop after the server closes the stream or your client disconnects. |
| `part[]` | `string` Required. Specifies a comma-separated list of `liveChatMessage` resource parts that the API response includes. Supported values are `id`, `snippet`, and `authorDetails`. |

### Request body

The request body must be empty.

### Response body

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "kind": string, "etag": string, "pollingIntervalMillis": integer, "offlineAt": string, "pageInfo": { "totalResults": integer, "resultsPerPage": integer }, "nextPageToken": string, "items": [ { object (`LiveChatMessage`) } ], "activePollItem": { object (`LiveChatMessage`) } } ``` |

| Fields ||
|---|---|
| `kind` | `string` Output only. Identifies what kind of resource this is. Value: the fixed string `"youtube#liveChatMessageListResponse"`. |
| `etag` | `string` Output only. Etag of this resource. |
| `pollingIntervalMillis` | `integer (uint32 format)` The amount of time, in milliseconds, that the client should wait before polling again. Returned by `liveChatMessages.list` only; omitted by `liveChatMessages.streamList`. |
| `offlineAt` | `string` The date and time when the underlying livestream went offline. Only present if the stream is already offline. The value is specified in [ISO 8601](https://www.w3.org/TR/NOTE-datetime) (`YYYY-MM-DDThh:mm:ss.sZ`) format. |
| `pageInfo` | `object` General pagination information. |
| `pageInfo.totalResults` | `integer` The total number of results in the result set. |
| `pageInfo.resultsPerPage` | `integer` The number of results included in the API response. |
| `nextPageToken` | `string` The token to pass as the `pageToken` parameter to retrieve the next page of messages, or to reopen `liveChatMessages.streamList` after the server closes the stream or your client disconnects. |
| `items[]` | ``object (`LiveChatMessage`)`` A list of messages. Each item is a `liveChatMessage` resource. |
| `activePollItem` | ``object (`LiveChatMessage`)`` The active poll, returned as a `liveChatMessage` resource whose `snippet.type` is `pollEvent`. Set when there is an active poll; at most one active poll can exist per chat. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/youtube`
- `https://www.googleapis.com/auth/youtube.readonly`
- `https://www.googleapis.com/auth/youtube.force-ssl`

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).