---
title: "GET /v2/threads/{threadId}/messages"
method: GET
path: "/v2/threads/{threadId}/messages"
---

# GET /v2/threads/{threadId}/messages

`GET /v2/threads/{threadId}/messages`

## Request

- Base URL: `https://api.langtail.com`
- URL: `https://api.langtail.com/v2/threads/{threadId}/messages`
- Auth: none declared. Required headers: `X-API-Key`

Retrieves a list of messages for a specific thread.

## Path parameters

- `threadId` string, required

## Query parameters

- `limit` number, nullable
- `after` string, nullable
- `order` 'asc' | 'desc', nullable

## Headers

- `X-API-Key` string, required

## Response `200`

Successful response

- object
  - `object` 'list': The object type, which is always 'list' for a list of messages.
  - `data` object[], required
    - `id` string, required: The unique identifier for the message.
    - `createdAt` string, date-time, required: The timestamp when the message was created.
    - `threadId` string, required: The ID of the thread this message belongs to.
    - `content` object[]: Additional messages. These will be appended to the Prompt Template.
      - `role` 'assistant' | 'user' | 'system' | 'function' | 'tool', required
      - `content` union, required
        - string: Text content
        - union[]: Mix of text and images.
          - union
            - object
              - …
            - object
              - …
        - unknown
      - `function_call` object
        - `name` string, required
        - `arguments` string, required
      - `tool_calls` object[]
        - `id` string, required
        - `type` 'function', required
        - `function` object, required
          - `name` string, required
          - `arguments` string, required
      - `tool_choice` union
        - 'auto'
        - 'none'
        - object
          - `type` 'function', required
          - `function` object, required
            - `name` string, required
      - `tool_call_id` string
    - `requestLogId` string, nullable: The ID of the associated request log, if available.
    - `metadata` object, nullable: A set of key-value pairs that can be attached to the message.
  - `first_id` string, nullable: The ID of the first thread in the list, or null if the list is empty.
  - `last_id` string, nullable: The ID of the last thread in the list, or null if the list is empty.
  - `has_more` boolean, required: Whether there are more threads available after this batch.

## Other responses

- `400`: Bad request
- `404`: Thread not found

---

[API](https://skmtc.dev/langtail/apis/langtail-prompt-endpoint.md) - [All operations](https://skmtc.dev/langtail/apis/langtail-prompt-endpoint/llms.txt) - [OpenAPI document](https://skmtc.dev/langtail/apis/langtail-prompt-endpoint/revisions/7186c80b2e39?raw)
