# List Directory Contents

Launch stage: GA

`GET /api/2.0/fs/directories{directory_path}`

Returns the contents of a directory.
 If there is no directory at the specified path, the API returns an HTTP 404 error.

API scopes: files

## Path parameters

- `directory_path` (string, optional)
  The absolute path of a directory.

## Query parameters

- `page_size` (int64, optional)
  The maximum number of directory entries to return. The response may contain fewer
   entries. If the response contains a `next_page_token`, there may be more entries,
   even if fewer than `page_size` entries are in the response.
  
   We recommend not to set this value unless you are intentionally listing less than
   the complete directory contents.
  
   If unspecified, at most 1000 directory entries will be returned.
   The maximum value is 1000. Values above 1000 will be coerced to 1000.
  Default: `1000`
- `page_token` (string, optional)
  An opaque page token which was the `next_page_token` in the response of the previous
   request to list the contents of this directory. Provide this token to retrieve the
   next page of directory entries.
   When providing a `page_token`, all other parameters provided to the request must match
   the previous request.
   To list all of the entries in a directory, it is necessary to continue requesting
   pages of entries until the response contains no `next_page_token`. Note that the
   number of entries returned must not be used to determine when the listing is complete.

## Returns

- `contents` (array of object, optional)
  Array of DirectoryEntry.
  - `file_size` (int32, optional)
    The length of the file in bytes. This field is omitted for directories.
  - `is_directory` (boolean, optional)
    True if the path is a directory.
  - `last_modified` (int32, optional)
    Last modification time of given file in milliseconds since unix epoch.
  - `name` (string, optional)
    The name of the file or directory. This is the last component of the path.
  - `path` (string, optional)
    The absolute path of the file or directory.
- `next_page_token` (string, optional)
  A token, which can be sent as `page_token` to retrieve the next page.

## Response

```json
{
  "contents": [
    {
      "file_size": 0,
      "is_directory": true,
      "last_modified": 0,
      "name": "string",
      "path": "string"
    }
  ],
  "next_page_token": "string"
}
```

