---
title: "Save a memory file"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Save a memory file

Path: CloudRaker Workspace API › My assistant

`PUT /me/assistant/memory-repo/files`

Creates or replaces one file. `expectBlob` is the blob you read (null for a new file), so a concurrent edit answers 409 instead of being overwritten.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `path` (`putMyAssistantMemoryRepoFile.path`; string, required)
  - minLength 1; maxLength 512
- `content` (`putMyAssistantMemoryRepoFile.content`; string, required)
  - maxLength 262144
- `expectBlob` (`putMyAssistantMemoryRepoFile.expectBlob`; any of, required) — The blob you read, or null to create a new file. Stale values answer 409.
  - any of: `string`, `null`
- `message` (`putMyAssistantMemoryRepoFile.message`; string, optional)
  - minLength 1; maxLength 500

## Example request

```json
{
  "path": "string",
  "content": "string",
  "expectBlob": "string",
  "message": "string"
}
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url https://api.cloudraker.com/me/assistant/memory-repo/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "path": "string",
  "content": "string",
  "expectBlob": "string",
  "message": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/me/assistant/memory-repo/files';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({path: 'string', content: 'string', expectBlob: 'string', message: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/me/assistant/memory-repo/files"

payload = {
    "path": "string",
    "content": "string",
    "expectBlob": "string",
    "message": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Nothing changed; the unchanged head

#### Example

```json
{
  "data": {
    "sha": "string",
    "branch": "string",
    "changed": 0
  }
}
```

- `data` (`putMyAssistantMemoryRepoFile.response.200.data`; object, required)
  - `sha` (`putMyAssistantMemoryRepoFile.response.200.data.sha`; string | null, required)
  - `branch` (`putMyAssistantMemoryRepoFile.response.200.data.branch`; string, required)
  - `changed` (`putMyAssistantMemoryRepoFile.response.200.data.changed`; number, required) — How many files the version changed.

### 201

The new version

#### Example

```json
{
  "data": {
    "sha": "string",
    "branch": "string",
    "changed": 0
  }
}
```

- `data` (`putMyAssistantMemoryRepoFile.response.201.data`; object, required)
  - `sha` (`putMyAssistantMemoryRepoFile.response.201.data.sha`; string | null, required)
  - `branch` (`putMyAssistantMemoryRepoFile.response.201.data.branch`; string, required)
  - `changed` (`putMyAssistantMemoryRepoFile.response.201.data.changed`; number, required) — How many files the version changed.

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`putMyAssistantMemoryRepoFile.response.400.success`; boolean, required)
  - one of `false`
- `error` (`putMyAssistantMemoryRepoFile.response.400.error`; array<unknown>, required)
- `data` (`putMyAssistantMemoryRepoFile.response.400.data`; unknown, required)

### 403

`personal_account_required` — only the owner may open this memory.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`putMyAssistantMemoryRepoFile.response.403.error`; string, required) — The sentence a human reads.
- `error_code` (`putMyAssistantMemoryRepoFile.response.403.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`putMyAssistantMemoryRepoFile.response.403.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`putMyAssistantMemoryRepoFile.response.403.issues.path`; string, required)
  - `code` (`putMyAssistantMemoryRepoFile.response.403.issues.code`; string, required)
  - `message` (`putMyAssistantMemoryRepoFile.response.403.issues.message`; string, required)

### 404

`memory_not_available` — this memory does not exist for you.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`putMyAssistantMemoryRepoFile.response.404.error`; string, required) — The sentence a human reads.
- `error_code` (`putMyAssistantMemoryRepoFile.response.404.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`putMyAssistantMemoryRepoFile.response.404.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`putMyAssistantMemoryRepoFile.response.404.issues.path`; string, required)
  - `code` (`putMyAssistantMemoryRepoFile.response.404.issues.code`; string, required)
  - `message` (`putMyAssistantMemoryRepoFile.response.404.issues.message`; string, required)

### 409

`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`putMyAssistantMemoryRepoFile.response.409.error`; string, required) — The sentence a human reads.
- `error_code` (`putMyAssistantMemoryRepoFile.response.409.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`putMyAssistantMemoryRepoFile.response.409.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`putMyAssistantMemoryRepoFile.response.409.issues.path`; string, required)
  - `code` (`putMyAssistantMemoryRepoFile.response.409.issues.code`; string, required)
  - `message` (`putMyAssistantMemoryRepoFile.response.409.issues.message`; string, required)

### 422

`lint_failed` — `violations` lists each file rule the change broke.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`putMyAssistantMemoryRepoFile.response.422.error`; string, required) — The sentence a human reads.
- `error_code` (`putMyAssistantMemoryRepoFile.response.422.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`putMyAssistantMemoryRepoFile.response.422.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`putMyAssistantMemoryRepoFile.response.422.issues.path`; string, required)
  - `code` (`putMyAssistantMemoryRepoFile.response.422.issues.code`; string, required)
  - `message` (`putMyAssistantMemoryRepoFile.response.422.issues.message`; string, required)


Source: https://docs.cloudraker.com/workspace/api/my-assistant/put-my-assistant-memory-repo-file/index.md
