---
title: "Upload Session Cwd File"
method: POST
path: "/sessions/mounts/files/upload"
tags: ["Sessions"]
---

# Upload Session Cwd File

`POST /sessions/mounts/files/upload`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/sessions/mounts/files/upload`
- Auth: API key in header `Authorization`

Write a file into the session's working directory, creating that mount if needed.

The composer uses this for files over the attachment cap. A session that has not run
yet has no working-directory mount, and the only other route that creates one also
signs storage credentials, which the browser must never receive.

## Query parameters

- `session_id` string, required
- `path` string, nullable

## Request body `multipart/form-data`

- BodyUploadSessionCwdFile
  - `file` string, binary, required

## Response `200`

Successful Response

- MountFileWrittenResponse
  - `path` string, required
  - `size` integer
  - `etag` string, nullable

## Other responses

- `400`: `session_id` is not a valid session id.
- `422`: Validation Error

## Changes

- **2026-10-21** `1d98cd0e4892`: 1 info
  - added the non-success response with the status `400`
- **2026-10-18** `722c7cc3556b`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/sessions/mounts/files/upload/post.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) - [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agenta-ai/apis/agenta-api/revisions/ab601a2309da?raw)
