> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trellis.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Chat

> Retrieve a specific chat with all its messages

Returns the full conversation history for a chat.

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the authenticate endpoint.
</ParamField>

<ParamField path="chat_id" type="string" required>
  Unique identifier of the chat to retrieve.
</ParamField>

## Response

<ResponseField name="id" type="string" required>
  Unique identifier for the chat.
</ResponseField>

<ResponseField name="title" type="string" required>
  Display title for the chat.
</ResponseField>

<ResponseField name="preview" type="string">
  Preview of the first message.
</ResponseField>

<ResponseField name="messages" type="array" required>
  List of messages in the conversation.

  <Expandable title="Message object">
    <ResponseField name="id" type="string" required>
      Unique identifier for the message.
    </ResponseField>

    <ResponseField name="role" type="string" required>
      Either `"user"` or `"assistant"`.
    </ResponseField>

    <ResponseField name="content" type="string" required>
      The message content.
    </ResponseField>

    <ResponseField name="timestamp" type="string" required>
      ISO 8601 timestamp when the message was created.
    </ResponseField>

    <ResponseField name="metadata" type="object">
      Additional metadata.

      <Expandable title="Metadata properties">
        <ResponseField name="feedback" type="string">
          User feedback on the message. Either `"positive"` or `"negative"`.
        </ResponseField>

        <ResponseField name="uploads" type="array">
          File attachments linked to this message. Present on user messages that referenced `upload_ids`. Each upload includes a fresh presigned download URL.

          <Expandable title="Upload object">
            <ResponseField name="id" type="string">
              Upload identifier.
            </ResponseField>

            <ResponseField name="filename" type="string">
              Original filename.
            </ResponseField>

            <ResponseField name="upload_type" type="string">
              Either `"document"` or `"image"`.
            </ResponseField>

            <ResponseField name="mime_type" type="string">
              MIME type of the file.
            </ResponseField>

            <ResponseField name="file_size" type="integer">
              File size in bytes.
            </ResponseField>

            <ResponseField name="storage_path" type="string">
              Internal storage path.
            </ResponseField>

            <ResponseField name="presigned_url" type="string">
              Temporary download URL (1-hour expiry).
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET https://api.trellis.sh/v1/chats/chat_abc123 \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  response = requests.get(
      "https://api.trellis.sh/v1/chats/chat_abc123",
      headers={"Authorization": "Bearer YOUR_TOKEN"}
  )
  chat = response.json()
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch("https://api.trellis.sh/v1/chats/chat_abc123", {
    headers: { Authorization: "Bearer YOUR_TOKEN" },
  });
  const chat = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "id": "chat_abc123",
    "title": "Revenue Analysis",
    "preview": "Show me the monthly revenue trends...",
    "messages": [
      {
        "id": "msg_001",
        "role": "user",
        "content": "Analyze the attached report and show me monthly revenue trends",
        "timestamp": "2025-01-11T14:30:00Z",
        "metadata": {
          "uploads": [
            {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "filename": "report.pdf",
              "upload_type": "document",
              "mime_type": "application/pdf",
              "file_size": 245760,
              "storage_path": "chat_uploads/abc123.pdf",
              "presigned_url": "https://s3.amazonaws.com/..."
            }
          ]
        }
      },
      {
        "id": "msg_002",
        "role": "assistant",
        "content": "Here's the monthly revenue breakdown for 2025:\n\n| Month | Revenue |\n|-------|--------|\n| January | $125,000 |\n| February | $142,000 |\n...",
        "timestamp": "2025-01-11T14:30:10Z",
        "metadata": {
          "feedback": "positive"
        }
      }
    ]
  }
  ```

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Chat not found"
  }
  ```
</ResponseExample>
