# Listing files/folders

### List files and folders

Listing files and folder can be done using the LS method. This method returns a list of all objects in a folder.&#x20;

## /file/ls

<mark style="color:green;">`POST`</mark> `https://fileio.couchdrop.io/file/ls`

List files and directories in a given path

#### Headers

| Name  | Type   | Description      |
| ----- | ------ | ---------------- |
| token | string | API Access Token |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| path | string | Target Path |

{% tabs %}
{% tab title="200 A list of objects describing files and folders" %}

```
{
    "ls":[
        {
            "filename": "document1.txt",
            "size:": 10234,
            "modtime": 1578531065,
            "is_dir": false
        },
        {
            "filename": "folder1",
            "size:": 0,
            "modtime": 0,
            "is_dir": true
        }
    ]
}
```

{% endtab %}

{% tab title="403 " %}

```
{"error": "you do not have the right permissions"}
```

{% endtab %}

{% tab title="500 " %}

```
{"error": "we encountered an error"}
```

{% endtab %}
{% endtabs %}

#### Get file/folder details

You can use the LSTAT method to get details on an individual file or folder

## /file/lstat

<mark style="color:green;">`POST`</mark> `https://fileio.couchdrop.io/file/lstat`

Retrieve properties for a file or folder.&#x20;

#### Headers

| Name  | Type   | Description      |
| ----- | ------ | ---------------- |
| token | string | API Access Token |

#### Request Body

| Name | Type   | Description                    |
| ---- | ------ | ------------------------------ |
| path | string | Target path of file or folder. |

{% tabs %}
{% tab title="200 " %}

```
{
    "lstat": {
        "filename": "document1.txt",
        "size:": 10234,
        "modtime": 1578531065,
        "is_dir": false
    }
}
```

{% endtab %}
{% endtabs %}

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.couchdrop.io/filesystem-operations/managing-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
