---
title: "List files in a session"
method: GET
path: "/v1/files"
tags: ["files"]
---

# List files in a session

`GET /v1/files`

List all files associated with a session, combining uploaded input files and sandbox-generated output files. Results are sorted by creation time and support cursor-based pagination.

## Query parameters

- `scope_id` string, required
- `limit` integer
- `after_id` string, nullable
- `before_id` string, nullable
- `namespace` string
- `prefix` string, nullable

## Response `200`

Successful Response

- FileListResponse — Paginated list of files in a session.
  - `data` FileMetadata[] — List of file metadata objects for the current page.
    - `id` string, required — Relative path of the file within the session, e.g. 'uploads/data.csv' or 'outputs/result.png'. Use this value as `file_id` in subsequent requests.
    - `created_at` string, date-time, required — ISO-8601 timestamp when the file was created or last modified.
    - `filename` string, required — Filename derived from the path.
    - `mime_type` string, required — MIME type detected from the file content.
    - `size_bytes` integer, required — File size in bytes.
    - `type` 'file' — Object type discriminator, always 'file'.
    - `downloadable` boolean, required — True for sandbox output files; False for uploaded input files.
    - `etag` string, nullable — Content checksum (MD5 hex or S3 ETag). Present after stat; None if unavailable.
    - `namespace` string — Namespace this file belongs to (e.g. 'session', 'skills', or a custom namespace).
    - `scope` FileScope, required — Scope that a file belongs to (always a session).
      - `id` string, required — Session / container identifier that owns this file.
      - `type` string — Namespace the file belongs to (e.g. 'session', 'skills', or a custom namespace).
  - `first_id` string, nullable — ID of the first file in the current page, used for cursor-based pagination.
  - `last_id` string, nullable — ID of the last file in the current page, used for cursor-based pagination.
  - `has_more` boolean — True when there are additional pages of results beyond this one.

## Other responses

- `401` — Unauthorized
- `422` — Validation Error

---

[API](https://skmtc.dev/privategpt/apis/api-reference.md) · [All operations](https://skmtc.dev/privategpt/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/privategpt/api-reference/revisions/15d9ccfd68da/schema)
