# Write work chat file legacy (legacy)

Source: <https://everruns.com/docs/api/operations/write_work_chat_file_legacy/>

[Docs](https://everruns.com/docs/)/[API reference](https://everruns.com/docs/api/)/[Deprecated](https://everruns.com/docs/api/groups/deprecated/)/Write work chat file legacy

**Deprecated route**

Use the canonical channel route. The legacy alias remains available; no removal date has been announced.

[Open replacement: POST /v1/channels/{channel_id}/sessions/{session_id}/files →](https://everruns.com/docs/api/operations/write_work_chat_file/)

Removal date: not announced.

# Write work chat file legacy (legacy)

Deprecated

Create or update a writable workspace file.

Public APIEverruns Cloud and self-hosted Platform

POST`/v1/e/{channel_id}/sessions/{session_id}/files`

## Authorizations

* **[AgentCredential](https://everruns.com/docs/api/#agentcredential)**

## Parameters

### Path Parameters

**channel_id**

required

string

**session_id**

required

string

### Query Parameters

**path**

string

## Request Bodyrequired

Media typeapplication/json

Revision-checked creation or update of one consumer workspace file.

object

**content**

required

UTF-8 text or base64-encoded bytes.

string

### Example

```plaintext
Meeting notes
```

**encoding**

Content encoding, either text or base64.

string | null

### Example

```plaintext
text
```

**expected_revision**

Revision returned by the previous read; required when replacing a file.

string | null

### Example

```plaintext
f6d4cf68d1e6c37f7d24a5a85db31ba4
```

**path**

required

Absolute path within the consumer workspace.

string

### Example

```plaintext
/workspace/notes.md
```

## Responses

200Success

### 200

Success

Media typeapplication/json

### Example generated

```json
example
```

401Consumer sign-in required

### 401

Consumer sign-in required

404Channel or resource unavailable

### 404

Channel or resource unavailable

FetchcURL

Request

```js
const url = 'https://app.everruns.com/api/v1/e/example/sessions/example/files';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"content":"Meeting notes","encoding":"text","expected_revision":"f6d4cf68d1e6c37f7d24a5a85db31ba4","path":"/workspace/notes.md"}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

Request

```sh
curl --request POST \
  --url https://app.everruns.com/api/v1/e/example/sessions/example/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "content": "Meeting notes", "encoding": "text", "expected_revision": "f6d4cf68d1e6c37f7d24a5a85db31ba4", "path": "/workspace/notes.md" }'
```

Additional language examples require JavaScript. The default request example is available above.

200401404

200 · Success

No response body example is declared for this status.

401 · Consumer sign-in required

No response body example is declared for this status.

404 · Channel or resource unavailable

No response body example is declared for this status.

[Safe retries](https://everruns.com/docs/features/agent-api/#safe-retries) · [Streaming & reconnection](https://everruns.com/docs/features/agent-api/#streaming)

## Matching endpoints