---
agentTools:
  projectIndex: https://seafile-api.readme.io/llms.txt
---

# List items in directory

List all files and folders in a directory

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Via Repo-Token",
    "description": "Access library Via Repo-Token",
    "version": "13.0"
  },
  "servers": [
    {
      "url": "https://{server}",
      "variables": {
        "server": {
          "default": "cloud.seafile.com"
        }
      }
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "metrics-enabled": false,
    "proxy-enabled": false
  },
  "components": {
    "securitySchemes": {
      "RepoTokenAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "This is the [Repo-Token](/reference/authentication).",
        "bearerFormat": "Repo-Token"
      }
    },
    "parameters": {
      "dir_path": {
        "name": "path",
        "in": "query",
        "description": "Path to the dir",
        "required": true,
        "schema": {
          "type": "string",
          "default": "/"
        },
        "example": "/folder"
      },
      "type": {
        "name": "type",
        "in": "query",
        "description": "Items' type which will be list, limit in 'f' and 'd', means file and directory",
        "required": false,
        "schema": {
          "type": "string",
          "default": ""
        }
      },
      "recursive": {
        "name": "recursive",
        "in": "query",
        "description": "List items recursively",
        "required": false,
        "schema": {
          "type": "string",
          "default": "0"
        }
      },
      "with_thumbnail": {
        "name": "with_thumbnail",
        "in": "query",
        "description": "Whether some kinds of files are with thumbnail, video, image, etc.",
        "required": false,
        "schema": {
          "type": "string",
          "default": "false"
        }
      },
      "thumbnail_size": {
        "name": "thumbnail_size",
        "in": "query",
        "description": "Thumbnail's size",
        "required": false,
        "schema": {
          "type": "integer",
          "default": 48
        }
      }
    }
  },
  "paths": {
    "/api/v2.1/via-repo-token/dir/": {
      "get": {
        "summary": "List items in directory",
        "tags": [
          "Dir / Files"
        ],
        "description": "List all files and folders in a directory",
        "security": [
          {
            "RepoTokenAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/dir_path"
          },
          {
            "$ref": "#/components/parameters/type"
          },
          {
            "$ref": "#/components/parameters/recursive"
          },
          {
            "$ref": "#/components/parameters/with_thumbnail"
          },
          {
            "$ref": "#/components/parameters/thumbnail_size"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "List of items",
                  "properties": {
                    "user_perm": {
                      "type": "string"
                    },
                    "dir_id": {
                      "type": "string"
                    },
                    "dirent_list": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "example": {
                    "user_perm": "rw",
                    "dir_id": "dc561abe027728f36ea6d02b7b4439ba1aba1b3b",
                    "dirent_list": [
                      {
                        "type": "dir",
                        "id": "04f3fb2b992c7aa1eb897a4e2c46b3212def1028",
                        "name": "folder",
                        "mtime": 1575514722,
                        "permission": "rw",
                        "parent_dir": "/",
                        "starred": false
                      },
                      {
                        "type": "file",
                        "id": "0000000000000000000000000000000000000000",
                        "name": "1.txt",
                        "mtime": 1576548579,
                        "permission": "rw",
                        "parent_dir": "/",
                        "size": 0,
                        "modifier_email": "test@seafile.com",
                        "modifier_name": "test_user",
                        "modifier_contact_email": "test@seafile.com",
                        "is_locked": false,
                        "lock_time": 0,
                        "lock_owner": "",
                        "lock_owner_name": "",
                        "lock_owner_contact_email": "",
                        "locked_by_me": false,
                        "starred": false
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "_id": {
    "buffer": {
      "0": 103,
      "1": 183,
      "2": 248,
      "3": 230,
      "4": 103,
      "5": 20,
      "6": 160,
      "7": 0,
      "8": 41,
      "9": 50,
      "10": 176,
      "11": 74
    }
  }
}
```