---
title: "List chat attachments"
method: GET
path: "/api/v2/chats/{chat}/attachments"
tags: ["Chats"]
---

# List chat attachments

`GET /api/v2/chats/{chat}/attachments`

## Request

- Base URL: `/` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v2/chats/{chat}/attachments`
- Auth: API key in header `Coder-Session-Token`

Returns every file part in the user-visible user and assistant messages of a chat, newest first, so a client can list a chat's attachments without paging through every message in the chat.

## Path parameters

- `chat` string, uuid, required

## Query parameters

- `before_id` integer

## Response `200`

OK

- CodersdkChatAttachmentsResponse
  - `attachments` CodersdkChatAttachment[]
    - `file` CodersdkChatAttachmentFile
      - `data` string, byte: Data holds an inline file's bytes, which JSON carries as a base64 string.
      - `file_id` string, uuid: Omitted, not null, for an inline file.
      - `media_type` string
      - `name` string
      - `type` 'file'
    - `message_id` integer
    - `part_index` integer: PartIndex is the file part's position in the message content the messages endpoint returns.
    - `role` 'user' | 'assistant'

## Changes

- **2026-10-27** `11128b5de00c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/coder/apis/coder-api/changes/api/v2/chats/:chat/attachments/get.md)

---

[API](https://skmtc.dev/coder/apis/coder-api.md) - [All operations](https://skmtc.dev/coder/apis/coder-api/llms.txt) - [OpenAPI document](https://skmtc.dev/coder/apis/coder-api/revisions/4669d93796ab?raw)
