# Write session files

> Write, move and delete files in a task's working folder. Change a task's files between turns, so the next turn works on what you put there.

Canonical URL: https://harnessrouter.ai/docs/write-session-files
Section: API reference

## Endpoints

Write to a task's folder:

```
PUT    /v1/sessions/{id}/files/{path}         {"content": "..."} or {"content_b64": "..."}
POST   /v1/sessions/{id}/files/{path}:mkdir   create a folder
POST   /v1/sessions/{id}/files/{path}:move    {"to": "<new path>"}
DELETE /v1/sessions/{id}/files/{path}         delete a file, or a folder and everything in it
```

## Rules

- **Size:** Up to 4 MiB per write; more answers 413 with `payload_too_large`. For larger files, upload them and name them on the next task.
- **While a turn runs:** Every change answers 409 with `session_busy`, so the agent never sees a file change under it. Write between turns.
- **Paths:** Relative to the task's folder.

- [Sessions and files](https://harnessrouter.ai/docs/sessions-and-files): Reading a task's files and its archive.
- [Upload files](https://harnessrouter.ai/docs/upload-files): Larger inputs for a task.

## Open standard

Writing straight into a session's working folder complements the upload and archive paths of the Files chapter: the next turn reads whatever your server put there, by the same relative path. See [file handling in UHP's Files chapter](https://unifiedharnessprotocol.org/spec/files).
