---
title: "listFiles"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# listFiles

Path: agenthold API › files

`GET /agents/{agentId}/files`

URL: `/api/v1/agents/{agentId}/files`

List a directory. Relative paths are relative to /home/agent. The agent must be running.

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`listFiles.path.agentId`; string, required)

## Query parameters

- `path` (`listFiles.query.path`; string, optional)

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/api/v1/agents/<agentId>/files' \
  --cookie 'agenthold_session=<agenthold_session>'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>/files';
const options = {
  method: 'GET',
  headers: {cookie: 'agenthold_session=<agenthold_session>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/agents/<agentId>/files"

headers = {"cookie": "agenthold_session=<agenthold_session>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

Directory listing.

#### Example

```json
{
  "path": "string",
  "entries": [
    {
      "name": "string",
      "size": 0,
      "mode": "string",
      "isDir": true,
      "isLink": true,
      "modTime": "2019-08-24T14:15:22Z"
    }
  ]
}
```

- `path` (`listFiles.response.200.path`; string, required) — Absolute path of the directory.
- `entries` (`listFiles.response.200.entries`; array of object, required)
  - `name` (`listFiles.response.200.entries.name`; string, required)
  - `size` (`listFiles.response.200.entries.size`; integer, required)
    - format: `int64`
  - `mode` (`listFiles.response.200.entries.mode`; string, required)
  - `isDir` (`listFiles.response.200.entries.isDir`; boolean, required)
  - `isLink` (`listFiles.response.200.entries.isLink`; boolean, required)
  - `modTime` (`listFiles.response.200.entries.modTime`; string, required)
    - format: `date-time`

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`listFiles.response.400.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`listFiles.response.404.error`; string, required)

### 409

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`listFiles.response.409.error`; string, required)


Source: https://agenthold.dev/api/list-files/index.md
