# Read a file

> GET /v1/sandboxes/{sandboxId}/files

`GET https://api.zavu.dev/v1/sandboxes/{sandboxId}/files`

## Parameters

- `sandboxId` (path, string, required): Sandbox ID.
- `path` (query, string, required): Absolute, or relative to `/home/user`. Must resolve under `/home/user` or `/tmp`.
- `encoding` (query, string): Use `base64` for binary files. One of: `utf8`, `base64`.

## Responses

### 200

The file.

- `file` (object, required)
  - `path` (string, required)
  - `content` (string): Present on read.
  - `encoding` (string) One of: `utf8`, `base64`.
  - `size` (integer, required): Bytes.

### 400

Missing or invalid `path`, or a path outside `/home/user` and `/tmp`.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 404

Sandbox not found, or it belongs to another project.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 409

`sandbox_not_running`: the sandbox is stopped, stopping, failed or deleted; resume it first. `sandbox_not_ready`: it is still starting and did not become ready in time; retry.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 413

`file_too_large`: the file is larger than 5 MiB.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X GET "https://api.zavu.dev/v1/sandboxes/sandbox_abc123/files?path=string" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY"
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.sandboxes.files.read("sandbox_abc123", {
  path: "string",
});

console.log(result);
```
