---
title: "Write a workspace file's text"
method: PUT
path: "/files/content"
tags: ["files"]
---

# Write a workspace file's text

`PUT /files/content`

## Request

- Base URL: `https://www.dench.com/api/v1`
- URL: `https://www.dench.com/api/v1/files/content`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Write a workspace file's text.

## Request body

- object
  - `path` string, required: Workspace file path, e.g. /reports/q2.md. A leading /workspace/ mount prefix is stripped.
  - `content` string, required: Full replacement text (UTF-8, <= 400 KB).
  - `expectedPreviousHash` string: contentHash from the last read; the write is rejected with version_mismatch if the file changed since.

## Response `200`

Successful response

- object
  - `path` string, required: Normalized workspace path that was written.
  - `contentHash` string, required

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid authentication
- `404`: Operation or resource not found
- `500`: Server error

---

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