---
title: "Fetches chat message and metadata for messages in a chat session."
method: GET
path: "/chats/{session_id}/messages"
tags: ["Chat"]
---

# Fetches chat message and metadata for messages in a chat session.

`GET /chats/{session_id}/messages`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/chats/{session_id}/messages`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/chats/:session_id/messages/get.ts> (a function with typed inputs; its response is checked against the schema)

Fetches chat message and metadata for messages in a chat session. Messages without a `reply_to` are from the end user, messages with a `reply_to` are from an LLM and a response to a specific user message.

## Path parameters

- `session_id` string, required

## Query parameters

- `offset` integer
- `limit` integer

## Response `200`

Successful operation

- ChatMessage[]
  - `id` string, required
  - `content` string, required
  - `votes` integer, required
  - `created_at` string, date-time, required
  - `has_references` boolean, required
  - `total_references` integer, required
  - `username` string
  - `reply_to` string
  - `error` string
  - `llm_args` string: JSON-encoded LLM arguments (e.g. `{"use_agent": true}`) that were applied when the question was dispatched. Only populated on question messages (`reply_to` is null); reply messages have `llm_args = "null"` (literal string).
  - `type_list` ChatMessageMeta[]
    - `message_type` string, required
    - `content` string, required

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `404`: Not found
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
