---
# @generated by sylphx-gen 0.1.0 from contracts@e145cc7cf1bc9605f2b27439e5e17ed76a1a2fd7e7021906a013f7565e4a0cd5. Do not edit.
title: "Read file on a lease"
description: "`sandboxes.leases.read_file` (POST /v1/{name}:readFile): Reads one file from the lease, at most 16 MiB; larger files use the guest's `/files`."
type: reference
product: sandboxes
summary: "Reads one file from the lease, at most 16 MiB; larger files use the guest's `/files`."
updated: 2026-09-28
nav: false
---

Reads one file from the lease, at most 16 MiB; larger files use the guest's `/files`.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:readFile`
- **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 path in the guest. Required. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `content` | `bytes` | The file's bytes. |
| `mode` | `int32` | The file mode bits. |

## 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:readFile" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"path":"…"}'
```

**TypeScript**

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

**Rust**

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

**CLI**

```bash
sylphx sandboxes leases read-file orgs/acme/projects/shop/envs/production/leases/lease
```

**MCP**

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