# Files

Read and write files in the sandbox work folder.

`PUT /v1/sandboxes/{id}/files`

```http
PUT /v1/sandboxes/{id}/files

{"path":"app/main.py","text":"print('hello')\n"}
```

`GET /v1/sandboxes/{id}/files?path=`

```json
{"path":"app/main.py","encoding":"text","text":"print('hello')\n"}
```

- `path` is relative to `/opt/agental`. Absolute paths and `..` are refused. Missing folders are created.
- For binary files, send `base64` instead of `text`, and read with `&encoding=base64`.
- A file can be up to 10 MB. For more, use commands: `git clone`, `curl -O`, `tar`.
- A missing file answers `404 file_not_found`.

---

Every page of these docs as Markdown: [llms.txt](https://agental.io/llms.txt)
