---
# @generated by sylphx-gen 0.1.0 from contracts@e145cc7cf1bc9605f2b27439e5e17ed76a1a2fd7e7021906a013f7565e4a0cd5. Do not edit.
title: "List files on a lease"
description: "`sandboxes.leases.list_files` (POST /v1/{name}:listFiles): Lists one directory in the lease."
type: reference
product: sandboxes
summary: "Lists one directory in the lease."
updated: 2026-09-28
nav: false
---

Lists one directory in the lease.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:listFiles`
- **Scope** `sandboxes:exec`
- **Effect** `read` — nothing is written.
- **Collection** [leases](/docs/api/leases)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | The name of the lease. Required. |
| `path` | `string` | The absolute directory path in the guest. Required. |
| `depth` | `int32` | Descend this many levels; default 1. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `entries` | `FileEntry[]` | The entries. |

### FileEntry

| Field | Type | What it is |
| --- | --- | --- |
| `path` | `string` | The absolute path. |
| `directory` | `bool` | Whether it is a directory. |
| `size_bytes` | `int64` | Size in bytes. |
| `mode` | `int32` | The mode bits. |
| `modify_time` | `timestamp` | When it last changed. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`NOT_FOUND`](/docs/api/errors/NOT_FOUND) — No method is served at this path.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:listFiles" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"path":"…"}'
```

**TypeScript**

```ts
const response = await sylphx.sandboxes.leases.listFiles({ name: 'orgs/acme/projects/shop/envs/production/leases/lease', path: '…' })
```

**Rust**

```rust
let mut req = sylphx::sandboxes::ListLeaseFilesRequest::default();
req.name = "orgs/acme/projects/shop/envs/production/leases/lease".to_string();
req.path = "…".to_string();
let response = sx.sandboxes().leases().list_files(req).await?;
```

**CLI**

```bash
sylphx sandboxes leases list-files orgs/acme/projects/shop/envs/production/leases/lease
```

**MCP**

```json
{ "method_id": "sandboxes.leases.list_files", "args": {"name":"orgs/acme/projects/shop/envs/production/leases/lease","path":"…"} }
```
