---
title: "List Agent Files"
method: GET
path: "/v1/agents/{agent_id}/files"
tags: ["agents"]
---

# List Agent Files

`GET /v1/agents/{agent_id}/files`

Get the files attached to an agent with their open/closed status (paginated).

## Path parameters

- `agent_id` string, required

## Query parameters

- `before` string, nullable — File ID cursor for pagination. Returns files that come before this file ID in the specified sort order
- `after` string, nullable — File ID cursor for pagination. Returns files that come after this file ID in the specified sort order
- `limit` integer, nullable — Maximum number of files to return
- `order` 'asc' | 'desc' — Sort order for files by creation time. 'asc' for oldest first, 'desc' for newest first
- `order_by` 'created_at' — Field to sort by
- `cursor` string, nullable — Pagination cursor from previous response (deprecated, use before/after)
- `is_open` boolean, nullable — Filter by open status (true for open files, false for closed files)

## Response `200`

Successful Response

- PaginatedAgentFiles — Paginated response for agent files
  - `files` AgentFileAttachment[], required — List of file attachments for the agent
    - `id` string, required — Unique identifier of the file-agent relationship
    - `file_id` string, required — Unique identifier of the file
    - `file_name` string, required — Name of the file
    - `folder_id` string, required — Unique identifier of the folder/source
    - `folder_name` string, required — Name of the folder/source
    - `is_open` boolean, required — Whether the file is currently open in the agent's context
    - `last_accessed_at` string, date-time, nullable — Timestamp of last access by the agent
    - `visible_content` string, nullable — Portion of the file visible to the agent if open
    - `start_line` integer, nullable — Starting line number if file was opened with line range
    - `end_line` integer, nullable — Ending line number if file was opened with line range
  - `next_cursor` string, nullable — Cursor for fetching the next page (file-agent relationship ID)
  - `has_more` boolean, required — Whether more results exist after this page

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/yu-code666/apis/letta-api.md) · [All operations](https://skmtc.net/yu-code666/apis/letta-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/yu-code666/letta-api/versions/6cec99480c13/schema)
