---
title: "List directory"
method: GET
path: "/api/fs/list"
tags: ["filesystem"]
---

# List directory

`GET /api/fs/list`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/fs/list`
- Auth: none required

List direct children using an absolute path or a path relative to the requested location, including parents and siblings outside its directory. Entry paths remain relative to the requested location; listing does not switch locations.

## Query parameters

- `location` object, nullable
  - `directory` string, nullable
- `path` string, nullable: An absolute path or a path relative to the requested location. Defaults to the location directory.

## Response `200`

Success

- object
  - `location` LocationPublicRef, required
    - `directory` string, required
  - `data` FileSystemEntry[], required
    - `path` string, required
    - `type` 'file' | 'directory', required

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: FileNotFoundError | LocationNotFoundError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
